• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CYASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CYASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CYASSERT函数的具体用法?C++ CYASSERT怎么用?C++ CYASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CYASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

/* Main loop */
int main()
{
    CYBLE_API_RESULT_T apiResult;
    
    CyGlobalIntEnable;
    Initialization();
    
    for(;;)
    {
        /* Delayed start of advertisement */
        if(initCounter == 6)
        {
            initCounter = 7;
            WDT_DisableWcoEcoCounters();
            
            apiResult = CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_CUSTOM);
            if(apiResult != CYBLE_ERROR_OK)
            {
                CYASSERT(0);
            }
        }
        
        CyBle_ProcessEvents(); /* BLE stack processing state machine interface */
        
        LowPower();
    }
}
开发者ID:Ahamedjee,项目名称:PSoC-4-BLE,代码行数:28,代码来源:main.c


示例2: Midi_UpdateBufferPointers

/*******************************************************************************
* Function Name: Midi_UpdateBufferPointers
********************************************************************************
*
* Summary:
*  This function updates the MIDI buffer pointers
*
* Parameters:
*  void
*
* Return:
*  None
*
*******************************************************************************/
static void Midi_UpdateBufferPointers(void)
{
    if(midiBuffer.midiPacket[midiBuffer.packetIndex].packetStatus == MIDI_PACKET_VALID &&
        midiBuffer.midiPacket[midiBuffer.packetIndex].dataIndex >= (CYBLE_GATT_MTU - MAX_MIDI_PACKET_LENGTH + 1))
    {
        midiBuffer.packetIndex++;
        
        if(midiBuffer.packetIndex == MAX_NUMBER_OF_MIDI_PACKETS)
        {
            midiBuffer.packetIndex = 0;
        }
        
        if(midiBuffer.midiPacket[midiBuffer.packetIndex].packetStatus == MIDI_PACKET_VALID)
        {
            /* The updated packet is still valid and is not sent over BLE. Flag this as an overflow condition */
            CYASSERT(0);
        }
    }
    
    if(midiBuffer.midiPacket[midiBuffer.packetIndex].dataIndex == 0)
    {
        /* Insert the header byte to the packet structure */
        midiBuffer.midiPacket[midiBuffer.packetIndex].midiNotificationPacket\
        [midiBuffer.midiPacket[midiBuffer.packetIndex].dataIndex++] = MIDI_PACKET_HEADER;
        
        midiBuffer.midiPacket[midiBuffer.packetIndex].packetStatus = MIDI_PACKET_VALID;
    }
}
开发者ID:bhwj,项目名称:BLE,代码行数:42,代码来源:MIDI.c


示例3: adc_SetOffset

/*******************************************************************************
* Function Name: adc_SetOffset
********************************************************************************
*
* Summary:
*   Description: Sets the ADC offset which is used by the functions
*   ADC_CountsTo_uVolts, ADC_CountsTo_mVolts and ADC_CountsTo_Volts
*   to substract the offset from the given reading
*   before calculating the voltage conversion.
*
* Parameters:
*  chan: ADC channel number.
*  offset: This value is a measured value when the
*          inputs are shorted or connected to the same input voltage.
*
* Return:
*  None.
*
* Global variables:
*  adc_Offset:  Modified to set the user provided offset.
*
*******************************************************************************/
void adc_SetOffset(uint32 chan, int16 offset)
{
    /* Halt CPU in debug mode if channel is out of valid range */
    CYASSERT(chan < adc_TOTAL_CHANNELS_NUM);

    adc_offset[chan] = offset;
}
开发者ID:iotexpert,项目名称:CY8CKIT-021,代码行数:29,代码来源:adc.c


示例4: ADC_SAR_Seq_0_SetOffset

