Ejemplo n.º 1
0
/*******************************************************************************
* Function Name: ShiftReg_1_RestoreConfig
********************************************************************************
*
* Summary:
*  Restores Shift Register configuration.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
void ShiftReg_1_RestoreConfig(void) 
{
    /* Restore tha data, saved by SaveConfig()function */
    #if (CY_PSOC3_ES2 || CY_PSOC5_ES1)
        CY_SET_REG16(ShiftReg_1_SHIFT_REG_LSB_PTR, ShiftReg_1_backup.saveSrA0Reg);
            CY_SET_REG16(ShiftReg_1_SHIFT_REG_VALUE_LSB_PTR, ShiftReg_1_backup.saveSrA1Reg);
            ShiftReg_1_SR_STATUS_MASK = ShiftReg_1_backup.saveSrIntMask;
    #else
            CY_SET_REG16(ShiftReg_1_SHIFT_REG_LSB_PTR, ShiftReg_1_backup.saveSrA0Reg);
            CY_SET_REG16(ShiftReg_1_SHIFT_REG_VALUE_LSB_PTR, ShiftReg_1_backup.saveSrA1Reg);

    #endif /*(CY_PSOC3_ES2 || CY_PSOC5_ES1)*/
}
Ejemplo n.º 2
0
/*******************************************************************************
* Function Name: Timer_3_WriteCounter
********************************************************************************
*
* Summary:
*  This funtion is used to set the counter to a specific value
*
* Parameters:
*  counter:  New counter value.
*
* Return:
*  void
*
*******************************************************************************/
void Timer_3_WriteCounter(uint16 counter) \
                                   
{
   #if(Timer_3_UsingFixedFunction)
        /* This functionality is removed until a FixedFunction HW update to
         * allow this register to be written
         */
        CY_SET_REG16(Timer_3_COUNTER_LSB_PTR, (uint16)counter);
        
    #else
        CY_SET_REG16(Timer_3_COUNTER_LSB_PTR, counter);
    #endif /* Set Write Counter only for the UDB implementation (Write Counter not available in fixed function Timer */
}
Ejemplo n.º 3
0
/*******************************************************************************
* Function Name: PWM_Counter_WriteCounter
********************************************************************************
* Summary:
*   This funtion is used to set the counter to a specific value
*
* Parameters:  
*  counter:  New counter value. 
*
* Return: 
*  void 
*
*******************************************************************************/
void PWM_Counter_WriteCounter(uint16 counter) \
                                   
{
    #if(PWM_Counter_UsingFixedFunction)
        /* assert if block is already enabled */
        CYASSERT (!(PWM_Counter_GLOBAL_ENABLE & PWM_Counter_BLOCK_EN_MASK));
        /* If block is disabled, enable it and then write the counter */
        PWM_Counter_GLOBAL_ENABLE |= PWM_Counter_BLOCK_EN_MASK;
        CY_SET_REG16(PWM_Counter_COUNTER_LSB_PTR, (uint16)counter);
        PWM_Counter_GLOBAL_ENABLE &= ~PWM_Counter_BLOCK_EN_MASK;
    #else
        CY_SET_REG16(PWM_Counter_COUNTER_LSB_PTR, counter);
    #endif /* (PWM_Counter_UsingFixedFunction) */
}
Ejemplo n.º 4
0
/*******************************************************************************
* 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) */
}
Ejemplo n.º 5
0
/*******************************************************************************
* 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) */
}
Ejemplo n.º 6
0
/*******************************************************************************
* Function Name: HeartbeatCounter_WritePeriod
********************************************************************************
* Summary:
* Changes the period of the counter.  The new period 
* will be loaded the next time terminal count is detected.
*
* Parameters:  
*  period: (uint32) A value of 0 will result in
*         the counter remaining at zero.  
*
* Return: 
*  void
*
*******************************************************************************/
void HeartbeatCounter_WritePeriod(uint32 period) 
{
    #if(HeartbeatCounter_UsingFixedFunction)
        CY_SET_REG16(HeartbeatCounter_PERIOD_LSB_PTR,(uint16)period);
    #else
        CY_SET_REG32(HeartbeatCounter_PERIOD_LSB_PTR, period);
    #endif /* (HeartbeatCounter_UsingFixedFunction) */
}
Ejemplo n.º 7
0
    /*******************************************************************************
    * Function Name: ChargeDelay_WriteCompare
    ********************************************************************************
    *
    * Summary:
    *  This funtion is used to change the compare1 value when the PWM is in Dither
    *  mode. The compare output will reflect the new value on the next UDB clock.
    *  The compare output will be driven high when the present counter value is
    *  compared to the compare value based on the compare mode defined in
    *  Dither Mode.
    *
    * Parameters:
    *  compare:  New compare value.
    *
    * Return:
    *  None
    *
    * Side Effects:
    *  This function is only available if the PWM mode parameter is set to
    *  Dither Mode, Center Aligned Mode or One Output Mode
    *
    *******************************************************************************/
    void ChargeDelay_WriteCompare(uint8 compare) \
                                       
    {
        #if(ChargeDelay_UsingFixedFunction)
            CY_SET_REG16(ChargeDelay_COMPARE1_LSB_PTR, (uint16)compare);
        #else
            CY_SET_REG8(ChargeDelay_COMPARE1_LSB_PTR, compare);
        #endif /* (ChargeDelay_UsingFixedFunction) */

        #if (ChargeDelay_PWMMode == ChargeDelay__B_PWM__DITHER)
            #if(ChargeDelay_UsingFixedFunction)
                CY_SET_REG16(ChargeDelay_COMPARE2_LSB_PTR, (uint16)(compare + 1u));
            #else
                CY_SET_REG8(ChargeDelay_COMPARE2_LSB_PTR, (compare + 1u));
            #endif /* (ChargeDelay_UsingFixedFunction) */
        #endif /* (ChargeDelay_PWMMode == ChargeDelay__B_PWM__DITHER) */
    }
