cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_GPIO_EXTI_Callback with both USB and GPIO

Noirim DIH
Associate II
Posted on February 05, 2018 at 13:23

Hello, I'm facing a difficulty using CubeMx generated code with USB (CDC with VBus sensing).

HAL_GPIO_EXTI_Callback is declared as 'weak' so for managing some GPIO's interrupts, I declared my own call back to 'catch gpio's interruption' and everything works fine. Now I'm trying to add USB CDC and it appears that in usb_conf.c file, HAL_GPIO_EXTI_Callback is redefine to manage VBus detection. So now I have in my project a double declaration for this callback : in the user code and in the code generated by CubeMx.

Is there any simple way to deal with this?

Thanks

#hal_gpio_exti_callback #usb-with-gpio
4 REPLIES 4
Pavel A.
Evangelist III
Posted on February 05, 2018 at 20:50

You will need to combine both routines in one place, of your choice.

-- pa

Posted on February 06, 2018 at 08:17

Hello, thanks for your reply. That exactly the purpose of my question. How can I merge both routine without modifying generated code (from CubeMx).Is there some configuration or can I had some 'User code tag' to prevent overrides after an update?

Gene Toner
Associate
Posted on February 11, 2018 at 00:18

X2 on this problem and Hassan Chiker's response. Some kind of 'User code tag' would be a great 'get out of jail free card' for all bugs like this in CubeMX.

Posted on February 11, 2018 at 00:29

Sometimes this concept of 'user code' does not work and we have to merge manually.