Skip to content

Commit f1f04d5

Browse files
add missing files
1 parent ef42ea0 commit f1f04d5

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#pragma once
2+
#include "../decoder.h"
3+
#include <signal_path/vfo_manager.h>
4+
#include <utils/optionlist.h>
5+
#include <gui/widgets/symbol_diagram.h>
6+
#include <gui/style.h>
7+
#include <dsp/sink/handler_sink.h>
8+
#include "flex.h"
9+
10+
class FLEXDecoder : public Decoder {
11+
dsp::stream<float> dummy1;
12+
dsp::stream<uint8_t> dummy2;
13+
public:
14+
FLEXDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 1600) {
15+
this->name = name;
16+
this->vfo = vfo;
17+
18+
// Define baudrate options
19+
baudrates.define(1600, "1600 Baud", 1600);
20+
baudrates.define(3200, "3200 Baud", 3200);
21+
baudrates.define(6400, "6400 Baud", 6400);
22+
23+
// Init DSP
24+
vfo->setBandwidthLimits(12500, 12500, true);
25+
vfo->setSampleRate(16000, 12500);
26+
reshape.init(&dummy1, 1600.0, (1600 / 30.0) - 1600.0);
27+
dataHandler.init(&dummy2, _dataHandler, this);
28+
diagHandler.init(&reshape.out, _diagHandler, this);
29+
}
30+
31+
~FLEXDecoder() {
32+
stop();
33+
}
34+
35+
void showMenu() {
36+
ImGui::LeftLabel("Baudrate");
37+
ImGui::FillWidth();
38+
if (ImGui::Combo(("##pager_decoder_flex_br_" + name).c_str(), &brId, baudrates.txt)) {
39+
// TODO
40+
}
41+
42+
ImGui::FillWidth();
43+
diag.draw();
44+
}
45+
46+
void setVFO(VFOManager::VFO* vfo) {
47+
this->vfo = vfo;
48+
vfo->setBandwidthLimits(12500, 12500, true);
49+
vfo->setSampleRate(24000, 12500);
50+
// dsp.setInput(vfo->output);
51+
}
52+
53+
void start() {
54+
flog::debug("FLEX start");
55+
// dsp.start();
56+
reshape.start();
57+
dataHandler.start();
58+
diagHandler.start();
59+
}
60+
61+
void stop() {
62+
flog::debug("FLEX stop");
63+
// dsp.stop();
64+
reshape.stop();
65+
dataHandler.stop();
66+
diagHandler.stop();
67+
}
68+
69+
private:
70+
static void _dataHandler(uint8_t* data, int count, void* ctx) {
71+
FLEXDecoder* _this = (FLEXDecoder*)ctx;
72+
// _this->decoder.process(data, count);
73+
}
74+
75+
static void _diagHandler(float* data, int count, void* ctx) {
76+
FLEXDecoder* _this = (FLEXDecoder*)ctx;
77+
float* buf = _this->diag.acquireBuffer();
78+
memcpy(buf, data, count * sizeof(float));
79+
_this->diag.releaseBuffer();
80+
}
81+
82+
std::string name;
83+
84+
VFOManager::VFO* vfo;
85+
dsp::buffer::Reshaper<float> reshape;
86+
dsp::sink::Handler<uint8_t> dataHandler;
87+
dsp::sink::Handler<float> diagHandler;
88+
89+
flex::Decoder decoder;
90+
91+
ImGui::SymbolDiagram diag;
92+
93+
int brId = 0;
94+
95+
OptionList<int, int> baudrates;
96+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "flex.h"
2+
3+
namespace flex {
4+
// TODO
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#pragma once
2+
3+
namespace flex {
4+
class Decoder {
5+
public:
6+
// TODO
7+
8+
private:
9+
// TODO
10+
};
11+
}

0 commit comments

Comments
 (0)