1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 08:12:22 +01:00

Support ADC on RP2040 (#4040)

This commit is contained in:
Jesse Hills
2022-11-17 13:51:08 +13:00
committed by GitHub
parent 65030e1c37
commit 719c212009
4 changed files with 69 additions and 2 deletions

View File

@@ -38,10 +38,18 @@ class ADCSensor : public sensor::Sensor, public PollingComponent, public voltage
std::string unique_id() override;
#endif
#ifdef USE_RP2040
void set_is_temperature() { is_temperature_ = true; }
#endif
protected:
InternalGPIOPin *pin_;
bool output_raw_{false};
#ifdef USE_RP2040
bool is_temperature_{false};
#endif
#ifdef USE_ESP32
adc_atten_t attenuation_{ADC_ATTEN_DB_0};
adc1_channel_t channel_{};