mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Transform update spectrum event into message.
This commit is contained in:
parent
c9f9d97d07
commit
39ca6fec62
@ -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() {
|
||||
baseband::dma::init();
|
||||
|
||||
|
@ -38,7 +38,6 @@ public:
|
||||
Thread* start(const tprio_t priority);
|
||||
|
||||
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
|
||||
// isn't in the right place to begin with.
|
||||
|
@ -189,8 +189,8 @@ private:
|
||||
}
|
||||
|
||||
void handle_spectrum() {
|
||||
// TODO: Send this via another message?!
|
||||
baseband_thread.on_update_spectrum();
|
||||
const UpdateSpectrumMessage message;
|
||||
baseband_thread.on_message(&message);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -71,3 +71,9 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
fill_audio_buffer(audio);
|
||||
}
|
||||
|
||||
void NarrowbandAMAudio::on_message(const Message* const message) {
|
||||
if( message->id == Message::ID::UpdateSpectrum ) {
|
||||
channel_spectrum.update();
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ public:
|
||||
NarrowbandAMAudio();
|
||||
|
||||
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:
|
||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||
|
@ -116,3 +116,9 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
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 on_update_spectrum() override { channel_spectrum.update(); }
|
||||
void on_message(const Message* const message) override;
|
||||
|
||||
private:
|
||||
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
|
||||
|
@ -67,3 +67,9 @@ void WidebandSpectrum::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
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:
|
||||
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:
|
||||
size_t sample_count = 0;
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
Shutdown = 8,
|
||||
AISPacket = 7,
|
||||
ERTPacket = 9,
|
||||
UpdateSpectrum = 10,
|
||||
MAX
|
||||
};
|
||||
|
||||
@ -260,6 +261,14 @@ public:
|
||||
baseband::Packet packet;
|
||||
};
|
||||
|
||||
class UpdateSpectrumMessage : public Message {
|
||||
public:
|
||||
constexpr UpdateSpectrumMessage(
|
||||
) : Message { ID::UpdateSpectrum }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class MessageHandlerMap {
|
||||
public:
|
||||
using MessageHandler = std::function<void(Message* const p)>;
|
||||
|
Loading…
Reference in New Issue
Block a user