Example #1
0
/*******************************************************************************
* Function Name: Timer_SaveConfig
********************************************************************************
*
* Summary:
*     Save the current user configuration
*
* Parameters:
*  void
*
* Return:
*  void
*
* Global variables:
*  Timer_backup:  Variables of this global structure are modified to
*  store the values of non retention configuration registers when Sleep() API is
*  called.
*
*******************************************************************************/
void Timer_SaveConfig(void) 
{
    #if (!Timer_UsingFixedFunction)
        /* Backup the UDB non-rentention registers for PSoC5A*/
        #if (CY_PSOC5A)
            Timer_backup.TimerUdb = Timer_ReadCounter();
            Timer_backup.TimerPeriod = Timer_ReadPeriod();
            Timer_backup.InterruptMaskValue = Timer_STATUS_MASK;
            #if (Timer_UsingHWCaptureCounter)
                Timer_backup.TimerCaptureCounter = Timer_ReadCaptureCount();
            #endif /* Backup the UDB non-rentention register capture counter for PSoC5A */
        #endif /* Backup the UDB non-rentention registers for PSoC5A */

        #if (CY_PSOC3 || CY_PSOC5LP)
            Timer_backup.TimerUdb = Timer_ReadCounter();
            Timer_backup.InterruptMaskValue = Timer_STATUS_MASK;
            #if (Timer_UsingHWCaptureCounter)
                Timer_backup.TimerCaptureCounter = Timer_ReadCaptureCount();
            #endif /* Back Up capture counter register  */
        #endif /* Backup non retention registers, interrupt mask and capture counter for PSoC3 or PSoC5LP */

        #if(!Timer_ControlRegRemoved)
            Timer_backup.TimerControlRegister = Timer_ReadControlRegister();
        #endif /* Backup the enable state of the Timer component */
    #endif /* Backup non retention registers in UDB implementation. All fixed function registers are retention */
}
Example #2
0
/*******************************************************************************
* Function Name: Timer_SaveConfig
********************************************************************************
*
* Summary:
*     Save the current user configuration
*
* Parameters:
*  void
*
* Return:
*  void
*
* Global variables:
*  Timer_backup:  Variables of this global structure are modified to
*  store the values of non retention configuration registers when Sleep() API is
*  called.
*
*******************************************************************************/
void Timer_SaveConfig(void) 
{
    #if (!Timer_UsingFixedFunction)
        Timer_backup.TimerUdb = Timer_ReadCounter();
        Timer_backup.InterruptMaskValue = Timer_STATUS_MASK;
        #if (Timer_UsingHWCaptureCounter)
            Timer_backup.TimerCaptureCounter = Timer_ReadCaptureCount();
        #endif /* Back Up capture counter register  */

        #if(!Timer_UDB_CONTROL_REG_REMOVED)
            Timer_backup.TimerControlRegister = Timer_ReadControlRegister();
        #endif /* Backup the enable state of the Timer component */
    #endif /* Backup non retention registers in UDB implementation. All fixed function registers are retention */
}