The code looks fine. The critical section is required only for the system low power code. CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) need not be in the Critical section. But the code snippet in which check the BLE state and put the device to deepsleep must be inside critical section.
1 of 1 people found this helpful
The code looks good as @Hima said above. Just so you are aware however, the BLE chip won't necessarily wake up from low power mode upon the CPU waking up. For example, if a SPI or UART bus wakes up the CPU, then the BLE chip may still be asleep. This will cause issues if you then proceed to access the BLE chip APIs/functionality while it is still asleep. But, if you are only using the BLE peripheral to wakeup the device from deep-sleep, then I don't see you running into any problems