13 #ifndef SCARAB_DIGITAL_HH_ 14 #define SCARAB_DIGITAL_HH_ 43 template<
typename dig_type,
typename an_type >
52 template<
typename an_type,
typename dig_type >
56 if( analog > (an_type)(params->
levels - 1) ) analog = params->
levels - 1;
57 else if( analog < 0. ) analog = 0.;
58 return (dig_type)analog;
63 #endif // SCARAB_DIGITAL_HH_
void get_calib_params2(unsigned n_bits, unsigned data_type_size, double v_offset, double v_range, double dac_gain, bool bits_r_aligned, dig_calib_params *params)
an_type d2a(dig_type dig, const struct dig_calib_params *params)
dig_type a2d(an_type analog, const struct dig_calib_params *params)
void get_calib_params(unsigned n_bits, unsigned data_type_size, double v_offset, double v_range, bool bits_r_aligned, dig_calib_params *params)