Ejemplo n.º 8
0
/*******************************************************************************
* Function Name: ChargeDelay_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period:  Period value. May be between 1 and (2^Resolution)-1.  A value of 0
*           will result in the counter remaining at zero.
*
* Return:
*  None
*
*******************************************************************************/
void ChargeDelay_WritePeriod(uint8 period) 
{
    #if(ChargeDelay_UsingFixedFunction)
        CY_SET_REG16(ChargeDelay_PERIOD_LSB_PTR, (uint16)period);
    #else
        CY_SET_REG8(ChargeDelay_PERIOD_LSB_PTR, period);
    #endif /* (ChargeDelay_UsingFixedFunction) */
}
/*******************************************************************************
* Function Name: hallTickCounter_WritePeriod
********************************************************************************
* Summary:
* Changes the period of the counter.  The new period 
* will be loaded the next time terminal count is detected.
*
* Parameters:  
*  period: (uint8) A value of 0 will result in
*         the counter remaining at zero.  
*
* Return: 
*  void
*
*******************************************************************************/
void hallTickCounter_WritePeriod(uint8 period) 
{
    #if(hallTickCounter_UsingFixedFunction)
        CY_SET_REG16(hallTickCounter_PERIOD_LSB_PTR,(uint16)period);
    #else
        CY_SET_REG8(hallTickCounter_PERIOD_LSB_PTR, period);
    #endif /* (hallTickCounter_UsingFixedFunction) */
}
Ejemplo n.º 10
0
/*******************************************************************************
* Function Name: PWM_WriteCompare2
********************************************************************************
* 
* Summary:
*  This funtion is used to change the compare value, for compare1 output.  
*  The compare output will reflect the new value on the next UDB clock.  
*  The compare output will be driven high when the present counter value is 
*  less than or less than or equal to the compare register, depending on the 
*  mode.
*
* Parameters:  
*  compare:  New compare value.  
*
* Return: 
*  void
*
* Reentrant:
*  Yes
*
*******************************************************************************/
void PWM_WriteCompare2(uint8 compare) 
{
    #if(PWM_UsingFixedFunction)
        CY_SET_REG16(PWM_COMPARE2_LSB_PTR, compare);
    #else
        CY_SET_REG8(PWM_COMPARE2_LSB_PTR, compare);
    #endif
}
Ejemplo n.º 11
0
/*******************************************************************************
* Function Name: MotorPWM_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period:  Period value. May be between 1 and (2^Resolution)-1.  A value of 0
*           will result in the counter remaining at zero.
*
* Return:
*  None
*
*******************************************************************************/
void MotorPWM_WritePeriod(uint8 period) 
{
    #if(MotorPWM_UsingFixedFunction)
        CY_SET_REG16(MotorPWM_PERIOD_LSB_PTR, (uint16)period);
    #else
        CY_SET_REG8(MotorPWM_PERIOD_LSB_PTR, period);
    #endif /* (MotorPWM_UsingFixedFunction) */
}
Ejemplo n.º 12
0
/*******************************************************************************
* Function Name: PWM_3_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period:  Period value. May be between 1 and (2^Resolution)-1.  A value of 0
*           will result in the counter remaining at zero.
*
* Return:
*  None
*
*******************************************************************************/
void PWM_3_WritePeriod(uint8 period) 
{
    #if(PWM_3_UsingFixedFunction)
        CY_SET_REG16(PWM_3_PERIOD_LSB_PTR, (uint16)period);
    #else
        CY_SET_REG8(PWM_3_PERIOD_LSB_PTR, period);
    #endif /* (PWM_3_UsingFixedFunction) */
}
Ejemplo n.º 13
0
    /*******************************************************************************
    * Function Name: CsBtns_PWM_WriteCompare
    ********************************************************************************
    *
    * Summary:
    *  This funtion is used to change the compare1 value when the PWM is in Dither
    *  mode. The compare output will reflect the new value on the next UDB clock.
    *  The compare output will be driven high when the present counter value is
    *  compared to the compare value based on the compare mode defined in
    *  Dither Mode.
    *
    * Parameters:
    *  compare:  New compare value.
    *
    * Return:
    *  None
    *
    * Side Effects:
    *  This function is only available if the PWM mode parameter is set to
    *  Dither Mode, Center Aligned Mode or One Output Mode
    *
    *******************************************************************************/
    void CsBtns_PWM_WriteCompare(uint16 compare) \
                                       
    {
        #if(CsBtns_PWM_UsingFixedFunction)
            CY_SET_REG16(CsBtns_PWM_COMPARE1_LSB_PTR, (uint16)compare);
        #else
            CY_SET_REG16(CsBtns_PWM_COMPARE1_LSB_PTR, compare);
        #endif /* (CsBtns_PWM_UsingFixedFunction) */

        #if (CsBtns_PWM_PWMMode == CsBtns_PWM__B_PWM__DITHER)
            #if(CsBtns_PWM_UsingFixedFunction)
                CY_SET_REG16(CsBtns_PWM_COMPARE2_LSB_PTR, (uint16)(compare + 1u));
            #else
                CY_SET_REG16(CsBtns_PWM_COMPARE2_LSB_PTR, (compare + 1u));
            #endif /* (CsBtns_PWM_UsingFixedFunction) */
        #endif /* (CsBtns_PWM_PWMMode == CsBtns_PWM__B_PWM__DITHER) */
    }
