summaryrefslogtreecommitdiff
path: root/stmhal/stm32_it.c
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2016-08-18 20:47:49 -0700
committerDamien George <damien.p.george@gmail.com>2016-08-22 12:18:04 +1000
commitc6983e3ce0bb9708afabb9fb7cbdf54ba46fb594 (patch)
treec0a99f6423316b70ce266d37a58ed99a28beb7f9 /stmhal/stm32_it.c
parentf2a21a2489325df88acf14a20a286932ed32d500 (diff)
stmhal: Fix timer capture/compare interrupt handling for TIM1 and TIM8.
It turns out that TIM1 and TIM8 have their own Capture/Compare interrupt vector. For all of the other timers, the capture/compare interrupt vector is the same as the update vector. So we need to add handlers for these vectors and enable them when using capture/compare callbacks. During testing of this, I also found that passing a channel callback into the channel constructor would not enable interrupts properly. I tested using: ``` >>> pyb.Timer(1, freq=4).channel(1, pyb.Timer.OC_TOGGLE, callback=lambda t: print('.', end='')) ``` I tested the above with channels 1, 4, and 8
Diffstat (limited to 'stmhal/stm32_it.c')
-rw-r--r--stmhal/stm32_it.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c
index c9af20ce5..d2f8c271c 100644
--- a/stmhal/stm32_it.c
+++ b/stmhal/stm32_it.c
@@ -556,6 +556,12 @@ void TIM1_TRG_COM_TIM17_IRQHandler(void) {
}
#endif
+void TIM1_CC_IRQHandler(void) {
+ IRQ_ENTER(TIM1_CC_IRQn);
+ timer_irq_handler(1);
+ IRQ_EXIT(TIM1_CC_IRQn);
+}
+
void TIM2_IRQHandler(void) {
IRQ_ENTER(TIM2_IRQn);
timer_irq_handler(2);
@@ -581,18 +587,23 @@ void TIM5_IRQHandler(void) {
IRQ_EXIT(TIM5_IRQn);
}
+#if defined(TIM6) // STM32F401 doesn't have TIM6
void TIM6_DAC_IRQHandler(void) {
IRQ_ENTER(TIM6_DAC_IRQn);
timer_irq_handler(6);
IRQ_EXIT(TIM6_DAC_IRQn);
}
+#endif
+#if defined(TIM7) // STM32F401 doesn't have TIM7
void TIM7_IRQHandler(void) {
IRQ_ENTER(TIM7_IRQn);
timer_irq_handler(7);
IRQ_EXIT(TIM7_IRQn);
}
+#endif
+#if defined(TIM8) // STM32F401 doesn't have TIM8
void TIM8_BRK_TIM12_IRQHandler(void) {
IRQ_ENTER(TIM8_BRK_TIM12_IRQn);
timer_irq_handler(12);
@@ -614,11 +625,18 @@ void TIM8_UP_IRQHandler(void) {
}
#endif
+void TIM8_CC_IRQHandler(void) {
+ IRQ_ENTER(TIM8_CC_IRQn);
+ timer_irq_handler(8);
+ IRQ_EXIT(TIM8_CC_IRQn);
+}
+
void TIM8_TRG_COM_TIM14_IRQHandler(void) {
IRQ_ENTER(TIM8_TRG_COM_TIM14_IRQn);
timer_irq_handler(14);
IRQ_EXIT(TIM8_TRG_COM_TIM14_IRQn);
}
+#endif
// UART/USART IRQ handlers
void USART1_IRQHandler(void) {