mirror of
https://github.com/esphome/esphome.git
synced 2025-09-11 07:42:26 +01:00
[ESP32] ADC auto-range setting (#2541)
This commit is contained in:
committed by
GitHub
parent
bcc77c73e1
commit
e79f7ce290
@@ -18,6 +18,7 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
|
||||
#ifdef USE_ESP32
|
||||
/// Set the attenuation for this pin. Only available on the ESP32.
|
||||
void set_attenuation(adc_atten_t attenuation);
|
||||
void set_autorange(bool autorange);
|
||||
#endif
|
||||
|
||||
/// Update adc values.
|
||||
@@ -36,9 +37,12 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
|
||||
|
||||
protected:
|
||||
InternalGPIOPin *pin_;
|
||||
uint16_t read_raw_();
|
||||
uint32_t raw_to_microvolts_(uint16_t raw);
|
||||
|
||||
#ifdef USE_ESP32
|
||||
adc_atten_t attenuation_{ADC_ATTEN_DB_0};
|
||||
bool autorange_{false};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user