Skip to content

Commit b891067

Browse files
committed
Add missing enum preprocessor protection
1 parent b1ac6b4 commit b891067

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

ports/stm/peripherals/timers.c

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,97 @@
3535
#include "shared-bindings/microcontroller/Pin.h"
3636

3737
#define ALL_CLOCKS 0xFFFF
38+
#define NULL_IRQ 0xFF
3839

3940
static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)];
4041
static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)];
4142
static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void);
4243
static size_t irq_map[] = {
44+
#ifdef TIM1
4345
TIM1_CC_IRQn,
46+
#else
47+
NULL_IRQ,
48+
#endif
49+
#ifdef TIM2
4450
TIM2_IRQn,
51+
#else
52+
NULL_IRQ,
53+
#endif
54+
#ifdef TIM3
4555
TIM3_IRQn,
56+
#else
57+
NULL_IRQ,
58+
#endif
59+
#ifdef TIM4
4660
TIM4_IRQn,
61+
#else
62+
NULL_IRQ,
63+
#endif
64+
#ifdef TIM5
4765
TIM5_IRQn,
66+
#else
67+
NULL_IRQ,
68+
#endif
69+
#ifdef TIM6
4870
TIM6_DAC_IRQn,
71+
#else
72+
NULL_IRQ,
73+
#endif
74+
#ifdef TIM7
4975
TIM7_IRQn,
76+
#else
77+
NULL_IRQ,
78+
#endif
79+
#ifdef TIM8
5080
TIM8_CC_IRQn,
81+
#else
82+
NULL_IRQ,
83+
#endif
84+
#ifdef TIM9
5185
TIM1_BRK_TIM9_IRQn,
86+
#else
87+
NULL_IRQ,
88+
#endif
89+
#ifdef TIM10
5290
TIM1_UP_TIM10_IRQn,
91+
#else
92+
NULL_IRQ,
93+
#endif
94+
#ifdef TIM11
5395
TIM1_TRG_COM_TIM11_IRQn,
96+
#else
97+
NULL_IRQ,
98+
#endif
99+
#ifdef TIM12
54100
TIM8_BRK_TIM12_IRQn,
101+
#else
102+
NULL_IRQ,
103+
#endif
104+
#ifdef TIM13
55105
TIM8_UP_TIM13_IRQn,
106+
#else
107+
NULL_IRQ,
108+
#endif
109+
#ifdef TIM14
56110
TIM8_TRG_COM_TIM14_IRQn,
57-
#if (CPY_STM32H7)
111+
#else
112+
NULL_IRQ,
113+
#endif
114+
#ifdef TIM15
58115
TIM15_IRQn,
116+
#else
117+
NULL_IRQ,
118+
#endif
119+
#ifdef TIM16
59120
TIM16_IRQn,
121+
#else
122+
NULL_IRQ,
123+
#endif
124+
#ifdef TIM17
60125
TIM17_IRQn,
61-
#endif
126+
#else
127+
NULL_IRQ,
128+
#endif
62129
};
63130

64131
// Get the frequency (in Hz) of the source clock for the given timer.

0 commit comments

Comments
 (0)