cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement HAL_CAN_RxCpltCallback()

Vu.Andy
Associate III
Posted on June 23, 2016 at 17:03

I am a little confused with this call back function HAL_CAN_RxCpltCallback().  The end users are supposed to implement this function but there is already one in the file: stm32f0xx_hal_can.c.  STM recommends do not modify this function in the file but recommend that you have to implement your own version of the function.  So wouldn't it cause some sort of conflict?  I tried to implement HAL_CAN_RxCpltCallback()

in my main() to test it out but the compiler doesn't complain.  So basically there are two identical functions.  How does the program know which function to call?

1 REPLY 1
Walid FTITI_O
Senior II
Posted on June 23, 2016 at 19:26

Hi vu.andy, 

Most of call-back functions found in the drivers are defined as weak function. It up to user to create its own call-back and manage the processing when the CPU or DMA interruptions occurs. When call back function is created by user, it is the one considered for the project and has the high priority than the weak one.

-Hannibal-