mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Move event loop into dispatcher, provide a way to exit.
This commit is contained in:
parent
5978c99c31
commit
9742a058e9
@ -704,6 +704,17 @@ public:
|
||||
return message_map;
|
||||
}
|
||||
|
||||
void run() {
|
||||
while(is_running) {
|
||||
const auto events = wait();
|
||||
dispatch(events);
|
||||
}
|
||||
}
|
||||
|
||||
void request_stop() {
|
||||
is_running = false;
|
||||
}
|
||||
|
||||
eventmask_t wait() {
|
||||
return chEvtWaitAny(ALL_EVENTS);
|
||||
}
|
||||
@ -721,6 +732,8 @@ public:
|
||||
private:
|
||||
MessageHandlerMap message_map;
|
||||
|
||||
bool is_running = true;
|
||||
|
||||
void handle_baseband_queue() {
|
||||
while( !shared_memory.baseband_queue.is_empty() ) {
|
||||
std::array<uint8_t, Message::MAX_SIZE> message_buffer;
|
||||
@ -853,10 +866,7 @@ int main(void) {
|
||||
);
|
||||
//baseband::dma::allocate(4, 2048);
|
||||
|
||||
while(true) {
|
||||
const auto events = event_dispatcher.wait();
|
||||
event_dispatcher.dispatch(events);
|
||||
}
|
||||
|
||||
event_dispatcher.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user