/*******************************************************************************
* Function Name: ADC_SAR_Seq_0_SetOffset
********************************************************************************
*
* Summary:
*   Description: Sets the ADC offset which is used by the functions
*   ADC_CountsTo_uVolts, ADC_CountsTo_mVolts and ADC_CountsTo_Volts
*   to substract the offset from the given reading
*   before calculating the voltage conversion.
*
* Parameters:
*  chan: ADC channel number.
*  offset: This value is a measured value when the
*          inputs are shorted or connected to the same input voltage.
*
* Return:
*  None.
*
* Global variables:
*  ADC_SAR_Seq_0_Offset:  Modified to set the user provided offset.
*
*******************************************************************************/
void ADC_SAR_Seq_0_SetOffset(uint32 chan, int16 offset)
{
    /* Halt CPU in debug mode if channel is out of valid range */
    CYASSERT(chan < ADC_SAR_Seq_0_TOTAL_CHANNELS_NUM);

    ADC_SAR_Seq_0_offset[chan] = offset;
}
开发者ID:mickkn,项目名称:E3PRJ3,代码行数:29,代码来源:ADC_SAR_Seq_0.c


示例5: TPS_ADC_SAR_SetResolution

/*******************************************************************************
* Function Name: TPS_ADC_SAR_SetResolution
********************************************************************************
*
* Summary:
*  Sets the Relution of the SAR.
*
* Parameters:
*  resolution:
*  12 ->    RES12
*  10 ->    RES10
*  8  ->    RES8
*
* Return:
*  None.
*
* Side Effects:
*  The ADC resolution cannot be changed during a conversion cycle. The
*  recommended best practice is to stop conversions with
*  ADC_StopConvert(), change the resolution, then restart the
*  conversions with ADC_StartConvert().
*  If you decide not to stop conversions before calling this API, you
*  should use ADC_IsEndConversion() to wait until conversion is complete
*  before changing the resolution.
*  If you call ADC_SetResolution() during a conversion, the resolution will
*  not be changed until the current conversion is complete. Data will not be
*  available in the new resolution for another 6 + "New Resolution(in bits)"
*  clock cycles.
*  You may need add a delay of this number of clock cycles after
*  ADC_SetResolution() is called before data is valid again.
*  Affects ADC_CountsTo_Volts(), ADC_CountsTo_mVolts(), and
*  ADC_CountsTo_uVolts() by calculating the correct conversion between ADC
*  counts and the applied input voltage. Calculation depends on resolution,
*  input range, and voltage reference.
*
*******************************************************************************/
void TPS_ADC_SAR_SetResolution(uint8 resolution)
{
    uint8 tmpReg;

    /* Set SAR ADC resolution and sample width: 18 conversion cycles at 12bits + 1 gap */
    switch (resolution)
    {
        case (uint8)TPS_ADC_SAR__BITS_12:
            tmpReg = TPS_ADC_SAR_SAR_RESOLUTION_12BIT | TPS_ADC_SAR_SAR_SAMPLE_WIDTH;
            break;
        case (uint8)TPS_ADC_SAR__BITS_10:
            tmpReg = TPS_ADC_SAR_SAR_RESOLUTION_10BIT | TPS_ADC_SAR_SAR_SAMPLE_WIDTH;
            break;
        case (uint8)TPS_ADC_SAR__BITS_8:
            tmpReg = TPS_ADC_SAR_SAR_RESOLUTION_8BIT | TPS_ADC_SAR_SAR_SAMPLE_WIDTH;
            break;
        default:
            tmpReg = TPS_ADC_SAR_SAR_RESOLUTION_12BIT | TPS_ADC_SAR_SAR_SAMPLE_WIDTH;
            /* Halt CPU in debug mode if resolution is out of valid range */
            CYASSERT(0u != 0u);
            break;
    }
    TPS_ADC_SAR_SAR_CSR2_REG = tmpReg;

     /* Calculate gain for convert counts to volts */
    TPS_ADC_SAR_CalcGain(resolution);
}
开发者ID:Rensselaer-Motorsport,项目名称:E-Throttle,代码行数:63,代码来源:TPS_ADC_SAR.c


示例6: ADC_SAR_Seq_0_SetGain

