Potentiometer with EWMA smoothing, calibration and deadband.
- Note
- All public methods are ISR-safe — pure state machine, no hardware I/O; 32-bit stores are atomic on Cortex-M. Call update from exactly one context.
Definition at line 44 of file pot.hpp.
|
| | Pot (const PotConfig &config={}) |
| |
| void | update (uint16_t raw) |
| | Feed a new raw ADC sample through EWMA → calibration → deadband.
|
| |
| void | update_dma (const uint16_t *buffer, uint8_t channel_index) |
| | Read one channel from a DMA scan buffer and update (ISR-safe)
|
| |
| float | value () const |
| | Stable (deadbanded) value in su [0, 1].
|
| |
| float | smoothed () const |
| | Calibrated, smoothed value in su [0, 1] — no deadband.
|
| |
| uint16_t | raw () const |
| | Last raw (unfiltered) ADC count — for calibration routines.
|
| |
| void | set_calibration (PotCalibration cal) |
| | Apply two-point calibration.
|
| |
| bool | changed () |
| | True if value moved past deadband since last check.
|
| |
| void | set_deadband (float deadband_su) |
| | Override deadband threshold in su (default: 0.001)
|
| |
| void | reset () |
| | Reset all state (filter, stable value, changed flag)
|
| |