/******************************************************************************* * Function Name: Timer_1_RestoreConfig ******************************************************************************** * * Summary: * Restores the current user configuration. * * Parameters: * void * * Return: * void * * Global variables: * Timer_1_backup: Variables of this global structure are used to * restore the values of non retention registers on wakeup from sleep mode. * *******************************************************************************/ void Timer_1_RestoreConfig(void) { #if (!Timer_1_UsingFixedFunction) Timer_1_WriteCounter(Timer_1_backup.TimerUdb); Timer_1_STATUS_MASK =Timer_1_backup.InterruptMaskValue; #if (Timer_1_UsingHWCaptureCounter) Timer_1_SetCaptureCount(Timer_1_backup.TimerCaptureCounter); #endif /* Restore Capture counter register*/ #if(!Timer_1_UDB_CONTROL_REG_REMOVED) Timer_1_WriteControlRegister(Timer_1_backup.TimerControlRegister); #endif /* Restore the enable state of the Timer component */ #endif /* Restore non retention registers in the UDB implementation only */ }
/******************************************************************************* * Function Name: Timer_1_RestoreConfig ******************************************************************************** * * Summary: * Restores the current user configuration. * * Parameters: * void * * Return: * void * * Global variables: * Timer_1_backup: Variables of this global structure are used to * restore the values of non retention registers on wakeup from sleep mode. * *******************************************************************************/ void Timer_1_RestoreConfig(void) { #if (!Timer_1_UsingFixedFunction) /* Restore the UDB non-rentention registers for CY_UDB_V0 */ #if (CY_UDB_V0) /* Interrupt State Backup for Critical Region*/ uint8 Timer_1_interruptState; Timer_1_WriteCounter(Timer_1_backup.TimerUdb); Timer_1_WritePeriod(Timer_1_backup.TimerPeriod); /* CyEnterCriticalRegion and CyExitCriticalRegion are used to mark following region critical*/ /* Enter Critical Region*/ Timer_1_interruptState = CyEnterCriticalSection(); /* Use the interrupt output of the status register for IRQ output */ Timer_1_STATUS_AUX_CTRL |= Timer_1_STATUS_ACTL_INT_EN_MASK; /* Exit Critical Region*/ CyExitCriticalSection(Timer_1_interruptState); Timer_1_STATUS_MASK =Timer_1_backup.InterruptMaskValue; #if (Timer_1_UsingHWCaptureCounter) Timer_1_SetCaptureCount(Timer_1_backup.TimerCaptureCounter); #endif /* Restore the UDB non-rentention register capture counter for CY_UDB_V0 */ #endif /* Restore the UDB non-rentention registers for CY_UDB_V0 */ #if (CY_UDB_V1) Timer_1_WriteCounter(Timer_1_backup.TimerUdb); Timer_1_STATUS_MASK =Timer_1_backup.InterruptMaskValue; #if (Timer_1_UsingHWCaptureCounter) Timer_1_SetCaptureCount(Timer_1_backup.TimerCaptureCounter); #endif /* Restore Capture counter register*/ #endif /* Restore up non retention registers, interrupt mask and capture counter for CY_UDB_V1 */ #if(!Timer_1_ControlRegRemoved) Timer_1_WriteControlRegister(Timer_1_backup.TimerControlRegister); #endif /* Restore the enable state of the Timer component */ #endif /* Restore non retention registers in the UDB implementation only */ }