/*******************************************************************************
* Function Name: ADC_SAR_Seq_0_SetGain
********************************************************************************
*
* Summary:
*  Description: Sets the ADC gain in counts per 10 volt for the voltage
*  conversion functions below. This value is set by default by the
*  reference and input range settings. It should only be used to further
*  calibrate the ADC with a known input or if an external reference is
*  used. Affects the ADC_CountsTo_uVolts, ADC_CountsTo_mVolts
*  and ADC_CountsTo_Volts functions by supplying the correct
*  conversion between ADC counts and voltage.
*
* Parameters:
*  chan: ADC channel number.
*  adcGain: ADC gain in counts per 10 volts.
*
* Return:
*  None.
*
* Global variables:
*  ADC_SAR_Seq_0_CountsPer10Volt:  modified to set the ADC gain in counts 
*   per 10 volt.
*
*******************************************************************************/
void ADC_SAR_Seq_0_SetGain(uint32 chan, int32 adcGain)
{
    /* Halt CPU in debug mode if channel is out of valid range */
    CYASSERT(chan < ADC_SAR_Seq_0_TOTAL_CHANNELS_NUM);

    ADC_SAR_Seq_0_countsPer10Volt[chan] = adcGain;
}
开发者ID:mickkn,项目名称:E3PRJ3,代码行数:32,代码来源:ADC_SAR_Seq_0.c


示例7: BLE_StackEventHandler

/*******************************************************************************
* Function Name: BLE_StackEventHandler
********************************************************************************
*
* Summary:
*   BLE stack generic event handler routine for handling connection, discovery, 
*   security etc. events.
*
* Parameters:  
*  event - event that triggered this callback
*  eventParam - parameters for the event.
*
* Return: 
*  None
*******************************************************************************/
void BLE_StackEventHandler(uint32 event, void* eventParam)
{
    CYBLE_API_RESULT_T apiResult;
    
    (void) eventParam;
    
    switch(event)
    {
        case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
            
        break;
        
        case CYBLE_EVT_STACK_ON:
            /* Put the device into discoverable mode so that remote can search it. */
            apiResult = CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
            
            if(apiResult != CYBLE_ERROR_OK)
            {
                CYASSERT(0);    
            }
        break;
            
        /* ADD YOUR CODE TO HANDLE OTHER GENERIC BLE STACK EVENTS */
            
        /* All the BLE stack events can be found in BLE_Stack.h (see CYBLE_EVENT_T enum) and  BLE_eventHandler.h (see
         * CYBLE_EVT_T enum ) */
                
        default:
        
        break;
    }
}
开发者ID:Shogun5,项目名称:BLE,代码行数:47,代码来源:BLE+Interface.c


示例8: TPS_ADC_SAR_CalcGain

/*******************************************************************************
* Function Name: TPS_ADC_SAR_CalcGain
********************************************************************************
*
* Summary:
*  This function calculates the ADC gain in counts per 10 volt.
*
* Parameters:
*  uint8: resolution
*
* Return:
*  None.
*
* Global Variables:
*  TPS_ADC_SAR_shift variable initialized. This variable is used to
*  convert the ADC counts to the 2s compliment form.
*  TPS_ADC_SAR_countsPer10Volt variable initialized. This variable is used
*  for gain calibration purpose.
*
*******************************************************************************/
static void TPS_ADC_SAR_CalcGain( uint8 resolution )
{
    int32 counts;
    #if(!((TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
         (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
         (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC)) )
        uint16 diff_zero;
    #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */

    switch (resolution)
    {
        case (uint8)TPS_ADC_SAR__BITS_12:
            counts = (int32)TPS_ADC_SAR_SAR_WRK_MAX_12BIT;
            #if(!((TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC)) )
                diff_zero = TPS_ADC_SAR_SAR_DIFF_SHIFT;
            #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */
            break;
        case (uint8)TPS_ADC_SAR__BITS_10:
            counts = (int32)TPS_ADC_SAR_SAR_WRK_MAX_10BIT;
            #if(!((TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC)) )
                diff_zero = TPS_ADC_SAR_SAR_DIFF_SHIFT >> 2u;
            #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */
            break;
        case (uint8)TPS_ADC_SAR__BITS_8:
            counts = (int32)TPS_ADC_SAR_SAR_WRK_MAX_8BIT;
            #if(!((TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC)) )
                diff_zero = TPS_ADC_SAR_SAR_DIFF_SHIFT >> 4u;
            #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */
            break;
        default: /* Halt CPU in debug mode if resolution is out of valid range */
            counts = 0;
            #if(!((TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
                 (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC)) )
                diff_zero = 0u;
            #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */
            CYASSERT(0u != 0u);
            break;
    }
    TPS_ADC_SAR_countsPerVolt = 0; /* Clear obsolete variable */
    /* Calculate gain in counts per 10 volts with rounding */
    TPS_ADC_SAR_countsPer10Volt = (((counts * TPS_ADC_SAR_10MV_COUNTS) +
                        TPS_ADC_SAR_DEFAULT_REF_VOLTAGE_MV) / (TPS_ADC_SAR_DEFAULT_REF_VOLTAGE_MV * 2));

    #if( (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSS_TO_VREF) || \
         (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDDA) || \
         (TPS_ADC_SAR_DEFAULT_RANGE == TPS_ADC_SAR__VSSA_TO_VDAC) )
        TPS_ADC_SAR_shift = 0;
    #else
        TPS_ADC_SAR_shift = diff_zero;
    #endif /* End TPS_ADC_SAR_DEFAULT_RANGE */
}
开发者ID:Rensselaer-Motorsport,项目名称:E-Throttle,代码行数:78,代码来源:TPS_ADC_SAR.c


