The lf_nanosleep function in lf_nrf52_support.c busy waits. It would be far more energy efficient to wait for interrupt. If the event queue is empty, that is all it needs to do. Otherwise, if the requested wait interval is large enough, it should set up a timer interrupt for the time of the first event on the event queue. To perform a wait for interrupt on the Arm Cortex M4, just use the following line of code:
The
lf_nanosleep
function inlf_nrf52_support.c
busy waits. It would be far more energy efficient to wait for interrupt. If the event queue is empty, that is all it needs to do. Otherwise, if the requested wait interval is large enough, it should set up a timer interrupt for the time of the first event on the event queue. To perform a wait for interrupt on the Arm Cortex M4, just use the following line of code: