Give Processors a run() function.

So main() can call it, start a Processor linked in to the baseband binary.
This commit is contained in:
Jared Boone 2016-06-30 11:53:58 -07:00
parent 1a5f3a4422
commit 500a651bcf
9 changed files with 57 additions and 15 deletions

View File

@ -28,19 +28,8 @@
#include "gpdma.hpp" #include "gpdma.hpp"
#include "event_m4.hpp"
#include "touch_dma.hpp" #include "touch_dma.hpp"
#include "proc_am_audio.hpp"
#include "proc_nfm_audio.hpp"
#include "proc_wfm_audio.hpp"
#include "proc_ais.hpp"
#include "proc_wideband_spectrum.hpp"
#include "proc_tpms.hpp"
#include "proc_ert.hpp"
#include "proc_capture.hpp"
#include "message_queue.hpp" #include "message_queue.hpp"
#include "utility.hpp" #include "utility.hpp"
@ -90,10 +79,7 @@ static void init() {
touch::dma::enable(); touch::dma::enable();
} }
static void run() { extern void run();
EventDispatcher event_dispatcher { std::make_unique<CaptureProcessor>() };
event_dispatcher.run();
}
static void halt() { static void halt() {
port_disable(); port_disable();

View File

@ -25,6 +25,8 @@
#include "dsp_fir_taps.hpp" #include "dsp_fir_taps.hpp"
#include "event_m4.hpp"
AISProcessor::AISProcessor() { AISProcessor::AISProcessor() {
decim_0.configure(taps_11k0_decim_0.taps, 33554432); decim_0.configure(taps_11k0_decim_0.taps, 33554432);
decim_1.configure(taps_11k0_decim_1.taps, 131072); decim_1.configure(taps_11k0_decim_1.taps, 131072);
@ -62,3 +64,8 @@ void AISProcessor::payload_handler(
const AISPacketMessage message { packet }; const AISPacketMessage message { packet };
shared_memory.application_queue.push(message); shared_memory.application_queue.push(message);
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<AISProcessor>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "audio_output.hpp" #include "audio_output.hpp"
#include "event_m4.hpp"
#include <array> #include <array>
void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) { void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
@ -105,3 +107,8 @@ void NarrowbandAMAudio::capture_config(const CaptureConfigMessage& message) {
audio_output.set_stream(nullptr); audio_output.set_stream(nullptr);
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<NarrowbandAMAudio>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "dsp_fir_taps.hpp" #include "dsp_fir_taps.hpp"
#include "event_m4.hpp"
#include "utility.hpp" #include "utility.hpp"
CaptureProcessor::CaptureProcessor() { CaptureProcessor::CaptureProcessor() {
@ -90,3 +92,8 @@ void CaptureProcessor::capture_config(const CaptureConfigMessage& message) {
stream.reset(); stream.reset();
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<CaptureProcessor>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "portapack_shared_memory.hpp" #include "portapack_shared_memory.hpp"
#include "event_m4.hpp"
float ERTProcessor::abs(const complex8_t& v) { float ERTProcessor::abs(const complex8_t& v) {
// const int16_t r = v.real() - offset_i; // const int16_t r = v.real() - offset_i;
// const int16_t i = v.imag() - offset_q; // const int16_t i = v.imag() - offset_q;
@ -101,3 +103,8 @@ void ERTProcessor::idm_handler(
const ERTPacketMessage message { ert::Packet::Type::IDM, packet }; const ERTPacketMessage message { ert::Packet::Type::IDM, packet };
shared_memory.application_queue.push(message); shared_memory.application_queue.push(message);
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<ERTProcessor>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "audio_output.hpp" #include "audio_output.hpp"
#include "event_m4.hpp"
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
@ -93,3 +95,8 @@ void NarrowbandFMAudio::capture_config(const CaptureConfigMessage& message) {
audio_output.set_stream(nullptr); audio_output.set_stream(nullptr);
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<NarrowbandFMAudio>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "dsp_fir_taps.hpp" #include "dsp_fir_taps.hpp"
#include "event_m4.hpp"
TPMSProcessor::TPMSProcessor() { TPMSProcessor::TPMSProcessor() {
decim_0.configure(taps_200k_decim_0.taps, 33554432); decim_0.configure(taps_200k_decim_0.taps, 33554432);
decim_1.configure(taps_200k_decim_1.taps, 131072); decim_1.configure(taps_200k_decim_1.taps, 131072);
@ -55,3 +57,8 @@ void TPMSProcessor::execute(const buffer_c8_t& buffer) {
}); });
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<TPMSProcessor>() };
event_dispatcher.run();
}

View File

@ -23,6 +23,8 @@
#include "audio_output.hpp" #include "audio_output.hpp"
#include "event_m4.hpp"
#include <cstdint> #include <cstdint>
void WidebandFMAudio::execute(const buffer_c8_t& buffer) { void WidebandFMAudio::execute(const buffer_c8_t& buffer) {
@ -122,3 +124,8 @@ void WidebandFMAudio::capture_config(const CaptureConfigMessage& message) {
audio_output.set_stream(nullptr); audio_output.set_stream(nullptr);
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<WidebandFMAudio>() };
event_dispatcher.run();
}

View File

@ -25,6 +25,8 @@
#include "dsp_fft.hpp" #include "dsp_fft.hpp"
#include "event_m4.hpp"
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
@ -72,3 +74,8 @@ void WidebandSpectrum::on_message(const Message* const message) {
break; break;
} }
} }
void run() {
EventDispatcher event_dispatcher { std::make_unique<WidebandSpectrum>() };
event_dispatcher.run();
}