Ejemplo n.º 14
0
/*******************************************************************************
* Function Name: Phase_Counter_WritePeriod
********************************************************************************
* Summary:
* Changes the period of the counter.  The new period 
* will be loaded the next time terminal count is detected.
*
* Parameters:  
*  period: (uint32) A value of 0 will result in
*         the counter remaining at zero.  
*
* Return: 
*  void
*
*******************************************************************************/
void Phase_Counter_WritePeriod(uint32 period) 
{
    #if(Phase_Counter_UsingFixedFunction)
        CY_SET_REG16(Phase_Counter_PERIOD_LSB_PTR,(uint16)period);
    #else
        CY_SET_REG32(Phase_Counter_PERIOD_LSB_PTR, period);
    #endif /* (Phase_Counter_UsingFixedFunction) */
}
Ejemplo n.º 15
0
/*******************************************************************************
* Function Name: pwm_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period:  Period value. May be between 1 and (2^Resolution)-1.  A value of 0
*           will result in the counter remaining at zero.
*
* Return:
*  None
*
*******************************************************************************/
void pwm_WritePeriod(uint8 period)
{
#if(pwm_UsingFixedFunction)
    CY_SET_REG16(pwm_PERIOD_LSB_PTR, (uint16)period);
#else
    CY_SET_REG8(pwm_PERIOD_LSB_PTR, period);
#endif /* (pwm_UsingFixedFunction) */
}
Ejemplo n.º 16
0
    /*******************************************************************************
    * Function Name: PWM_3_WriteCompare
    ********************************************************************************
    *
    * Summary:
    *  This funtion is used to change the compare1 value when the PWM is in Dither
    *  mode. The compare output will reflect the new value on the next UDB clock.
    *  The compare output will be driven high when the present counter value is
    *  compared to the compare value based on the compare mode defined in
    *  Dither Mode.
    *
    * Parameters:
    *  compare:  New compare value.
    *
    * Return:
    *  None
    *
    * Side Effects:
    *  This function is only available if the PWM mode parameter is set to
    *  Dither Mode, Center Aligned Mode or One Output Mode
    *
    *******************************************************************************/
    void PWM_3_WriteCompare(uint8 compare) \
                                       
    {
        #if(PWM_3_UsingFixedFunction)
            CY_SET_REG16(PWM_3_COMPARE1_LSB_PTR, (uint16)compare);
        #else
            CY_SET_REG8(PWM_3_COMPARE1_LSB_PTR, compare);
        #endif /* (PWM_3_UsingFixedFunction) */

        #if (PWM_3_PWMMode == PWM_3__B_PWM__DITHER)
            #if(PWM_3_UsingFixedFunction)
                CY_SET_REG16(PWM_3_COMPARE2_LSB_PTR, (uint16)(compare + 1u));
            #else
                CY_SET_REG8(PWM_3_COMPARE2_LSB_PTR, (compare + 1u));
            #endif /* (PWM_3_UsingFixedFunction) */
        #endif /* (PWM_3_PWMMode == PWM_3__B_PWM__DITHER) */
    }
