diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index 6f291dd3..d40d60a9 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -322,14 +322,7 @@ void EventDispatcher::event_bubble_encoder(const ui::EncoderEvent event) { } void EventDispatcher::init_message_queues() { - shared_memory.baseband_message = nullptr; - 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 - ); - shared_memory.m4_panic_msg[0] = 0; + new (&shared_memory) SharedMemory; } MessageHandlerRegistration::MessageHandlerRegistration( diff --git a/firmware/common/portapack_shared_memory.hpp b/firmware/common/portapack_shared_memory.hpp index 3ef6ec98..a509473e 100644 --- a/firmware/common/portapack_shared_memory.hpp +++ b/firmware/common/portapack_shared_memory.hpp @@ -36,17 +36,17 @@ struct SharedMemory { static constexpr size_t application_queue_k = 11; static constexpr size_t app_local_queue_k = 11; - uint8_t application_queue_data[1 << application_queue_k]; - uint8_t app_local_queue_data[1 << app_local_queue_k]; - const Message* volatile baseband_message; - MessageQueue application_queue; - MessageQueue app_local_queue; // TODO: M0 should directly configure and control DMA channel that is // acquiring ADC samples. TouchADCFrame touch_adc_frame; + uint8_t application_queue_data[1 << application_queue_k] { 0 }; + uint8_t app_local_queue_data[1 << app_local_queue_k] { 0 }; + const Message* volatile baseband_message { nullptr }; + MessageQueue application_queue { application_queue_data, application_queue_k }; + MessageQueue app_local_queue { app_local_queue_data, app_local_queue_k }; - char m4_panic_msg[32]; + char m4_panic_msg[32] { 0 }; }; extern SharedMemory& shared_memory;