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

Detailed Description

Definition at line 25 of file pot_calibration.hpp.

#include <pot_calibration.hpp>

Public Member Functions

uint32_t normalize (uint32_t raw) const
 Normalize raw ADC reading to [0, kOutputMax], clamped.
 

Static Public Member Functions

static PotCalibration from_two_point (uint32_t ccw_reading, uint32_t cw_reading)
 
static constexpr PotCalibration default_patch_init ()
 Default for Daisy Patch.init() (inverted, ~0–33000 range).
 
static constexpr PotCalibration default_full_range ()
 Default full-range (no calibration needed).
 

Public Attributes

uint32_t raw_min = 0
 ADC reading at logical minimum (CCW after inversion)
 
uint32_t raw_max = 65535
 ADC reading at logical maximum (CW after inversion)
 
bool inverted = false
 true if high ADC value = CCW (knob turned left)
 

Static Public Attributes

static constexpr uint32_t kOutputMax = 65535
 

Member Function Documentation

◆ normalize()

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

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

Definition at line 33 of file pot_calibration.hpp.

References inverted, kOutputMax, raw_max, and raw_min.

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

◆ from_two_point()

static PotCalibration sbl::components::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 47 of file pot_calibration.hpp.

◆ default_patch_init()

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

Default for Daisy Patch.init() (inverted, ~0–33000 range).

Definition at line 57 of file pot_calibration.hpp.

◆ default_full_range()

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

Default full-range (no calibration needed).

Definition at line 62 of file pot_calibration.hpp.

Member Data Documentation

◆ kOutputMax

constexpr uint32_t sbl::components::input::PotCalibration::kOutputMax = 65535
staticconstexpr

Definition at line 26 of file pot_calibration.hpp.

Referenced by normalize(), and sbl::components::input::Pot::smoothed().

◆ raw_min

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

ADC reading at logical minimum (CCW after inversion)

Definition at line 28 of file pot_calibration.hpp.

Referenced by normalize().

◆ raw_max

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

ADC reading at logical maximum (CW after inversion)

Definition at line 29 of file pot_calibration.hpp.

Referenced by normalize().

◆ inverted

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

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

Definition at line 30 of file pot_calibration.hpp.

Referenced by normalize().


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