summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-07-13 11:52:30 -0400
committerLucian Copeland <hierophect@gmail.com>2020-07-13 11:52:30 -0400
commitb8910676db54ab260b55b756bf3ea3fcd599c995 (patch)
tree89d059c85fedfeb350cfd3d8781cf70f442c1800
parentb1ac6b4444eca556632839fb1c5d298f2936f8e5 (diff)
Add missing enum preprocessor protection
-rw-r--r--ports/stm/peripherals/timers.c71
1 files changed, 69 insertions, 2 deletions
diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c
index 924d3a16f..1bcee3645 100644
--- a/ports/stm/peripherals/timers.c
+++ b/ports/stm/peripherals/timers.c
@@ -35,30 +35,97 @@
#include "shared-bindings/microcontroller/Pin.h"
#define ALL_CLOCKS 0xFFFF
+#define NULL_IRQ 0xFF
static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)];
static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)];
static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void);
static size_t irq_map[] = {
+ #ifdef TIM1
TIM1_CC_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM2
TIM2_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM3
TIM3_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM4
TIM4_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM5
TIM5_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM6
TIM6_DAC_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM7
TIM7_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM8
TIM8_CC_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM9
TIM1_BRK_TIM9_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM10
TIM1_UP_TIM10_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM11
TIM1_TRG_COM_TIM11_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM12
TIM8_BRK_TIM12_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM13
TIM8_UP_TIM13_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM14
TIM8_TRG_COM_TIM14_IRQn,
-#if (CPY_STM32H7)
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM15
TIM15_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM16
TIM16_IRQn,
+ #else
+ NULL_IRQ,
+ #endif
+ #ifdef TIM17
TIM17_IRQn,
-#endif
+ #else
+ NULL_IRQ,
+ #endif
};
// Get the frequency (in Hz) of the source clock for the given timer.