示例9: WaveDAC8_1_BuffAmp_SetPower

/*******************************************************************************
* Function Name: WaveDAC8_1_BuffAmp_SetPower
********************************************************************************
*
* Summary:
*  Sets power level of Analog buffer.
*
* Parameters: 
*  power: PSoC3: Sets power level between low (1) and high power (3).
*         PSoC5: Sets power level High (0)
*
* Return:
*  void
*
**********************************************************************************/
void WaveDAC8_1_BuffAmp_SetPower(uint8 power) 
{
    #if (CY_PSOC3 || CY_PSOC5LP)
        WaveDAC8_1_BuffAmp_CR_REG &= (uint8)(~WaveDAC8_1_BuffAmp_PWR_MASK);
        WaveDAC8_1_BuffAmp_CR_REG |= power & WaveDAC8_1_BuffAmp_PWR_MASK;      /* Set device power */
    #else
        CYASSERT(WaveDAC8_1_BuffAmp_HIGHPOWER == power);
    #endif /* CY_PSOC3 || CY_PSOC5LP */
}
开发者ID:ponioj,项目名称:embedded,代码行数:24,代码来源:WaveDAC8_1_BuffAmp.c


示例10: Opamp_L_SetPower

/*******************************************************************************
* Function Name: Opamp_L_SetPower
********************************************************************************
*
* Summary:
*  Sets power level of Analog buffer.
*
* Parameters: 
*  power: PSoC3: Sets power level between low (1) and high power (3).
*         PSoC5: Sets power level High (0)
*
* Return:
*  void
*
**********************************************************************************/
void Opamp_L_SetPower(uint8 power) 
{
    #if (CY_PSOC3 || CY_PSOC5LP)
        Opamp_L_CR_REG &= (uint8)(~Opamp_L_PWR_MASK);
        Opamp_L_CR_REG |= power & Opamp_L_PWR_MASK;      /* Set device power */
    #else
        CYASSERT(Opamp_L_HIGHPOWER == power);
    #endif /* CY_PSOC3 || CY_PSOC5LP */
}
开发者ID:yourskp,项目名称:USB_Audio,代码行数:24,代码来源:Opamp_L.c


示例11: main

int main() {
    CYBLE_API_RESULT_T apiResult;
    uint32 count = 0;
    uint8   triggerNotification = 0;

    // Enable global interrupts
    CyGlobalIntEnable;
    
    // Initialize the watchdog timer
    CySysWdtSetIsrCallback(CY_SYS_WDT_COUNTER0, Watchdog0_cb);

    // Initialize the BLE device.
    apiResult = CyBle_Start(StackEventHandler);
    // Validate BLE stack initialization successed
    CYASSERT(apiResult == CYBLE_ERROR_OK);

    for (;;) {
        // Service all the BLE stack events.
        // Must be called at least once in a BLE connection interval
        CyBle_ProcessEvents();

        if (deviceConnected) {
            if (counterCccDescriptor.dirty) {
                // Update Counter CCCD
                updateCounterCccDescriptor();
            } else if (triggerNotification) {
                // Send notification if required
                if (enableCounterNotification) {
                    sendCounterNotification(count);
                }
                triggerNotification = 0;
            } else if (triggerUpdateCounter) {
                // Update counter value
                count++;
                updateCounter(count);
                triggerNotification = ((count & 0x0000000F) == 0);
                triggerUpdateCounter = 0;
            }
        }
        
        // Scan update queue
        if (rgbDescriptor.dirty) {
            // Update RGB Descriptor
            updateRgbDescriptor();
        }

        // Enter to deep sleep mode
        {
            CYBLE_LP_MODE_T state;

            state = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);
            if (state == CYBLE_BLESS_DEEPSLEEP) {
                CySysPmDeepSleep();
            }
        }
    }
}
开发者ID:noritan,项目名称:Design200,代码行数:57,代码来源:main.c


