mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-03-01 02:17:21 +00:00
Move event loop into EventDispatcher.
This commit is contained in:
parent
d5ebb9ef1e
commit
49b91d9c5d
@ -66,6 +66,20 @@ public:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run() {
|
||||||
|
while(true) {
|
||||||
|
const auto events = wait();
|
||||||
|
dispatch(events);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
touch::Manager touch_manager;
|
||||||
|
ui::Widget* const top_widget;
|
||||||
|
ui::Painter& painter;
|
||||||
|
ui::Context& context;
|
||||||
|
uint32_t encoder_last = 0;
|
||||||
|
|
||||||
eventmask_t wait() {
|
eventmask_t wait() {
|
||||||
return chEvtWaitAny(ALL_EVENTS);
|
return chEvtWaitAny(ALL_EVENTS);
|
||||||
}
|
}
|
||||||
@ -100,13 +114,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
touch::Manager touch_manager;
|
|
||||||
ui::Widget* const top_widget;
|
|
||||||
ui::Painter& painter;
|
|
||||||
ui::Context& context;
|
|
||||||
uint32_t encoder_last = 0;
|
|
||||||
|
|
||||||
void handle_application_queue() {
|
void handle_application_queue() {
|
||||||
while( !shared_memory.application_queue.is_empty() ) {
|
while( !shared_memory.application_queue.is_empty() ) {
|
||||||
auto message = shared_memory.application_queue.pop();
|
auto message = shared_memory.application_queue.pop();
|
||||||
@ -250,10 +257,7 @@ int main(void) {
|
|||||||
|
|
||||||
m4_init(portapack::spi_flash::baseband, portapack::spi_flash::m4_text_ram_base);
|
m4_init(portapack::spi_flash::baseband, portapack::spi_flash::m4_text_ram_base);
|
||||||
|
|
||||||
while(true) {
|
event_dispatcher.run();
|
||||||
const auto events = event_dispatcher.wait();
|
|
||||||
event_dispatcher.dispatch(events);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user