mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-24 14:37:31 +00:00
Move event.* code into event_m[04].*.
Slightly more duplication of code now. Need a base class...
This commit is contained in:
@@ -32,7 +32,7 @@ CH_IRQ_HANDLER(MAPP_IRQHandler) {
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
events_flag_isr(EVT_MASK_BASEBAND);
|
||||
EventDispatcher::events_flag_isr(EVT_MASK_BASEBAND);
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
creg::m0apptxevent::clear();
|
||||
@@ -41,3 +41,5 @@ CH_IRQ_HANDLER(MAPP_IRQHandler) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Thread* EventDispatcher::thread_event_loop = nullptr;
|
||||
|
@@ -44,7 +44,7 @@ constexpr auto EVT_MASK_SPECTRUM = EVENT_MASK(1);
|
||||
class EventDispatcher {
|
||||
public:
|
||||
void run() {
|
||||
events_initialize(chThdSelf());
|
||||
thread_event_loop = chThdSelf();
|
||||
lpc43xx::creg::m0apptxevent::enable();
|
||||
|
||||
baseband_thread.thread_main = chThdSelf();
|
||||
@@ -63,7 +63,21 @@ public:
|
||||
is_running = false;
|
||||
}
|
||||
|
||||
static inline void events_flag(const eventmask_t events) {
|
||||
if( thread_event_loop ) {
|
||||
chEvtSignal(thread_event_loop, events);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void events_flag_isr(const eventmask_t events) {
|
||||
if( thread_event_loop ) {
|
||||
chEvtSignalI(thread_event_loop, events);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static Thread* thread_event_loop;
|
||||
|
||||
BasebandThread baseband_thread;
|
||||
RSSIThread rssi_thread;
|
||||
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#include "event_m4.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include "event_m4.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void SpectrumCollector::on_message(const Message* const message) {
|
||||
@@ -97,7 +99,7 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
|
||||
fft_swap(data, channel_spectrum);
|
||||
channel_spectrum_sampling_rate = data.sampling_rate;
|
||||
channel_spectrum_request_update = true;
|
||||
events_flag(EVT_MASK_SPECTRUM);
|
||||
EventDispatcher::events_flag(EVT_MASK_SPECTRUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user