Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::control::input::PotCalibration Struct Reference

Detailed Description

Definition at line 26 of file pot_calibration.hpp.

Public Member Functions

uint32_t normalize (uint32_t raw) const
 

Static Public Member Functions

static PotCalibration from_two_point (uint32_t ccw_reading, uint32_t cw_reading)
 
static constexpr PotCalibration default_patch_init ()
 
static constexpr PotCalibration default_full_range ()
 

Public Attributes

uint32_t raw_min = 0
 
uint32_t raw_max = 65535
 
bool inverted = false
 

Static Public Attributes

static constexpr uint32_t OUTPUT_MAX = 65535
 

Member Function Documentation

◆ normalize()

uint32_t sbl::control::input::PotCalibration::normalize ( uint32_t  raw) const
inline

Normalize raw ADC reading to [0, OUTPUT_MAX], clamped.

Definition at line 34 of file pot_calibration.hpp.

References inverted, raw_max, and raw_min.

Referenced by sbl::control::input::Pot::smoothed().

◆ from_two_point()

static PotCalibration sbl::control::input::PotCalibration::from_two_point ( uint32_t  ccw_reading,
uint32_t  cw_reading 
)
inlinestatic

Build calibration from measured CCW and CW ADC readings. Automatically detects inversion (if CCW reading > CW reading).

Definition at line 55 of file pot_calibration.hpp.

◆ default_patch_init()

static constexpr PotCalibration sbl::control::input::PotCalibration::default_patch_init ( )
inlinestaticconstexpr

Preset for an inverted pot spanning raw counts 0 to 33000.

Definition at line 61 of file pot_calibration.hpp.

◆ default_full_range()

static constexpr PotCalibration sbl::control::input::PotCalibration::default_full_range ( )
inlinestaticconstexpr

Default full-range (no calibration needed).

Definition at line 64 of file pot_calibration.hpp.

Member Data Documentation

◆ OUTPUT_MAX

constexpr uint32_t sbl::control::input::PotCalibration::OUTPUT_MAX = 65535
staticconstexpr

Definition at line 27 of file pot_calibration.hpp.

◆ raw_min

uint32_t sbl::control::input::PotCalibration::raw_min = 0

ADC reading at logical minimum (CCW after inversion)

Definition at line 29 of file pot_calibration.hpp.

Referenced by normalize().

◆ raw_max

uint32_t sbl::control::input::PotCalibration::raw_max = 65535

ADC reading at logical maximum (CW after inversion)

Definition at line 30 of file pot_calibration.hpp.

Referenced by normalize().

◆ inverted

bool sbl::control::input::PotCalibration::inverted = false

true if high ADC value = CCW (knob turned left)

Definition at line 31 of file pot_calibration.hpp.

Referenced by normalize().


The documentation for this struct was generated from the following file: