24#ifndef SBL_CONTROL_INPUT_CV_INPUT_HPP_
25#define SBL_CONTROL_INPUT_CV_INPUT_HPP_
83 return {e.counts_max(),
static_cast<float>(e.
midpoint()), e.
inverted, e.counts_per_volt()};
104 explicit CvInput(
const CvInputConfig& config = {}) : filter_(static_cast<uint8_t>(config.smoothing)), raw_(0) {}
110 explicit CvInput(
Smoothing smoothing) : filter_(static_cast<uint8_t>(smoothing)), raw_(0) {}
131 void update_dma(
const uint16_t* buffer, uint8_t channel_index) {
132 update(
static_cast<const volatile uint16_t*
>(buffer)[channel_index]);
136 uint16_t
raw()
const {
return raw_; }
144 CvMapping mapping()
const {
return mapping_; }
164 float map(uint16_t counts)
const {
165 float c =
static_cast<float>(counts);
172 return (t < 0.0f) ? 0.0f : (t > 1.0f) ? 1.0f : t;
179 return (b < -1.0f) ? -1.0f : (b > 1.0f) ? 1.0f : b;
196 CvConditioning cond_{};
Electrical description of an analog port - the jack-to-converter circuit.
Exponentially Weighted Moving Average filter.
constexpr uint16_t midpoint() const