mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 08:17:44 +00:00
Transform update spectrum event into message.
This commit is contained in:
@@ -78,12 +78,6 @@ void BasebandThread::on_message(const Message* const message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasebandThread::on_update_spectrum() {
|
|
||||||
if( baseband_processor ) {
|
|
||||||
baseband_processor->on_update_spectrum();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BasebandThread::run() {
|
void BasebandThread::run() {
|
||||||
baseband::dma::init();
|
baseband::dma::init();
|
||||||
|
|
||||||
|
@@ -38,7 +38,6 @@ public:
|
|||||||
Thread* start(const tprio_t priority);
|
Thread* start(const tprio_t priority);
|
||||||
|
|
||||||
void on_message(const Message* const message);
|
void on_message(const Message* const message);
|
||||||
void on_update_spectrum();
|
|
||||||
|
|
||||||
// This getter should die, it's just here to leak information to code that
|
// This getter should die, it's just here to leak information to code that
|
||||||
// isn't in the right place to begin with.
|
// isn't in the right place to begin with.
|
||||||
|
@@ -189,8 +189,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handle_spectrum() {
|
void handle_spectrum() {
|
||||||
// TODO: Send this via another message?!
|
const UpdateSpectrumMessage message;
|
||||||
baseband_thread.on_update_spectrum();
|
baseband_thread.on_message(&message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -71,3 +71,9 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
|
|||||||
|
|
||||||
fill_audio_buffer(audio);
|
fill_audio_buffer(audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NarrowbandAMAudio::on_message(const Message* const message) {
|
||||||
|
if( message->id == Message::ID::UpdateSpectrum ) {
|
||||||
|
channel_spectrum.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
void execute(const buffer_c8_t& buffer) override;
|
void execute(const buffer_c8_t& buffer) override;
|
||||||
|
|
||||||
void on_update_spectrum() override { channel_spectrum.update(); }
|
void on_message(const Message* const message) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||||
|
@@ -116,3 +116,9 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
|
|||||||
|
|
||||||
fill_audio_buffer(audio);
|
fill_audio_buffer(audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NarrowbandFMAudio::on_message(const Message* const message) {
|
||||||
|
if( message->id == Message::ID::UpdateSpectrum ) {
|
||||||
|
channel_spectrum.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
void execute(const buffer_c8_t& buffer) override;
|
void execute(const buffer_c8_t& buffer) override;
|
||||||
|
|
||||||
void on_update_spectrum() override { channel_spectrum.update(); }
|
void on_message(const Message* const message) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||||
|
@@ -67,3 +67,9 @@ void WidebandSpectrum::execute(const buffer_c8_t& buffer) {
|
|||||||
|
|
||||||
i2s::i2s0::tx_mute();
|
i2s::i2s0::tx_mute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WidebandSpectrum::on_message(const Message* const message) {
|
||||||
|
if( message->id == Message::ID::UpdateSpectrum ) {
|
||||||
|
channel_spectrum.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -33,7 +33,7 @@ class WidebandSpectrum : public BasebandProcessor {
|
|||||||
public:
|
public:
|
||||||
void execute(const buffer_c8_t& buffer) override;
|
void execute(const buffer_c8_t& buffer) override;
|
||||||
|
|
||||||
void on_update_spectrum() override { channel_spectrum.update(); }
|
void on_message(const Message* const message) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t sample_count = 0;
|
size_t sample_count = 0;
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
Shutdown = 8,
|
Shutdown = 8,
|
||||||
AISPacket = 7,
|
AISPacket = 7,
|
||||||
ERTPacket = 9,
|
ERTPacket = 9,
|
||||||
|
UpdateSpectrum = 10,
|
||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -260,6 +261,14 @@ public:
|
|||||||
baseband::Packet packet;
|
baseband::Packet packet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UpdateSpectrumMessage : public Message {
|
||||||
|
public:
|
||||||
|
constexpr UpdateSpectrumMessage(
|
||||||
|
) : Message { ID::UpdateSpectrum }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class MessageHandlerMap {
|
class MessageHandlerMap {
|
||||||
public:
|
public:
|
||||||
using MessageHandler = std::function<void(Message* const p)>;
|
using MessageHandler = std::function<void(Message* const p)>;
|
||||||
|
Reference in New Issue
Block a user