If I receive data on the UART that comes in via its event handler, how can I then create an event to wake up from sd_app_event_wait and do further processing from the application main loop?
If I receive data on the UART that comes in via its event handler, how can I then create an event to wake up from sd_app_event_wait and do further processing from the application main loop?
Any UART interrupt will bring the chip out of sd_app_event_wait(), running the interrupt handler which again calls the event handlers. However, when all interrupt handlers are finished, the chip will return to the main loop, which again will do a new call to sd_app_event_wait(), putting the chip back to sleep.
If you want to transfer execution out of the interrupt, you need to have some way of signaling the main loop. This can either be some kind of flag solution, or you can look into using the app_scheduler module, which gives you the possibility of posting an event from an interrupt handler or similar, which will then be handled from main context. There have been a couple of other discussions on the scheduler on Developer Zone, so I'd recommend you to have a look at some of the other questions.
Any UART interrupt will bring the chip out of sd_app_event_wait(), running the interrupt handler which again calls the event handlers. However, when all interrupt handlers are finished, the chip will return to the main loop, which again will do a new call to sd_app_event_wait(), putting the chip back to sleep.
If you want to transfer execution out of the interrupt, you need to have some way of signaling the main loop. This can either be some kind of flag solution, or you can look into using the app_scheduler module, which gives you the possibility of posting an event from an interrupt handler or similar, which will then be handled from main context. There have been a couple of other discussions on the scheduler on Developer Zone, so I'd recommend you to have a look at some of the other questions.