示例12: ADC_SAR_1_CalcGain

/*******************************************************************************
* Function Name: ADC_SAR_1_CalcGain
********************************************************************************
*
* Summary:
*  This function calculates the ADC gain in counts per volt.
*
* Parameters:
*  uint8: resolution
*
* Return:
*  None.
*
* Global Variables:
*  ADC_SAR_1_shift variable initialized. This variable is used to
*  convert the ADC counts to the 2's compliment form.
*  ADC_SAR_1_countsPerVolt variable initialized. This variable is used
*  for gain calibration purpose.
*
*******************************************************************************/
static void ADC_SAR_1_CalcGain( uint8 resolution )
{
    int32 counts;
    #if(!((ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
         (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
         (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC)) )
        uint16 diff_zero;
    #endif /* End ADC_SAR_1_DEFAULT_RANGE */

    switch (resolution)
    {
        case (uint8)ADC_SAR_1__BITS_12:
            counts = (int32)ADC_SAR_1_SAR_WRK_MAX;
            #if(!((ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC)) )
                diff_zero = ADC_SAR_1_SAR_DIFF_SHIFT;
            #endif /* End ADC_SAR_1_DEFAULT_RANGE */
            break;
        case (uint8)ADC_SAR_1__BITS_10:
            counts = (int32)(ADC_SAR_1_SAR_WRK_MAX >> 2u);
            #if(!((ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC)) )
                diff_zero = ADC_SAR_1_SAR_DIFF_SHIFT >> 2u;
            #endif /* End ADC_SAR_1_DEFAULT_RANGE */
            break;
        case (uint8)ADC_SAR_1__BITS_8:
            counts = (int32)(ADC_SAR_1_SAR_WRK_MAX >> 4u);
            #if(!((ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC)) )
                diff_zero = ADC_SAR_1_SAR_DIFF_SHIFT >> 4u;
            #endif /* End ADC_SAR_1_DEFAULT_RANGE */
            break;
        default: /* Halt CPU in debug mode if resolution is out of valid range */
            counts = 0;
            #if(!((ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
                 (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC)) )
                diff_zero = 0u;
            #endif /* End ADC_SAR_1_DEFAULT_RANGE */
            CYASSERT(0u != 0u);
            break;
    }
    counts *= 1000; /* To avoid float point arithmetic*/
    ADC_SAR_1_countsPerVolt = (int16)(counts / ADC_SAR_1_DEFAULT_REF_VOLTAGE_MV / 2);

    #if( (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSS_TO_VREF) || \
         (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDDA) || \
         (ADC_SAR_1_DEFAULT_RANGE == ADC_SAR_1__VSSA_TO_VDAC) )
        ADC_SAR_1_shift = 0;
    #else
        ADC_SAR_1_shift = diff_zero;
    #endif /* End ADC_SAR_1_DEFAULT_RANGE */
}
开发者ID:goose1987,项目名称:EE542,代码行数:76,代码来源:ADC_SAR_1.c


