Add app-local MessageQueue.

This commit is contained in:
Jared Boone 2016-06-21 10:57:44 -07:00
parent 7023616808
commit dbe735233a
3 changed files with 18 additions and 0 deletions

View file

@ -145,6 +145,10 @@ void EventDispatcher::dispatch(const eventmask_t events) {
handle_application_queue();
}
if( events & EVT_MASK_LOCAL ) {
handle_local_queue();
}
if( events & EVT_MASK_RTC_TICK ) {
handle_rtc_tick();
}
@ -174,6 +178,12 @@ void EventDispatcher::handle_application_queue() {
});
}
void EventDispatcher::handle_local_queue() {
shared_memory.app_local_queue.handle([](Message* const message) {
message_map.send(message);
});
}
void EventDispatcher::handle_rtc_tick() {
sd_card::poll_inserted();
@ -288,6 +298,9 @@ void EventDispatcher::init_message_queues() {
new (&shared_memory.application_queue) MessageQueue(
shared_memory.application_queue_data, SharedMemory::application_queue_k
);
new (&shared_memory.app_local_queue) MessageQueue(
shared_memory.app_local_queue_data, SharedMemory::app_local_queue_k
);
}
MessageHandlerRegistration::MessageHandlerRegistration(