mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-30 04:01:45 -04:00
ChannelSpectrumConfig message subsumes FIFONotify.
Separate channel spectrum config from spectrum data. This will permit sending config info only when necessary. Use type information of ChannelSpectrum to statically define number of FFT bins elsewhere. TODO: Posting configuration message way too often. Fixing that is the next step.
This commit is contained in:
parent
ba33cc737d
commit
7710b2d1fa
5 changed files with 49 additions and 42 deletions
|
@ -56,7 +56,7 @@ public:
|
|||
NBFMConfigure = 11,
|
||||
WFMConfigure = 12,
|
||||
AMConfigure = 13,
|
||||
FIFONotify = 14,
|
||||
ChannelSpectrumConfig = 14,
|
||||
MAX
|
||||
};
|
||||
|
||||
|
@ -211,14 +211,31 @@ public:
|
|||
|
||||
struct ChannelSpectrum {
|
||||
std::array<uint8_t, 256> db { { 0 } };
|
||||
size_t db_count { 256 };
|
||||
uint32_t sampling_rate { 0 };
|
||||
uint32_t channel_filter_pass_frequency { 0 };
|
||||
uint32_t channel_filter_stop_frequency { 0 };
|
||||
};
|
||||
|
||||
using ChannelSpectrumFIFO = FIFO<ChannelSpectrum, 2>;
|
||||
|
||||
class ChannelSpectrumConfigMessage : public Message {
|
||||
public:
|
||||
constexpr ChannelSpectrumConfigMessage(
|
||||
uint32_t sampling_rate,
|
||||
uint32_t channel_filter_pass_frequency,
|
||||
uint32_t channel_filter_stop_frequency,
|
||||
ChannelSpectrumFIFO* fifo
|
||||
) : Message { ID::ChannelSpectrumConfig },
|
||||
sampling_rate { sampling_rate },
|
||||
channel_filter_pass_frequency { channel_filter_pass_frequency },
|
||||
channel_filter_stop_frequency { channel_filter_stop_frequency },
|
||||
fifo { fifo }
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t sampling_rate { 0 };
|
||||
uint32_t channel_filter_pass_frequency { 0 };
|
||||
uint32_t channel_filter_stop_frequency { 0 };
|
||||
ChannelSpectrumFIFO* fifo { nullptr };
|
||||
};
|
||||
|
||||
class AISPacketMessage : public Message {
|
||||
public:
|
||||
constexpr AISPacketMessage(
|
||||
|
@ -335,18 +352,6 @@ public:
|
|||
const fir_taps_real<32> channel_filter;
|
||||
};
|
||||
|
||||
class FIFONotifyMessage : public Message {
|
||||
public:
|
||||
constexpr FIFONotifyMessage(
|
||||
void* const fifo
|
||||
) : Message { ID::FIFONotify },
|
||||
fifo { fifo }
|
||||
{
|
||||
}
|
||||
|
||||
void* const fifo;
|
||||
};
|
||||
|
||||
class MessageHandlerMap {
|
||||
public:
|
||||
using MessageHandler = std::function<void(Message* const p)>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue