SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
vco.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 VCOBlock : public BlockSimple<float, complex_t>
13 {
14 private:
15 float d_k = 1;
16 float d_amp = 1;
17 float d_phase = 0;
18
19 public:
20 VCOBlock();
21 ~VCOBlock();
22
23 uint32_t process(float *input, uint32_t nsamples, complex_t *output);
24
25 void init() {}
26
27 nlohmann::ordered_json get_cfg_list()
28 {
29 nlohmann::ordered_json p;
30 add_param_simple(p, "k", "float");
31 add_param_simple(p, "amp", "float");
32 return p;
33 }
34
35 nlohmann::json get_cfg(std::string key)
36 {
37 if (key == "k")
38 return d_k;
39 else if (key == "amp")
40 return d_amp;
41 else
42 throw satdump_exception(key);
43 }
44
45 cfg_res_t set_cfg(std::string key, nlohmann::json v)
46 {
47 if (key == "k")
48 d_k = v;
49 else if (key == "amp")
50 d_amp = v;
51 else
52 throw satdump_exception(key);
53 return RES_OK;
54 }
55 };
56 } // namespace ndsp
57} // namespace satdump
cfg_res_t
set_cfg status.
Definition block.h:241
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition vco.h:25
uint32_t process(float *input, uint32_t nsamples, complex_t *output)
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usua...
Definition vco.cpp:12
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition vco.h:35
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 vco.h:45
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition vco.h:27