mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-26 14:36:17 -05:00
Add app-local MessageQueue.
This commit is contained in:
parent
7023616808
commit
dbe735233a
@ -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(
|
||||
|
@ -86,6 +86,7 @@ private:
|
||||
static constexpr auto EVT_MASK_RTC_TICK = EVENT_MASK(0);
|
||||
static constexpr auto EVT_MASK_LCD_FRAME_SYNC = EVENT_MASK(1);
|
||||
static constexpr auto EVT_MASK_APPLICATION = EVENT_MASK(6);
|
||||
static constexpr auto EVT_MASK_LOCAL = EVENT_MASK(7);
|
||||
|
||||
static Thread* thread_event_loop;
|
||||
|
||||
@ -102,6 +103,7 @@ private:
|
||||
void dispatch(const eventmask_t events);
|
||||
|
||||
void handle_application_queue();
|
||||
void handle_local_queue();
|
||||
void handle_rtc_tick();
|
||||
|
||||
static ui::Widget* touch_widget(ui::Widget* const w, ui::TouchEvent event);
|
||||
|
@ -35,11 +35,14 @@ struct TouchADCFrame {
|
||||
struct SharedMemory {
|
||||
static constexpr size_t baseband_queue_k = 11;
|
||||
static constexpr size_t application_queue_k = 11;
|
||||
static constexpr size_t app_local_queue_k = 11;
|
||||
|
||||
uint8_t baseband_queue_data[1 << baseband_queue_k];
|
||||
uint8_t application_queue_data[1 << application_queue_k];
|
||||
uint8_t app_local_queue_data[1 << app_local_queue_k];
|
||||
MessageQueue baseband_queue;
|
||||
MessageQueue application_queue;
|
||||
MessageQueue app_local_queue;
|
||||
|
||||
// TODO: M0 should directly configure and control DMA channel that is
|
||||
// acquiring ADC samples.
|
||||
|
Loading…
x
Reference in New Issue
Block a user