示例13: USBUART_1_PutData

 /*******************************************************************************
 * Function Name: USBUART_1_PutData
 ********************************************************************************
 *
 * Summary:
 *  This function sends a specified number of bytes from the location specified
 *  by a pointer to the PC. The USBUART_1_CDCIsReady() function should be
 *  called before sending new data, to be sure that the previous data has
 *  finished sending.
 *  If the last sent packet is less than maximum packet size the USB transfer
 *  of this short packet will identify the end of the segment. If the last sent
 *  packet is exactly maximum packet size, it shall be followed by a zero-length
 *  packet (which is a short packet) to assure the end of segment is properly
 *  identified. To send zero-length packet, use USBUART_1_PutData() API
 *  with length parameter set to zero.
 *
 * Parameters:
 *  pData: pointer to the buffer containing data to be sent.
 *  length: Specifies the number of bytes to send from the pData
 *  buffer. Maximum length will be limited by the maximum packet
 *  size for the endpoint. Data will be lost if length is greater than Max
 *  Packet Size.
 *
 * Return:
 *  None.
 *
 * Global variables:
 *   USBUART_1_cdc_data_in_ep: CDC IN endpoint number used for sending
 *     data.
 *
 * Reentrant:
 *  No.
 *
 *******************************************************************************/
 void USBUART_1_PutData(const uint8* pData, uint16 length) 
 {
     /* Limits length to maximum packet size for the EP */
     if(length > USBUART_1_EP[USBUART_1_cdc_data_in_ep].bufferSize)
     {
         /* Caution: Data will be lost if length is greater than Max Packet Length */
         length = USBUART_1_EP[USBUART_1_cdc_data_in_ep].bufferSize;
          /* Halt CPU in debug mode */
         CYASSERT(0u != 0u);
     }
     USBUART_1_LoadInEP(USBUART_1_cdc_data_in_ep, pData, length);
 }
开发者ID:EmbeditElectronics,项目名称:TFTSHIELD,代码行数:46,代码来源:USBUART_1_cdc.c


示例14: hallTickCounter_WriteCounter

/*******************************************************************************
* Function Name: hallTickCounter_WriteCounter
********************************************************************************
* Summary:
*   This funtion is used to set the counter to a specific value
*
* Parameters:  
*  counter:  New counter value. 
*
* Return: 
*  void 
*
*******************************************************************************/
void hallTickCounter_WriteCounter(uint8 counter) \
                                   
{
    #if(hallTickCounter_UsingFixedFunction)
        /* assert if block is already enabled */
        CYASSERT (0u == (hallTickCounter_GLOBAL_ENABLE & hallTickCounter_BLOCK_EN_MASK));
        /* If block is disabled, enable it and then write the counter */
        hallTickCounter_GLOBAL_ENABLE |= hallTickCounter_BLOCK_EN_MASK;
        CY_SET_REG16(hallTickCounter_COUNTER_LSB_PTR, (uint16)counter);
        hallTickCounter_GLOBAL_ENABLE &= ((uint8)(~hallTickCounter_BLOCK_EN_MASK));
    #else
        CY_SET_REG8(hallTickCounter_COUNTER_LSB_PTR, counter);
    #endif /* (hallTickCounter_UsingFixedFunction) */
}
开发者ID:cvb0rg,项目名称:PSoC3_TutorialSeries_PIDcontrol,代码行数:27,代码来源:hallTickCounter.c


示例15: QuadDecoder_Cnt16_WriteCounter

/*******************************************************************************
* Function Name: QuadDecoder_Cnt16_WriteCounter
********************************************************************************
* Summary:
*   This funtion is used to set the counter to a specific value
*
* Parameters:  
*  counter:  New counter value. 
*
* Return: 
*  void 
*
*******************************************************************************/
void QuadDecoder_Cnt16_WriteCounter(uint16 counter) \
                                   
{
    #if(QuadDecoder_Cnt16_UsingFixedFunction)
        /* assert if block is already enabled */
        CYASSERT (0u == (QuadDecoder_Cnt16_GLOBAL_ENABLE & QuadDecoder_Cnt16_BLOCK_EN_MASK));
        /* If block is disabled, enable it and then write the counter */
        QuadDecoder_Cnt16_GLOBAL_ENABLE |= QuadDecoder_Cnt16_BLOCK_EN_MASK;
        CY_SET_REG16(QuadDecoder_Cnt16_COUNTER_LSB_PTR, (uint16)counter);
        QuadDecoder_Cnt16_GLOBAL_ENABLE &= ((uint8)(~QuadDecoder_Cnt16_BLOCK_EN_MASK));
    #else
        CY_SET_REG16(QuadDecoder_Cnt16_COUNTER_LSB_PTR, counter);
    #endif /* (QuadDecoder_Cnt16_UsingFixedFunction) */
}
开发者ID:Qmax,项目名称:PT6,代码行数:27,代码来源:QuadDecoder_Cnt16.c


