A one-shot analog input on a single pin.
More...
A one-shot analog input on a single pin.
Claims the pin's ADC unit for the lifetime of the object. Move-only.
Definition at line 93 of file adc.hpp.
◆ input() [1/3]
| idfxx::adc::input::input |
( |
config |
config | ) |
|
|
explicit |
Constructs a one-shot analog input.
Resolves the ADC unit/channel from the pin, claims the unit, and sets up factory calibration when the chip provides it.
- Parameters
-
| config | Input configuration. |
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure (e.g. the pin is not ADC-capable or the unit is already claimed). |
◆ ~input()
| idfxx::adc::input::~input |
( |
| ) |
|
◆ input() [2/3]
| idfxx::adc::input::input |
( |
const input & |
| ) |
|
|
delete |
◆ input() [3/3]
| idfxx::adc::input::input |
( |
input && |
other | ) |
|
|
noexcept |
◆ attenuation()
| enum attenuation idfxx::adc::input::attenuation |
( |
| ) |
const |
|
noexcept |
Returns the configured input-range attenuation.
◆ calibrated()
| bool idfxx::adc::input::calibrated |
( |
| ) |
const |
|
noexcept |
Returns true when factory calibration is active for this input.
◆ divider()
Returns the configured external voltage-divider ratio.
◆ make()
Creates a one-shot analog input.
Resolves the ADC unit/channel from the pin, claims the unit, and sets up factory calibration when the chip provides it.
- Parameters
-
| config | Input configuration. |
- Returns
- The input, or an error.
- Return values
-
◆ operator=() [1/2]
| input & idfxx::adc::input::operator= |
( |
const input & |
| ) |
|
|
delete |
◆ operator=() [2/2]
| input & idfxx::adc::input::operator= |
( |
input && |
other | ) |
|
|
noexcept |
◆ pin()
Returns the configured pin.
◆ read_raw()
| int idfxx::adc::input::read_raw |
( |
| ) |
|
|
inline |
Reads the raw ADC conversion value.
- Returns
- The raw value (range depends on the chip's bit width).
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
| std::system_error | on failure. |
Definition at line 167 of file adc.hpp.
References try_read_raw(), and idfxx::unwrap().
◆ read_voltage()
| electro::millivolts idfxx::adc::input::read_voltage |
( |
| ) |
|
|
inline |
Reads the input voltage.
Returns the source voltage: the calibrated voltage at the pin, scaled by the configured config::divider (1:1 by default).
- Returns
- The calibrated, divider-scaled voltage.
- Note
- Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
- Exceptions
-
Definition at line 181 of file adc.hpp.
References try_read_voltage(), and idfxx::unwrap().
◆ try_read_raw()
| result< int > idfxx::adc::input::try_read_raw |
( |
| ) |
|
Reads the raw ADC conversion value.
- Returns
- The raw value, or an error.
Referenced by read_raw().
◆ try_read_voltage()
| result< electro::millivolts > idfxx::adc::input::try_read_voltage |
( |
| ) |
|
Reads the input voltage.
Returns the source voltage: the calibrated voltage at the pin, scaled by the configured config::divider (1:1 by default).
- Returns
- The calibrated, divider-scaled voltage, or an error.
- Return values
-
Referenced by read_voltage().
The documentation for this class was generated from the following file: