Example #1
0
/*******************************************************************************
* Function Name: Timer_RestoreConfig
********************************************************************************
*
* Summary:
*  Restores the current user configuration.
*
* Parameters:
*  void
*
* Return:
*  void
*
* Global variables:
*  Timer_backup:  Variables of this global structure are used to
*  restore the values of non retention registers on wakeup from sleep mode.
*
*******************************************************************************/
void Timer_RestoreConfig(void) 
{   
    #if (!Timer_UsingFixedFunction)

        Timer_WriteCounter(Timer_backup.TimerUdb);
        Timer_STATUS_MASK =Timer_backup.InterruptMaskValue;
        #if (Timer_UsingHWCaptureCounter)
            Timer_SetCaptureCount(Timer_backup.TimerCaptureCounter);
        #endif /* Restore Capture counter register*/

        #if(!Timer_UDB_CONTROL_REG_REMOVED)
            Timer_WriteControlRegister(Timer_backup.TimerControlRegister);
        #endif /* Restore the enable state of the Timer component */
    #endif /* Restore non retention registers in the UDB implementation only */
}
Example #2
0
/*******************************************************************************
* Function Name: Timer_RestoreConfig
********************************************************************************
*
* Summary:
*  Restores the current user configuration.
*
* Parameters:
*  void
*
* Return:
*  void
*
* Global variables:
*  Timer_backup:  Variables of this global structure are used to
*  restore the values of non retention registers on wakeup from sleep mode.
*
*******************************************************************************/
void Timer_RestoreConfig(void) 
{   
    #if (!Timer_UsingFixedFunction)
        /* Restore the UDB non-rentention registers for PSoC5A */
        #if (CY_PSOC5A)
            /* Interrupt State Backup for Critical Region*/
            uint8 Timer_interruptState;

            Timer_WriteCounter(Timer_backup.TimerUdb);
            Timer_WritePeriod(Timer_backup.TimerPeriod);
            /* CyEnterCriticalRegion and CyExitCriticalRegion are used to mark following region critical*/
            /* Enter Critical Region*/
            Timer_interruptState = CyEnterCriticalSection();
            /* Use the interrupt output of the status register for IRQ output */
            Timer_STATUS_AUX_CTRL |= Timer_STATUS_ACTL_INT_EN_MASK;
            /* Exit Critical Region*/
            CyExitCriticalSection(Timer_interruptState);
            Timer_STATUS_MASK =Timer_backup.InterruptMaskValue;
            #if (Timer_UsingHWCaptureCounter)
                Timer_SetCaptureCount(Timer_backup.TimerCaptureCounter);
            #endif /* Restore the UDB non-rentention register capture counter for PSoC5A */
        #endif /* Restore the UDB non-rentention registers for PSoC5A */

        #if (CY_PSOC3 || CY_PSOC5LP)
            Timer_WriteCounter(Timer_backup.TimerUdb);
            Timer_STATUS_MASK =Timer_backup.InterruptMaskValue;
            #if (Timer_UsingHWCaptureCounter)
                Timer_SetCaptureCount(Timer_backup.TimerCaptureCounter);
            #endif /* Restore Capture counter register*/
        #endif /* Restore up non retention registers, interrupt mask and capture counter for PSoC3 or PSoC5LP */

        #if(!Timer_ControlRegRemoved)
            Timer_WriteControlRegister(Timer_backup.TimerControlRegister);
        #endif /* Restore the enable state of the Timer component */
    #endif /* Restore non retention registers in the UDB implementation only */
}