示例16: Counter_1_WriteCounter

/*******************************************************************************
* Function Name: Counter_1_WriteCounter
********************************************************************************
* Summary:
*   This funtion is used to set the counter to a specific value
*
* Parameters:  
*  counter:  New counter value. 
*
* Return: 
*  void 
*
*******************************************************************************/
void Counter_1_WriteCounter(uint16 counter) \
                                   
{
    #if(Counter_1_UsingFixedFunction)
        /* assert if block is already enabled */
        CYASSERT (0u == (Counter_1_GLOBAL_ENABLE & Counter_1_BLOCK_EN_MASK));
        /* If block is disabled, enable it and then write the counter */
        Counter_1_GLOBAL_ENABLE |= Counter_1_BLOCK_EN_MASK;
        CY_SET_REG16(Counter_1_COUNTER_LSB_PTR, (uint16)counter);
        Counter_1_GLOBAL_ENABLE &= ((uint8)(~Counter_1_BLOCK_EN_MASK));
    #else
        CY_SET_REG16(Counter_1_COUNTER_LSB_PTR, counter);
    #endif /* (Counter_1_UsingFixedFunction) */
}
开发者ID:scarlso,项目名称:LED_controller,代码行数:27,代码来源:Counter_1.c


示例17: Phase_Counter_WriteCounter

/*******************************************************************************
* Function Name: Phase_Counter_WriteCounter
********************************************************************************
* Summary:
*   This funtion is used to set the counter to a specific value
*
* Parameters:  
*  counter:  New counter value. 
*
* Return: 
*  void 
*
*******************************************************************************/
void Phase_Counter_WriteCounter(uint32 counter) \
                                   
{
    #if(Phase_Counter_UsingFixedFunction)
        /* assert if block is already enabled */
        CYASSERT (0u == (Phase_Counter_GLOBAL_ENABLE & Phase_Counter_BLOCK_EN_MASK));
        /* If block is disabled, enable it and then write the counter */
        Phase_Counter_GLOBAL_ENABLE |= Phase_Counter_BLOCK_EN_MASK;
        CY_SET_REG16(Phase_Counter_COUNTER_LSB_PTR, (uint16)counter);
        Phase_Counter_GLOBAL_ENABLE &= ((uint8)(~Phase_Counter_BLOCK_EN_MASK));
    #else
        CY_SET_REG32(Phase_Counter_COUNTER_LSB_PTR, counter);
    #endif /* (Phase_Counter_UsingFixedFunction) */
}
开发者ID:tslator,项目名称:DualBoard-043,代码行数:27,代码来源:Phase_Counter.c


示例18: BLE_AppEventHandler

/*******************************************************************************
* Function Name: BLE_AppEventHandler
********************************************************************************
*
* Summary:
*   BLE stack generic event handler routine for handling connection, discovery, 
*   security etc. events.
*
* Parameters:  
*  event - event that triggered this callback
*  eventParam - parameters for the event.
*
* Return: 
*  None
*******************************************************************************/
void BLE_AppEventHandler(uint32 event, void* eventParam)
{
    CYBLE_API_RESULT_T apiResult;
    
    (void)eventParam;

    switch (event)
	{
        /**********************************************************
        *                       General Events
        ***********************************************************/
		case CYBLE_EVT_STACK_ON: /* This event is received when component is Started */
            /* Enter in to discoverable mode so that remote can search it. */
            apiResult = CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
            
            if(apiResult != CYBLE_ERROR_OK)
            {
                CYASSERT(0);
            }
        break;
            
        case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:
            if(CyBle_GetState() == CYBLE_STATE_DISCONNECTED)
            {
                /* On advertisement timeout, restart advertisement */
                apiResult = CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
                if(apiResult != CYBLE_ERROR_OK)
                {
                    CYASSERT(0);
                }
            }
        break;
            
		default:
        break;
	}
}
开发者ID:bhwj,项目名称:BLE,代码行数:52,代码来源:main.c