/*******************************************************************************
* Function Name: Counter_reset_gen_WritePeriod
********************************************************************************
* Summary:
* Changes the period of the counter.  The new period 
* will be loaded the next time terminal count is detected.
*
* Parameters:  
*  period: (uint8) A value of 0 will result in
*         the counter remaining at zero.  
*
* Return: 
*  void
*
*******************************************************************************/
void Counter_reset_gen_WritePeriod(uint8 period) 
{
    #if(Counter_reset_gen_UsingFixedFunction)
        CY_SET_REG16(Counter_reset_gen_PERIOD_LSB_PTR,(uint16)period);
    #else
        CY_SET_REG8(Counter_reset_gen_PERIOD_LSB_PTR, period);
    #endif /* (Counter_reset_gen_UsingFixedFunction) */
}
Ejemplo n.º 18
0
/*******************************************************************************
* Function Name: QuadDecoder_Cnt8_WritePeriod
********************************************************************************
* Summary:
* Changes the period of the counter.  The new period 
* will be loaded the next time terminal count is detected.
*
* Parameters:  
*  period: (uint8) A value of 0 will result in
*         the counter remaining at zero.  
*
* Return: 
*  void
*
*******************************************************************************/
void QuadDecoder_Cnt8_WritePeriod(uint8 period) 
{
    #if(QuadDecoder_Cnt8_UsingFixedFunction)
        CY_SET_REG16(QuadDecoder_Cnt8_PERIOD_LSB_PTR,(uint16)period);
    #else
        CY_SET_REG8(QuadDecoder_Cnt8_PERIOD_LSB_PTR, period);
    #endif /* (QuadDecoder_Cnt8_UsingFixedFunction) */
}
Ejemplo n.º 19
0
/*******************************************************************************
* Function Name: PWM_WriteCounter
********************************************************************************
* 
* Summary:
*  This function is used to change the counter value.
*
* Parameters:  
*  counter:  This value may be between 1 and (2^Resolution)-1.   
*
* Return: 
*  void
*
* Reentrant:
*  Yes
*
*******************************************************************************/
void PWM_WriteCounter(uint8 counter) 
{
    #if(PWM_UsingFixedFunction)
        CY_SET_REG16(PWM_COUNTER_LSB_PTR, (uint16)counter);
    #else
        CY_SET_REG8(PWM_COUNTER_LSB_PTR, counter);
    #endif
}
Ejemplo n.º 20
0
/*******************************************************************************
* Function Name: Phase_Counter_WriteCompare
********************************************************************************
* Summary:
* Changes the compare value.  The compare output will 
* reflect the new value on the next UDB clock.  The compare output will be 
* driven high when the present counter value compares true based on the 
* configured compare mode setting. 
*
* Parameters:  
*  Compare:  New compare value. 
*
* Return: 
*  void
*
*******************************************************************************/
void Phase_Counter_WriteCompare(uint32 compare) \
                                   
