3#include "common/dsp/complex.h"
10 class CostasBlock :
public BlockSimple<complex_t, complex_t>
14 float loop_bw = 0.004;
15 float freq_limit = 1.0;
19 float phase = 0, freq = 0;
22 float freq_limit_min, freq_limit_max;
27 uint32_t
process(complex_t *input, uint32_t nsamples, complex_t *output);
35 freq_limit_min = -freq_limit;
36 freq_limit_max = freq_limit;
41 float damping = sqrtf(2.0f) / 2.0f;
42 float denom = (1.0 + 2.0 * damping * loop_bw + loop_bw * loop_bw);
43 alpha = (4 * damping * loop_bw) / denom;
44 beta = (4 * loop_bw * loop_bw) / denom;
49 nlohmann::ordered_json p;
50 add_param_simple(p,
"loop_bw",
"float");
51 add_param_simple(p,
"order",
"int");
52 add_param_simple(p,
"freq_limit",
"float");
60 else if (key ==
"order")
62 else if (key ==
"freq_limit")
65 throw satdump_exception(key);
75 else if (key ==
"order")
77 else if (key ==
"freq_limit")
83 throw satdump_exception(key);
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 costas.h:33
uint32_t process(complex_t *input, uint32_t nsamples, complex_t *output)
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usua...
Definition costas.cpp:12
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition costas.h:47
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 costas.h:68
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition costas.h:56