@@ -249,15 +249,31 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
249249 TIM_TypeDef *TIM_slave = slave->getHandle ()->Instance ;
250250 #if defined(TIM1) && defined(LL_TIM_TS_ITR0)
251251 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
253261 #if defined(TIM8)
254262 else if (TIM_slave == TIM8) return LL_TIM_TS_ITR0;
255263 #endif
256264 }
257265 #endif
258266 #if defined(TIM2) && defined(LL_TIM_TS_ITR1)
259267 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
261277 #if defined(TIM8)
262278 else if (TIM_slave == TIM8) return LL_TIM_TS_ITR1;
263279 #endif
@@ -268,15 +284,31 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
268284 #endif
269285 #if defined(TIM3) && defined(LL_TIM_TS_ITR2)
270286 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
272296 #if defined(TIM5)
273297 else if (TIM_slave == TIM5) return LL_TIM_TS_ITR1;
274298 #endif
275299 }
276300 #endif
277301 #if defined(TIM4) && defined(LL_TIM_TS_ITR3)
278302 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
280312 #if defined(TIM8)
281313 else if (TIM_slave == TIM8) return LL_TIM_TS_ITR2;
282314 #endif
@@ -288,18 +320,29 @@ int _getInternalSourceTrigger(HardwareTimer* master, HardwareTimer* slave) {
288320 #if defined(TIM5)
289321 else if (TIM_master == TIM5){
290322 #if !defined(STM32L4xx) // only difference between F4,F1 and L4
323+ #if defined(TIM1)
291324 if (TIM_slave == TIM1) return LL_TIM_TS_ITR0;
325+ #endif
326+ #if defined(TIM3)
292327 else if (TIM_slave == TIM3) return LL_TIM_TS_ITR2;
293328 #endif
329+ #endif
294330 #if defined(TIM8)
295331 if (TIM_slave == TIM8) return LL_TIM_TS_ITR3;
296332 #endif
297333 }
298334 #endif
299335 #if defined(TIM8)
300336 else if (TIM_master == TIM8){
337+ #if defined(TIM2)
301338 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
303346 }
304347 #endif
305348 return -1 ; // combination not supported
0 commit comments