{
    #if(Phase_Counter_UsingFixedFunction)
        CY_SET_REG16(Phase_Counter_COMPARE_LSB_PTR, (uint16)compare);
    #else
        CY_SET_REG32(Phase_Counter_COMPARE_LSB_PTR, compare);
    #endif /* (Phase_Counter_UsingFixedFunction) */
}
Ejemplo n.º 21
0
/*******************************************************************************
* Function Name: TIMER_ThreadTimer_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period: This value may be between 1 and (2^Resolution)-1.  A value of 0 will
*          result in the counter remaining at zero.
*
* Return:
*  void
*
*******************************************************************************/
void TIMER_ThreadTimer_WritePeriod(uint8 period) 
{
    #if(TIMER_ThreadTimer_UsingFixedFunction)
        uint16 period_temp = (uint16)period;
        CY_SET_REG16(TIMER_ThreadTimer_PERIOD_LSB_PTR, period_temp);
    #else
        CY_SET_REG8(TIMER_ThreadTimer_PERIOD_LSB_PTR, period);
    #endif /*Write Period value with appropriate resolution suffix depending on UDB or fixed function implementation */
}
Ejemplo n.º 22
0
/*******************************************************************************
* Function Name: AppDelay_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period: This value may be between 1 and (2^Resolution)-1.  A value of 0 will
*          result in the counter remaining at zero.
*
* Return:
*  void
*
*******************************************************************************/
void AppDelay_WritePeriod(uint32 period) 
{
    #if(AppDelay_UsingFixedFunction)
        uint16 period_temp = (uint16)period;
        CY_SET_REG16(AppDelay_PERIOD_LSB_PTR, period_temp);
    #else
        CY_SET_REG24(AppDelay_PERIOD_LSB_PTR, period);
    #endif /*Write Period value with appropriate resolution suffix depending on UDB or fixed function implementation */
}
Ejemplo n.º 23
0
/*******************************************************************************
* Function Name: pwm_WriteCompare2
********************************************************************************
*
* Summary:
*  This funtion is used to change the compare value, for compare1 output.
*  The compare output will reflect the new value on the next UDB clock.
*  The compare output will be driven high when the present counter value is
*  less than or less than or equal to the compare register, depending on the
*  mode.
*
* Parameters:
*  compare:  New compare value.
*
* Return:
*  None
*
*******************************************************************************/
void pwm_WriteCompare2(uint8 compare) \

{
#if(pwm_UsingFixedFunction)
    CY_SET_REG16(pwm_COMPARE2_LSB_PTR, compare);
#else
    CY_SET_REG8(pwm_COMPARE2_LSB_PTR, compare);
#endif /* (pwm_UsingFixedFunction) */
}
Ejemplo n.º 24
0
/*******************************************************************************
* Function Name: HeartbeatCounter_WriteCompare
********************************************************************************
* Summary:
* Changes the compare value.  The compare output will 
* reflect the new value on the next UDB clock.  The compare output will be 
* driven high when the present counter value compares true based on the 
* configured compare mode setting. 
*
* Parameters:  
*  Compare:  New compare value. 
*
* Return: 
*  void
*
*******************************************************************************/
void HeartbeatCounter_WriteCompare(uint32 compare) \
                                   
{
    #if(HeartbeatCounter_UsingFixedFunction)
        CY_SET_REG16(HeartbeatCounter_COMPARE_LSB_PTR, (uint16)compare);
    #else
        CY_SET_REG32(HeartbeatCounter_COMPARE_LSB_PTR, compare);
    #endif /* (HeartbeatCounter_UsingFixedFunction) */
}
Ejemplo n.º 25
0
/*******************************************************************************
* Function Name: OSC2_Freq_Timer_1_WritePeriod
********************************************************************************
*
* Summary:
*  This function is used to change the period of the counter.  The new period
*  will be loaded the next time terminal count is detected.
*
* Parameters:
*  period: This value may be between 1 and (2^Resolution)-1.  A value of 0 will
*          result in the counter remaining at zero.
*
* Return:
*  void
*
*******************************************************************************/
void OSC2_Freq_Timer_1_WritePeriod(uint32 period) 
{
    #if(OSC2_Freq_Timer_1_UsingFixedFunction)
        uint16 period_temp = (uint16)period;
        CY_SET_REG16(OSC2_Freq_Timer_1_PERIOD_LSB_PTR, period_temp);
    #else
        CY_SET_REG32(OSC2_Freq_Timer_1_PERIOD_LSB_PTR, period);
    #endif /*Write Period value with appropriate resolution suffix depending on UDB or fixed function implementation */
}
Ejemplo n.º 26
0
 /*******************************************************************************
 * Function Name: PWM_MOTOR2_WriteCompare2
 ********************************************************************************
 *
 * Summary:
 *  This funtion is used to change the compare value, for compare1 output.
 *  The compare output will reflect the new value on the next UDB clock.
 *  The compare output will be driven high when the present counter value is
 *  less than or less than or equal to the compare register, depending on the
 *  mode.
 *
 * Parameters:
 *  compare:  New compare value.
 *
 * Return:
 *  None
 *
 *******************************************************************************/
 void PWM_MOTOR2_WriteCompare2(uint8 compare) \
                                     
 {
     #if(PWM_MOTOR2_UsingFixedFunction)
         CY_SET_REG16(PWM_MOTOR2_COMPARE2_LSB_PTR, compare);
     #else
         CY_SET_REG8(PWM_MOTOR2_COMPARE2_LSB_PTR, compare);
     #endif /* (PWM_MOTOR2_UsingFixedFunction) */
 }
