SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
uchar_to_float.h
1#pragma once
2
3#include "dsp/block_simple.h"
4
5namespace satdump
6{
7 namespace ndsp
8 {
9 class UCharToFloatBlock : public BlockSimple<uint8_t, float>
10 {
11 private:
12 float scale = 1.0;
13
14 public:
15 uint32_t process(uint8_t *input, uint32_t nsamples, float *output);
16
17 public:
18 UCharToFloatBlock();
19 ~UCharToFloatBlock();
20
21 void init() {}
22
23 nlohmann::ordered_json get_cfg_list()
24 {
25 nlohmann::ordered_json p;
26 add_param_simple(p, "scale", "float");
27 return p;
28 }
29
30 nlohmann::json get_cfg(std::string key)
31 {
32 if (key == "scale")
33 return scale;
34 else
35 throw satdump_exception(key);
36 }
37
38 cfg_res_t set_cfg(std::string key, nlohmann::json v)
39 {
40 if (key == "scale")
41 scale = v;
42 else
43 throw satdump_exception(key);
44 return RES_OK;
45 }
46 };
47 } // namespace ndsp
48} // namespace satdump
cfg_res_t
set_cfg status.
Definition block.h:241
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 uchar_to_float.h:38
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition uchar_to_float.h:21
uint32_t process(uint8_t *input, uint32_t nsamples, float *output)
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usua...
Definition uchar_to_float.cpp:13
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition uchar_to_float.h:23
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition uchar_to_float.h:30