[NUCLEO_F401RE] Fix issue with sleep and ST HAL tick timer

The timer used for the ST HAL tick must be disabled before entering in
sleep mode.
pull/374/head
bcostm 2014-06-25 10:22:44 +02:00
parent e2e0999886
commit c39de07958
1 changed files with 8 additions and 0 deletions

View File

@ -36,8 +36,16 @@
static TIM_HandleTypeDef TimMasterHandle; static TIM_HandleTypeDef TimMasterHandle;
void sleep(void) { void sleep(void) {
TimMasterHandle.Instance = TIM5;
// Disable HAL tick interrupt
__HAL_TIM_DISABLE_IT(&TimMasterHandle, TIM_IT_CC2);
// Request to enter SLEEP mode // Request to enter SLEEP mode
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI); HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
// Enable HAL tick interrupt
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2);
} }
void deepsleep(void) { void deepsleep(void) {