38 namespace strain {
namespace dsp {
40 using FSC = std::uint16_t;
41 using Q15 = std::int16_t;
46 namespace strain {
namespace dsp {
namespace fsc {
54 bool convert(
const std::vector<double> &in, std::vector<FSC> &
out);
55 bool convert(
const std::vector<FSC> &in, std::vector<double> &
out);
59 namespace strain {
namespace dsp {
namespace q15 {
77 bool convert(
const std::vector<double> &in, std::vector<Q15> &
out);
78 bool convert(
const std::vector<Q15> &in, std::vector<double> &
out);
109 bool multiply(
const matrix &m1,
const matrix &m2, matrix &res,
bool &saturated);
110 bool add(
const matrix &m1,
const matrix &m2, matrix &res,
bool &saturated);
116 namespace strain {
namespace amplifier {
128 enum class DiscreteGain {
val256 = 0,
val128 = 1,
val96 = 2,
val64 = 3,
val48 = 4,
val36 = 5,
val24 = 6,
val20 = 7,
val16 = 8,
val10 = 9,
val08 = 10,
val06 = 11,
val04 = 12,
none = 32,
maxnumberof = 13 };
164 bool convert(
const WideParams &wp, DiscreteParams &dp);
173 virtual std::uint8_t
size() = 0;
212 bool import(
const Registers ®s,
WideParams *wideparams =
nullptr);
215 bool import(
const DiscreteParams &discreteparams, Registers *regs =
nullptr);
216 bool get(Registers ®s);
226 bool load(
const Registers ®s);
247 void testIT(std::string &output);
256 namespace strain {
namespace regulation {
334 bool read(
const std::string filename, FullRegulation ®);
virtual std::uint8_t size()=0
virtual bool load(const void *data, const size_t size)=0
virtual bool fill(void *data, size_t &size)=0
static const std::uint8_t defval[sizeofregisters]
virtual bool load(const void *data, const size_t size)
static const std::uint8_t sizeofregisters
std::uint8_t Voffsetcoarse
virtual std::uint8_t size()
Registers(void *data, size_t size)
virtual bool fill(void *data, size_t &size)
bool get(DiscreteParams &discreteparams)
bool load(const Registers ®s)
bool get(WideParams &wideparams)
const Offset minimumOffset
const Offset maximumOffset
Gain convert(const DiscreteGain dg)
void testIT(std::string &output)
const Offset midrangeOffset
FSC convert(const double v, bool &saturated)
std::uint16_t Q15toU16(const Q15 valQ15)
Q15 saturate(const Q15result x, bool &saturated)
Q15 convert(const double v, bool &saturated)
bool multiply(const matrix &m1, const matrix &m2, matrix &res, bool &saturated)
Q15 div(const Q15 a, const Q15 b, bool &saturated)
Q15 mul(const Q15 a, const Q15 b, bool &saturated)
Q15 U16toQ15(const std::uint16_t valU16)
Q15 opposite(const Q15 v)
Q15 add(const Q15 a, const Q15 b)
const std::uint8_t maxSets
bool write(const std::string filename, const FullRegulation ®)
bool apply(cDownloader *down, const FullRegulation ®)
bool read(const std::string fname, FullRegulation ®)
const std::uint8_t numberofchannels
void load(DiscreteGain _dg, Offset _o)
void load(DiscreteGain _dg, Offset _o)
void load(const DiscreteParams &_dp)
void load(Gain _g, Offset _o)
void set(std::uint8_t r, std::uint8_t c, Q15 v)
Q15 get(std::uint8_t r, std::uint8_t c)
matrix(std::uint8_t r, std::uint8_t c, Q15 *d)
void load(std::uint8_t r, std::uint8_t c, Q15 *d)
std::uint8_t offset[strain::numberofchannels]
std::uint8_t amplregs[strain::numberofchannels][strain::amplifier::PGA308::Registers::sizeofregisters]
strain::dsp::Q15 matrix[strain::numberofchannels *strain::numberofchannels]
strain::dsp::FSC fullscale[strain::numberofchannels]
std::uint16_t tare[strain::numberofchannels]
std::uint8_t set2useatbootstrap