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::hal::adc::Electrical Struct Reference

Detailed Description

Definition at line 25 of file electrical.hpp.

#include <electrical.hpp>

Public Member Functions

constexpr float counts_max () const
 
constexpr float counts_per_volt () const
 
constexpr uint16_t encode (float volts) const
 Code for a voltage at the jack, clamped to the converter's rails.
 
constexpr float decode (uint16_t counts) const
 Voltage at the jack for a code.
 
constexpr uint16_t midpoint () const
 Code that reads as 0 V — the bipolar midpoint. Clamps if 0 V is out of range.
 

Public Attributes

float lo_v
 Voltage at code 0 (or at full scale, if inverted)
 
float hi_v
 Voltage at full scale (or at code 0, if inverted)
 
uint8_t bits
 Converter resolution.
 
bool inverted
 +V at the jack reads as a lower code
 

Member Function Documentation

◆ counts_max()

constexpr float sbl::hal::adc::Electrical::counts_max ( ) const
inlineconstexpr

Definition at line 31 of file electrical.hpp.

References bits.

Referenced by counts_per_volt(), decode(), encode(), and sbl::components::cv::CvConditioning::from().

◆ counts_per_volt()

constexpr float sbl::hal::adc::Electrical::counts_per_volt ( ) const
inlineconstexpr

Definition at line 35 of file electrical.hpp.

References counts_max(), hi_v, and lo_v.

Referenced by sbl::components::cv::CvConditioning::from().

◆ encode()

constexpr uint16_t sbl::hal::adc::Electrical::encode ( float  volts) const
inlineconstexpr

Code for a voltage at the jack, clamped to the converter's rails.

Definition at line 40 of file electrical.hpp.

References counts_max(), hi_v, inverted, and lo_v.

Referenced by midpoint().

◆ decode()

constexpr float sbl::hal::adc::Electrical::decode ( uint16_t  counts) const
inlineconstexpr

Voltage at the jack for a code.

Definition at line 49 of file electrical.hpp.

References counts_max(), hi_v, inverted, and lo_v.

◆ midpoint()

constexpr uint16_t sbl::hal::adc::Electrical::midpoint ( ) const
inlineconstexpr

Code that reads as 0 V — the bipolar midpoint. Clamps if 0 V is out of range.

Definition at line 56 of file electrical.hpp.

References encode().

Referenced by sbl::components::cv::CvConditioning::from().

Member Data Documentation

◆ lo_v

float sbl::hal::adc::Electrical::lo_v

Voltage at code 0 (or at full scale, if inverted)

Definition at line 26 of file electrical.hpp.

Referenced by counts_per_volt(), decode(), and encode().

◆ hi_v

float sbl::hal::adc::Electrical::hi_v

Voltage at full scale (or at code 0, if inverted)

Definition at line 27 of file electrical.hpp.

Referenced by counts_per_volt(), decode(), and encode().

◆ bits

uint8_t sbl::hal::adc::Electrical::bits

Converter resolution.

Definition at line 28 of file electrical.hpp.

Referenced by counts_max().

◆ inverted

bool sbl::hal::adc::Electrical::inverted

+V at the jack reads as a lower code

Definition at line 29 of file electrical.hpp.

Referenced by decode(), encode(), and sbl::components::cv::CvConditioning::from().


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