示例19: CyFlash_SetWaitCycles

/*******************************************************************************
* Function Name: CyFlash_SetWaitCycles
********************************************************************************
*
* Summary:
*  Sets the number of clock cycles the cache will wait before it samples data
*  coming back from the Flash. This function must be called before increasing
*  the CPU clock frequency. It can optionally be called after lowering the CPU
*  clock frequency in order to improve the CPU performance.
*
* Parameters:
*  uint8 freq:
*   Frequency of operation in Megahertz.
*
* Return:
*  None
*
*******************************************************************************/
void CyFlash_SetWaitCycles(uint8 freq) 
{
    uint8 interruptState;

    /* Save current global interrupt enable and disable it */
    interruptState = CyEnterCriticalSection();

    /***************************************************************************
    * The number of clock cycles the cache will wait before it samples data
    * coming back from the Flash must be equal or greater to to the CPU frequency
    * outlined in clock cycles.
    ***************************************************************************/

    if (freq < CY_FLASH_CACHE_WS_1_FREQ_MAX)
    {
        CY_FLASH_CONTROL_REG = (CY_FLASH_CONTROL_REG & (uint8)(~CY_FLASH_CACHE_WS_VALUE_MASK)) |
                                    CY_FLASH_CACHE_WS_1_VALUE_MASK;
    }
    else if (freq < CY_FLASH_CACHE_WS_2_FREQ_MAX)
    {
        CY_FLASH_CONTROL_REG = (CY_FLASH_CONTROL_REG & (uint8)(~CY_FLASH_CACHE_WS_VALUE_MASK)) |
                                    CY_FLASH_CACHE_WS_2_VALUE_MASK;
    }
    else if (freq < CY_FLASH_CACHE_WS_3_FREQ_MAX)
    {
        CY_FLASH_CONTROL_REG = (CY_FLASH_CONTROL_REG & (uint8)(~CY_FLASH_CACHE_WS_VALUE_MASK)) |
                                    CY_FLASH_CACHE_WS_3_VALUE_MASK;
    }
#if (CY_PSOC5)
    else if (freq < CY_FLASH_CACHE_WS_4_FREQ_MAX)
    {
        CY_FLASH_CONTROL_REG = (CY_FLASH_CONTROL_REG & (uint8)(~CY_FLASH_CACHE_WS_VALUE_MASK)) |
                                    CY_FLASH_CACHE_WS_4_VALUE_MASK;
    }
    else if (freq <= CY_FLASH_CACHE_WS_5_FREQ_MAX)
    {
        CY_FLASH_CONTROL_REG = (CY_FLASH_CONTROL_REG & (uint8)(~CY_FLASH_CACHE_WS_VALUE_MASK)) |
                                    CY_FLASH_CACHE_WS_5_VALUE_MASK;
    }
#endif  /* (CY_PSOC5) */
    else
    {
        /* Halt CPU in debug mode if frequency is invalid */
        CYASSERT(0u != 0u);
    }

    /* Restore global interrupt enable state */
    CyExitCriticalSection(interruptState);
}
开发者ID:ElectroTiger,项目名称:ELE398,代码行数:67,代码来源:CyFlash.c


示例20: BLE_Engine_Start

/*******************************************************************************
* Function Name: BLE_Engine_Start
********************************************************************************
*
* Summary:
*  Application level API for starting the BLE interface. The API internally calls
*  other BLE interface init APIs to setup the system.
*
* Parameters:  
*  None
*
* Return: 
*  None
*
*******************************************************************************/
CYBLE_API_RESULT_T BLE_Engine_Start(void)
{
    CYBLE_API_RESULT_T apiResult;
    
    apiResult = CyBle_Start(BLE_StackEventHandler);
    
    if(apiResult != CYBLE_ERROR_OK)
    {
        CYASSERT(0);    
    }
    
    /* ADD YOUR CODE TO REGISTER OTHER BLE SERVICE SPECIFIC EVENT HANDLERS */
   
    return apiResult;
}
开发者ID:Shogun5,项目名称:BLE,代码行数:30,代码来源:BLE+Interface.c



注:本文中的CYASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CYASSL_MSG函数代码示例发布时间:2022-05-30
下一篇:
C++ CX_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap