|
SensESP 3.6.1-alpha
Universal Signal K sensor toolkit ESP32
|
Calibrated analog reader for the ESP32 family. More...
#include <sensesp/sensors/analog_reader.h>
Public Member Functions | |
| ESP32AnalogReader (int pin, float max_voltage=kDefaultMaxVoltage) | |
| float | read () override |
| Read the input as a fraction of the full-scale reference voltage. | |
Public Member Functions inherited from sensesp::BaseAnalogReader | |
| virtual | ~BaseAnalogReader ()=default |
Static Public Attributes | |
| static constexpr float | kDefaultMaxVoltage = 3300. |
| The nominal 3.3 V supply voltage, in millivolts. | |
Protected Attributes | |
| int | pin_ |
| float | max_voltage_ |
Calibrated analog reader for the ESP32 family.
Reads the pin using the Arduino core's analogReadMilliVolts(), which applies the ESP-IDF factory ADC calibration, and normalizes the result against a reference voltage.
Definition at line 36 of file analog_reader.h.
|
inline |
| pin | The GPIO pin to read. |
| max_voltage | The full-scale reference voltage, in millivolts. Must be positive and finite; any other value would make read() return a meaningless fraction, so it is rejected in favour of the default. |
Definition at line 53 of file analog_reader.h.
|
inlineoverridevirtual |
Read the input as a fraction of the full-scale reference voltage.
Implements sensesp::BaseAnalogReader.
Definition at line 63 of file analog_reader.h.
|
staticconstexpr |
The nominal 3.3 V supply voltage, in millivolts.
Definition at line 39 of file analog_reader.h.
|
protected |
Definition at line 43 of file analog_reader.h.
|
protected |
Definition at line 42 of file analog_reader.h.