/************************************************************************************************** * @fn SysCtrlWakeupSetting * * @brief Setup which peripherals can/cannot wakeup the processor * * input parameters * * @param None. * * output parameters * * None. * * @return None. ************************************************************************************************** */ void SysCtrlWakeupSetting(void) { /* GPIO A, C and SM Timer can wake up the processor */ /* CS */ GPIOIntWakeupDisable(GPIO_IWE_PORT_A); /* MRDY */ GPIOIntWakeupEnable(GPIO_IWE_PORT_B); /* Sleep Timer */ GPIOIntWakeupEnable(GPIO_IWE_SM_TIMER); /* USB */ GPIOIntWakeupEnable(GPIO_IWE_USB); /* Setup MRDY as falling edge */ GPIOPowIntTypeSet(GPIO_B_BASE, GPIO_PIN_2, GPIO_POW_FALLING_EDGE); }
/************************************************************************************************** * @fn SysCtrlWakeupSetting * * @brief Setup which peripherals can/cannot wakeup the processor * * input parameters * * @param None. * * output parameters * * None. * * @return None. ************************************************************************************************** */ void SysCtrlWakeupSetting(void) { /* GPIO A, C and SM Timer can wake up the processor */ GPIOIntWakeupEnable(GPIO_IWE_PORT_A); GPIOIntWakeupDisable(GPIO_IWE_PORT_B); GPIOIntWakeupEnable(GPIO_IWE_PORT_C); GPIOIntWakeupDisable(GPIO_IWE_PORT_D); GPIOIntWakeupDisable(GPIO_IWE_USB); GPIOIntWakeupEnable(GPIO_IWE_SM_TIMER); /* Setup GPIO A, C as a falling edge */ GPIOPowIntTypeSet(BSP_KEY_DIR_BASE, BSP_KEY_LEFT | BSP_KEY_RIGHT | BSP_KEY_UP | BSP_KEY_DOWN, GPIO_POW_FALLING_EDGE); GPIOPowIntTypeSet(BSP_KEY_SEL_BASE, BSP_KEY_SELECT, GPIO_POW_FALLING_EDGE); }
void SysCtrlWakeupSetting(void) { /* SM Timer can wake up the processor */ GPIOIntWakeupEnable(GPIO_IWE_SM_TIMER); }
//***************************************************************************** // // Configure sleep timer, put system into deep sleep and watch sleep timer // interrupt wakeup system again // //***************************************************************************** int main(void) { uint32_t ui32Val; // // Set the clocking to run directly from the external crystal/oscillator. // (no ext 32k osc, no internal osc) // SysCtrlClockSet(false, false, SYS_CTRL_SYSDIV_32MHZ); // // Set IO clock to the same as system clock // SysCtrlIOClockSet(SYS_CTRL_SYSDIV_32MHZ); // // Set up the serial console to use for displaying messages. This is // just for this example program and is not needed for SSI operation. // InitConsole(); // // Display the setup on the console. // UARTprintf("Sleepmode timer\n"); // // Disable UART0 when in deep sleep // SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_UART0); // // Let system enter powermode 2 when going to deep sleep // SysCtrlPowerModeSet(SYS_CTRL_PM_2); // // Enable the Sleep Timer wakeup // GPIOIntWakeupEnable(GPIO_IWE_SM_TIMER); // // Enable sleep mode interrupt // IntEnable(INT_SMTIM); // // Set timer to 10000 above current value // ui32Val = SleepModeTimerCountGet(); SleepModeTimerCompareSet(ui32Val + 10000); // // Display the timer value on the console. // UARTprintf("Timer val = %d\n", ui32Val); // // Wait for UART to be flushed // while(UARTBusy(UART0_BASE)) { } // // Go to sleep // SysCtrlDeepSleep(); // // Display the timer value on the console. // ui32Val = SleepModeTimerCountGet(); UARTprintf("Timer val = %d (after wakeup)\n", ui32Val); // // Done - enter an infinite loop. // while(1) { } }