Architecture specific ADC functions for ESP32. More...
Architecture specific ADC functions for ESP32.
Definition in file adc_arch.h.
Go to the source code of this file.
Enumerations | |
enum | adc_attenuation_t { ADC_ATTENUATION_0_DB = 0, ADC_ATTENUATION_3_DB, ADC_ATTENUATION_6_DB, ADC_ATTENUATION_11_DB } |
Attenuations that can be set for ADC lines. More... | |
Functions | |
int | adc_set_attenuation (adc_t line, adc_attenuation_t atten) |
Set the attenuation for the ADC line. More... | |
int | adc_vref_to_gpio25 (void) |
Output ADC reference voltage to GPIO25. More... | |
enum adc_attenuation_t |
Attenuations that can be set for ADC lines.
Definition at line 33 of file adc_arch.h.
int adc_set_attenuation | ( | adc_t | line, |
adc_attenuation_t | atten | ||
) |
Set the attenuation for the ADC line.
Default attenuation is 11 dB.
For each ADC line, an attenuation of the input signal can be defined separately. This results in different full ranges of the measurable voltage at the input. The attenuation can be set to 0 dB, 3 dB, 6 dB and 11 dB, with 11 dB being the standard attenuation. Since an ADC input is measured against a reference voltage Vref of 1.1 V, approximately the following measurement ranges are given when using a corresponding attenuation:
Attenuation | Voltage Range | Symbol |
---|---|---|
0 dB | 0 ... 1.1V (Vref) | ADC_ATTENUATION_0_DB |
3 dB | 0 ... 1.5V | ADC_ATTENUATION_3_DB |
6 dB | 0 ... 2.2V | ADC_ATTENUATION_6_DB |
11 dB (default) | 0 ... 3.3V | ADC_ATTENUATION_11_DB |
Please note: The reference voltage Vref can vary from device to device in the range of 1.0V and 1.2V. The Vref of a device can be read with the function adc_vref_to_gpio25 at the pin GPIO 25. The results of the ADC input can then be adjusted accordingly.
line | ADC line for which the attenuation is set |
atten | Attenuation, see type definition of *adc_attenuation_t |
int adc_vref_to_gpio25 | ( | void | ) |
Output ADC reference voltage to GPIO25.