/*******************************************************************************
* Function Name: Counter_reset_gen_WriteCompare
********************************************************************************
* Summary:
* Changes the compare value.  The compare output will 
* reflect the new value on the next UDB clock.  The compare output will be 
* driven high when the present counter value compares true based on the 
* configured compare mode setting. 
*
* Parameters:  
*  Compare:  New compare value. 
*
* Return: 
*  void
*
*******************************************************************************/
void Counter_reset_gen_WriteCompare(uint8 compare) \
                                   
{
    #if(Counter_reset_gen_UsingFixedFunction)
        CY_SET_REG16(Counter_reset_gen_COMPARE_LSB_PTR, (uint16)compare);
    #else
        CY_SET_REG8(Counter_reset_gen_COMPARE_LSB_PTR, compare);
    #endif /* (Counter_reset_gen_UsingFixedFunction) */
}
Ejemplo n.º 28
0
/*******************************************************************************
* Function Name: CyDmaTdSetAddress
********************************************************************************
*
* Summary:
*  Sets the lower 16 bits of the source and destination addresses for this TD
*  only.
*
* Parameters:
*  uint8 tdHandle:
*   A handle previously returned by CyDmaTdAlloc().
*
*  uint16 source:
*   The lower 16 address bits of the source of the data transfer.
*
*  uint16 destination:
*   The lower 16 address bits of the destination of the data transfer.
*
* Return:
*  CYRET_SUCCESS if successful.
*  CYRET_BAD_PARAM if tdHandle is invalid.
*
*******************************************************************************/
cystatus CyDmaTdSetAddress(uint8 tdHandle, uint16 source, uint16 destination) 
{
    cystatus status = CYRET_BAD_PARAM;

    if(tdHandle < CY_DMA_NUMBEROF_TDS)
    {
        /* Set source address */
        reg16 *convert = (reg16 *) &CY_DMA_TDMEM_STRUCT_PTR[tdHandle].TD1[0];
        CY_SET_REG16(convert, source);

        /* Set destination address */
        CY_SET_REG16((reg16 *) &CY_DMA_TDMEM_STRUCT_PTR[tdHandle].TD1[2], destination);

        status = CYRET_SUCCESS;
    }

    return(status);
}
Ejemplo n.º 29
0
 /*******************************************************************************
 * Function Name: PWM_3_WriteCompare1
 ********************************************************************************
 *
 * Summary:
 *  This funtion is used to change the compare1 value.  The compare output will
 *  reflect the new value on the next UDB clock.  The compare output will be
 *  driven high when the present counter value is less than or less than or
 *  equal to the compare register, depending on the mode.
 *
 * Parameters:
 *  compare:  New compare value.
 *
 * Return:
 *  None
 *
 *******************************************************************************/
 void PWM_3_WriteCompare1(uint8 compare) \
                                     
 {
     #if(PWM_3_UsingFixedFunction)
         CY_SET_REG16(PWM_3_COMPARE1_LSB_PTR, (uint16)compare);
     #else
         CY_SET_REG8(PWM_3_COMPARE1_LSB_PTR, compare);
     #endif /* (PWM_3_UsingFixedFunction) */
 }
/*******************************************************************************
* Function Name: hallTickCounter_WriteCompare
********************************************************************************
* Summary:
* Changes the compare value.  The compare output will 
* reflect the new value on the next UDB clock.  The compare output will be 
* driven high when the present counter value compares true based on the 
* configured compare mode setting. 
*
* Parameters:  
*  Compare:  New compare value. 
*
* Return: 
*  void
*
*******************************************************************************/
void hallTickCounter_WriteCompare(uint8 compare) \
                                   
{
    #if(hallTickCounter_UsingFixedFunction)
        CY_SET_REG16(hallTickCounter_COMPARE_LSB_PTR, (uint16)compare);
    #else
        CY_SET_REG8(hallTickCounter_COMPARE_LSB_PTR, compare);
    #endif /* (hallTickCounter_UsingFixedFunction) */
}