21#ifndef SBL_CONTROL_INPUT_POT_HPP_
22#define SBL_CONTROL_INPUT_POT_HPP_
54 : filter_(static_cast<uint8_t>(config.smoothing)), deadband_(config.deadband) {}
65 float delta = s - stable_value_;
69 if (delta >= deadband_) {
82 void update_dma(
const uint16_t* buffer, uint8_t channel_index) {
83 update(
static_cast<const volatile uint16_t*
>(buffer)[channel_index]);
87 float value()
const {
return stable_value_; }
96 return static_cast<float>(calibration_.
normalize(filter_.
value())) *
97 (1.0f /
static_cast<float>(PotCalibration::OUTPUT_MAX));
101 uint16_t
raw()
const {
return raw_; }
124 stable_value_ = 0.0f;
133 float stable_value_ = 0.0f;
134 bool changed_ =
false;
Exponentially Weighted Moving Average filter.
Two-point ADC calibration.