SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
quadrature_demod.h
1#pragma once
2
3#include "common/dsp/complex.h"
4#include "dsp/block.h"
5#include "dsp/block_simple.h"
6#include <cstdint>
7
8namespace satdump
9{
10 namespace ndsp
11 {
12 class QuadratureDemodBlock : public BlockSimple<complex_t, float>
13 {
14 private:
15 float gain = 1;
16 float phase = 0;
17
18 public:
19 QuadratureDemodBlock();
20 ~QuadratureDemodBlock();
21
22 uint32_t process(complex_t *input, uint32_t nsamples, float *output);
23
24 void init() {}
25
26 nlohmann::ordered_json get_cfg_list()
27 {
28 nlohmann::ordered_json p;
29 add_param_simple(p, "gain", "float");
30 return p;
31 }
32
33 nlohmann::json get_cfg(std::string key)
34 {
35 if (key == "gain")
36 return 1.0 / gain;
37 else
38 throw satdump_exception(key);
39 }
40
41 cfg_res_t set_cfg(std::string key, nlohmann::json v)
42 {
43 if (key == "gain")
44 gain = 1.0 / ((double)v);
45 else
46 throw satdump_exception(key);
47 return RES_OK;
48 }
49 };
50 } // namespace ndsp
51} // namespace satdump
cfg_res_t
set_cfg status.
Definition block.h:227
uint32_t process(complex_t *input, uint32_t nsamples, float *output)
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usua...
Definition quadrature_demod.cpp:14
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition quadrature_demod.h:24
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition quadrature_demod.h:33
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition quadrature_demod.h:26
cfg_res_t set_cfg(std::string key, nlohmann::json v)
Set parameters of the block from JSON, including potentially IO configurations for blocks that may ha...
Definition quadrature_demod.h:41