Calling CyBle_Stop() within the BLE stack handler

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
japac_1817436
Level 1
Level 1

Is it okay to call CyBle_Stop() within the BLE stack handler?

   

Specifically, I would like to call CyBle_Stop() under the case CYBLE_EVT_GAP_DEVICE_DISCONNECTED, i.e. when the peripheral disconnects/gets disconnected from the central device. I am asking this because it does not feel right to stop the stack handler callback within it. I do not know what exactly happens when CyBle_Stop() is called (and I am not a expert programmer) but may be it could cause problems to the stack?

   

Thank you.

0 Likes
1 Solution
Anonymous
Not applicable

I wouldn't do that. Since it can't return from the interrupt if it is "stopped". I would recommend setting a flag in the BLE callback (interrupt) and stopping the BLESS based on that flag somewhere in main().

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

I wouldn't do that. Since it can't return from the interrupt if it is "stopped". I would recommend setting a flag in the BLE callback (interrupt) and stopping the BLESS based on that flag somewhere in main().

0 Likes