mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c
- Revision:
- 248:0df67d8046d9
- Parent:
- 181:a4cbdfbbd2f4
- Child:
- 304:89b9c3a9a045
diff -r 135e3186a638 -r 0df67d8046d9 targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c --- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c Tue Jul 01 15:00:09 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c Wed Jul 02 09:30:07 2014 +0100 @@ -51,15 +51,15 @@ static void tim_irq_handler(void) { uint16_t cval = TIM_MST->CNT; - if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_UPDATE) == SET) { - __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_UPDATE); - __HAL_TIM_SetCounter(&TimMasterHandle, 0); // Reset counter !!! + // Clear Update interrupt flag + if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_UPDATE) == SET) { + __HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_UPDATE); SlaveCounter++; } - // Clear interrupt flag - if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) { - __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1); + // Clear CC1 interrupt flag + if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) { + __HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC1); if (oc_rem_part > 0) { set_compare(oc_rem_part); // Finish the remaining time left oc_rem_part = 0; @@ -147,5 +147,5 @@ } void us_ticker_clear_interrupt(void) { - __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1); + __HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC1); }