aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2018-06-15 10:50:08 +1000
committerDamien George2018-06-15 10:50:08 +1000
commit37a7257affa5e1ad449d911797dfc4b9e46677b3 (patch)
treec44950a902c299b2df80fc89292c974f8af061b1
parentb78ca32476ba666412a9ec44a5453094fbf0dbd7 (diff)
stm32/timer: Support TIM1 on F0 MCUs.
-rw-r--r--ports/stm32/stm32_it.c6
-rw-r--r--ports/stm32/timer.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c
index c09ffce76..a2a8d0f2e 100644
--- a/ports/stm32/stm32_it.c
+++ b/ports/stm32/stm32_it.c
@@ -610,6 +610,12 @@ void EXTI4_15_IRQHandler(void) {
IRQ_EXIT(EXTI4_15_IRQn);
}
+void TIM1_BRK_UP_TRG_COM_IRQHandler(void) {
+ IRQ_ENTER(TIM1_BRK_UP_TRG_COM_IRQn);
+ timer_irq_handler(1);
+ IRQ_EXIT(TIM1_BRK_UP_TRG_COM_IRQn);
+}
+
#endif
void TIM1_BRK_TIM9_IRQHandler(void) {
diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c
index cc00f7a88..cf198e865 100644
--- a/ports/stm32/timer.c
+++ b/ports/stm32/timer.c
@@ -655,11 +655,13 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, cons
return mp_const_none;
}
-// This table encodes the timer instance and irq number.
+// This table encodes the timer instance and irq number (for the update irq).
// It assumes that timer instance pointer has the lower 8 bits cleared.
#define TIM_ENTRY(id, irq) [id - 1] = (uint32_t)TIM##id | irq
STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = {
- #if defined(STM32F4) || defined(STM32F7)
+ #if defined(STM32F0)
+ TIM_ENTRY(1, TIM1_BRK_UP_TRG_COM_IRQn),
+ #elif defined(STM32F4) || defined(STM32F7)
TIM_ENTRY(1, TIM1_UP_TIM10_IRQn),
#elif defined(STM32L4)
TIM_ENTRY(1, TIM1_UP_TIM16_IRQn),