I am using SDK 15.3 and wanted to ask that if there is a while loop where I can check flags and increment tickers. The program at the moment gets stuck inside
for (;;) { idle_state_handle(); }
Suggestions would be greatly appreciated.
I am using SDK 15.3 and wanted to ask that if there is a while loop where I can check flags and increment tickers. The program at the moment gets stuck inside
for (;;) { idle_state_handle(); }
Suggestions would be greatly appreciated.
Hi,
I'm not sure I understand your question, could you elaborate? Which example are you using? Idle_state_handle() is a function that puts the nRF to sleep until the next event.
regards
Jared
Ok so if I want to check an if statement inside the for loop, would it be checked? like e.g.
for (;;) { idle_state_handle(); if (flag == 1) { perform_blink(); flag == 0; } }
will the perform_blink() function be performed each time the flag is raised?
Great will give it a go.
Will this cause a problem in the sleep function of the controller? As I am using BLE as well and I do not want to compromise the battery life due to it. This is only the perform_blink() function but I was hoping to add some other tickers for checking other things as well, would that be wise? Considering the device will be run on a battery.
Hi,
No, the idle_state_handle() will put the IC into a low-power state until an event occurs. Any functions placed after the idle_state_handle() will be called after the IC has "woken up" from the low power state to handle the event generated.
regards
Jared
So in short the placing the flag after idle_state_handle() of perform_blink() or in my case change_advert_type() is ok to do? As I want to perform change_advert_type() right after an event is performed by checking a flag in the for loop.
Hi,
I can't see any problems with it.
regards
Jared
Hi,
I can't see any problems with it.
regards
Jared
Great, Thank you Jared