mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 11:44:31 +00:00
Move more baseband main() code into EventDispatcher.
EventDispatcher might be ripe for a refactor or rename.
This commit is contained in:
parent
818790e734
commit
6328efb70b
@ -125,6 +125,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void run() {
|
void run() {
|
||||||
|
message_map.register_handler(Message::ID::BasebandConfiguration,
|
||||||
|
[](const Message* const p) {
|
||||||
|
auto message = reinterpret_cast<const BasebandConfigurationMessage*>(p);
|
||||||
|
baseband_thread.set_configuration(message->configuration);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
message_map.register_handler(Message::ID::Shutdown,
|
||||||
|
[this](const Message* const) {
|
||||||
|
this->request_stop();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
baseband_thread.thread_main = chThdSelf();
|
||||||
|
baseband_thread.thread_rssi = rssi_thread.start(NORMALPRIO + 10);
|
||||||
|
baseband_thread.start(NORMALPRIO + 20);
|
||||||
|
|
||||||
while(is_running) {
|
while(is_running) {
|
||||||
const auto events = wait();
|
const auto events = wait();
|
||||||
dispatch(events);
|
dispatch(events);
|
||||||
@ -175,26 +192,8 @@ int main(void) {
|
|||||||
m0apptxevent_interrupt_enable();
|
m0apptxevent_interrupt_enable();
|
||||||
|
|
||||||
EventDispatcher event_dispatcher;
|
EventDispatcher event_dispatcher;
|
||||||
auto& message_handlers = event_dispatcher.message_handlers();
|
|
||||||
|
|
||||||
message_handlers.register_handler(Message::ID::BasebandConfiguration,
|
|
||||||
[](const Message* const p) {
|
|
||||||
auto message = reinterpret_cast<const BasebandConfigurationMessage*>(p);
|
|
||||||
baseband_thread.set_configuration(message->configuration);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
message_handlers.register_handler(Message::ID::Shutdown,
|
|
||||||
[&event_dispatcher](const Message* const) {
|
|
||||||
event_dispatcher.request_stop();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/* TODO: Ensure DMAs are configured to point at first LLI in chain. */
|
/* TODO: Ensure DMAs are configured to point at first LLI in chain. */
|
||||||
|
|
||||||
baseband_thread.thread_main = chThdSelf();
|
|
||||||
baseband_thread.thread_rssi = rssi_thread.start(NORMALPRIO + 10);
|
|
||||||
baseband_thread.start(NORMALPRIO + 20);
|
|
||||||
|
|
||||||
touch::dma::allocate();
|
touch::dma::allocate();
|
||||||
touch::dma::enable();
|
touch::dma::enable();
|
||||||
|
Loading…
Reference in New Issue
Block a user