Analog Digital Converter (ADC)#
Hardware Interface#
Defined in namespace hal
#include <libhal/adc.hpp>
-
class adc#
Analog to Digital Converter (ADC) hardware abstraction interface.
Use this interface for devices and peripherals that can convert analog voltage signals into a digital number.
ADC peripheral only know the proportion of a voltage signal relative to a Vss (negative reference) and a Vcc (positive reference) and thus cannot describe the voltage directly.
Subclassed by hal::inert_adc, hal::lpc40::adc, hal::mock::adc, hal::soft::adc_mux_pin, hal::soft::inert_adc
Public Functions
-
inline float read()#
Sample the analog to digital converter and return the result.
Is guaranteed by the implementing driver to be between 0.0f and +1.0f. The value representing the voltage measured by the ADC from Vss (negative reference) to Vcc (positive reference). For example, if Vss is 0V (gnd) and Vcc is 5V and this value is 0.5f, then the voltage measured is 2.5V.
- Returns:
float - the sampled adc value
-
inline float read()#