mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/sleep.c
- Revision:
- 84:f54042cbc282
- Parent:
- 77:b5886236e6f0
- Child:
- 166:cb4253f91ada
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/sleep.c Fri Jan 31 10:15:06 2014 +0000 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/sleep.c Mon Feb 03 09:30:05 2014 +0000 @@ -32,15 +32,23 @@ void sleep(void) { + // Disable us_ticker update interrupt + TIM_ITConfig(TIM1, TIM_IT_Update, DISABLE); + SCB->SCR = 0; // Normal sleep mode for ARM core __WFI(); + + // Re-enable us_ticker update interrupt + TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE); } +// MCU STOP mode +// Wake-up with external interrupt void deepsleep(void) -{ +{ // Enable PWR clock RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); // Request to enter STOP mode with regulator in low power mode - PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); + PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); }