Alarm callbacks in hal_st_lld.c wrong indexing

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
FXCoder
Posts: 329
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 143 times
Been thanked: 108 times

Alarm callbacks in hal_st_lld.c wrong indexing

Postby FXCoder » Wed Feb 17, 2021 2:16 am

Hi,
Fix required in 20.3.x for incorrect indexing of ALAM callbacks.
The code in trunk is correct.
--
Bob

Code: Select all

Index: ChibiOS (20.3.x)/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c
===================================================================
--- ChibiOS (20.3.x)/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c   (revision 14019)
+++ ChibiOS (20.3.x)/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c   (working copy)
@@ -465,7 +465,7 @@
 #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
 #if ST_LLD_NUM_ALARMS > 1
   if ((sr & TIM_SR_CC2IF) != 0U) {
-    if (st_callbacks[2] != NULL) {
+    if (st_callbacks[0] != NULL) {
       st_callbacks[0](1U);
     }
   }
@@ -472,7 +472,7 @@
 #endif
 #if ST_LLD_NUM_ALARMS > 2
   if ((sr & TIM_SR_CC3IF) != 0U) {
-    if (st_callbacks[2] != NULL) {
+    if (st_callbacks[1] != NULL) {
       st_callbacks[1](2U);
     }
   }

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests