@@ -249,15 +249,31 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
249
249
TIM_TypeDef *TIM_slave = slave->getHandle ()->Instance ;
250
250
#if defined(TIM1) && defined(LL_TIM_TS_ITR0)
251
251
if (TIM_master == TIM1){
252
- if (TIM_slave == TIM2 || TIM_slave == TIM3 || TIM_slave == TIM4) return LL_TIM_TS_ITR0;
252
+ #if defined(TIM2)
253
+ if (TIM_slave == TIM2) return LL_TIM_TS_ITR0;
254
+ #endif
255
+ #if defined(TIM3)
256
+ else if (TIM_slave == TIM3) return LL_TIM_TS_ITR0;
257
+ #endif
258
+ #if defined(TIM4)
259
+ else if (TIM_slave == TIM4) return LL_TIM_TS_ITR0;
260
+ #endif
253
261
#if defined(TIM8)
254
262
else if (TIM_slave == TIM8) return LL_TIM_TS_ITR0;
255
263
#endif
256
264
}
257
265
#endif
258
266
#if defined(TIM2) && defined(LL_TIM_TS_ITR1)
259
267
else if (TIM_master == TIM2){
260
- if (TIM_slave == TIM1 || TIM_slave == TIM3 || TIM_slave == TIM4) return LL_TIM_TS_ITR1;
268
+ #if defined(TIM1)
269
+ if (TIM_slave == TIM1) return LL_TIM_TS_ITR1;
270
+ #endif
271
+ #if defined(TIM3)
272
+ else if (TIM_slave == TIM3) return LL_TIM_TS_ITR1;
273
+ #endif
274
+ #if defined(TIM4)
275
+ else if (TIM_slave == TIM4) return LL_TIM_TS_ITR1;
276
+ #endif
261
277
#if defined(TIM8)
262
278
else if (TIM_slave == TIM8) return LL_TIM_TS_ITR1;
263
279
#endif
@@ -268,15 +284,31 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
268
284
#endif
269
285
#if defined(TIM3) && defined(LL_TIM_TS_ITR2)
270
286
else if (TIM_master == TIM3){
271
- if (TIM_slave== TIM1 || TIM_slave == TIM2 || TIM_slave == TIM4) return LL_TIM_TS_ITR2;
287
+ #if defined(TIM1)
288
+ if (TIM_slave == TIM1) return LL_TIM_TS_ITR2;
289
+ #endif
290
+ #if defined(TIM2)
291
+ else if (TIM_slave == TIM2) return LL_TIM_TS_ITR2;
292
+ #endif
293
+ #if defined(TIM4)
294
+ else if (TIM_slave == TIM4) return LL_TIM_TS_ITR2;
295
+ #endif
272
296
#if defined(TIM5)
273
297
else if (TIM_slave == TIM5) return LL_TIM_TS_ITR1;
274
298
#endif
275
299
}
276
300
#endif
277
301
#if defined(TIM4) && defined(LL_TIM_TS_ITR3)
278
302
else if (TIM_master == TIM4){
279
- if (TIM_slave == TIM1 || TIM_slave == TIM2 || TIM_slave == TIM3) return LL_TIM_TS_ITR3;
303
+ #if defined(TIM1)
304
+ if (TIM_slave == TIM1) return LL_TIM_TS_ITR3;
305
+ #endif
306
+ #if defined(TIM2)
307
+ else if (TIM_slave == TIM2) return LL_TIM_TS_ITR3;
308
+ #endif
309
+ #if defined(TIM3)
310
+ else if (TIM_slave == TIM3) return LL_TIM_TS_ITR3;
311
+ #endif
280
312
#if defined(TIM8)
281
313
else if (TIM_slave == TIM8) return LL_TIM_TS_ITR2;
282
314
#endif
@@ -288,18 +320,29 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
288
320
#if defined(TIM5)
289
321
else if (TIM_master == TIM5){
290
322
#if !defined(STM32L4xx) // only difference between F4,F1 and L4
323
+ #if defined(TIM1)
291
324
if (TIM_slave == TIM1) return LL_TIM_TS_ITR0;
325
+ #endif
326
+ #if defined(TIM3)
292
327
else if (TIM_slave == TIM3) return LL_TIM_TS_ITR2;
293
328
#endif
329
+ #endif
294
330
#if defined(TIM8)
295
331
if (TIM_slave == TIM8) return LL_TIM_TS_ITR3;
296
332
#endif
297
333
}
298
334
#endif
299
335
#if defined(TIM8)
300
336
else if (TIM_master == TIM8){
337
+ #if defined(TIM2)
301
338
if (TIM_slave==TIM2) return LL_TIM_TS_ITR1;
302
- else if (TIM_slave ==TIM4 || TIM_slave ==TIM5) return LL_TIM_TS_ITR3;
339
+ #endif
340
+ #if defined(TIM4)
341
+ else if (TIM_slave == TIM4) return LL_TIM_TS_ITR3;
342
+ #endif
343
+ #if defined(TIM5)
344
+ else if (TIM_slave == TIM5) return LL_TIM_TS_ITR3;
345
+ #endif
303
346
}
304
347
#endif
305
348
return -1 ; // combination not supported
0 commit comments