Add wideband FM spectrum waterfall.

This commit is contained in:
Jared Boone 2016-01-04 17:27:18 -08:00
parent 36021689f9
commit dcb2c46c57
2 changed files with 26 additions and 1 deletions

View File

@ -36,7 +36,12 @@ void WidebandFMAudio::execute(const buffer_c8_t& buffer) {
// TODO: Feed channel_stats post-decimation data?
feed_channel_stats(channel);
//feed_channel_spectrum(channel);
spectrum_samples += channel.count;
if( spectrum_samples >= spectrum_interval_samples ) {
spectrum_samples -= spectrum_interval_samples;
channel_spectrum.feed(channel, channel_filter_pass_f, channel_filter_stop_f);
}
/* 384kHz complex<int16_t>[256]
* -> FM demodulation
@ -71,6 +76,10 @@ void WidebandFMAudio::execute(const buffer_c8_t& buffer) {
void WidebandFMAudio::on_message(const Message* const message) {
switch(message->id) {
case Message::ID::UpdateSpectrum:
channel_spectrum.update();
break;
case Message::ID::WFMConfigure:
configure(*reinterpret_cast<const WFMConfigureMessage*>(message));
break;
@ -93,10 +102,18 @@ void WidebandFMAudio::configure(const WFMConfigureMessage& message) {
constexpr size_t demod_input_fs = decim_1_output_fs;
constexpr auto spectrum_rate_hz = 50.0f;
spectrum_interval_samples = decim_1_output_fs / spectrum_rate_hz;
spectrum_samples = 0;
decim_0.configure(message.decim_0_filter.taps, 33554432);
decim_1.configure(message.decim_1_filter.taps, 131072);
channel_filter_pass_f = message.decim_1_filter.pass_frequency_normalized * decim_1_input_fs;
channel_filter_stop_f = message.decim_1_filter.stop_frequency_normalized * decim_1_input_fs;
demod.configure(demod_input_fs, message.deviation);
audio_filter.configure(message.audio_filter.taps);
channel_spectrum.set_decimation_factor(1);
configured = true;
}

View File

@ -29,6 +29,8 @@
#include "dsp_iir.hpp"
#include "dsp_iir_config.hpp"
#include "spectrum_collector.hpp"
class WidebandFMAudio : public BasebandProcessor {
public:
void execute(const buffer_c8_t& buffer) override;
@ -48,6 +50,8 @@ private:
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0;
dsp::decimate::FIRC16xR16x16Decim2 decim_1;
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
dsp::demodulate::FM demod;
dsp::decimate::DecimateBy2CIC4Real audio_dec_1;
@ -57,6 +61,10 @@ private:
IIRBiquadFilter audio_hpf { audio_hpf_30hz_config };
IIRBiquadFilter audio_deemph { audio_deemph_2122_6_config };
SpectrumCollector channel_spectrum;
size_t spectrum_interval_samples = 0;
size_t spectrum_samples = 0;
bool configured { false };
void configure(const WFMConfigureMessage& message);
};