mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
ESP32: Espressif deprecated ADC_ATTEN_DB_11
This commit is contained in:
parent
5f65fd5944
commit
fba9a30813
|
@ -297,7 +297,12 @@ void DCCTimer::DCCEXInrushControlOn(uint8_t pin, int duty, bool inverted) {
|
||||||
int ADCee::init(uint8_t pin) {
|
int ADCee::init(uint8_t pin) {
|
||||||
pinMode(pin, ANALOG);
|
pinMode(pin, ANALOG);
|
||||||
adc1_config_width(ADC_WIDTH_BIT_12);
|
adc1_config_width(ADC_WIDTH_BIT_12);
|
||||||
|
// Espressif deprecated ADC_ATTEN_DB_11 somewhere between 2.0.9 and 2.0.17
|
||||||
|
#ifdef ADC_ATTEN_11db
|
||||||
|
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_11db);
|
||||||
|
#else
|
||||||
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_DB_11);
|
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_DB_11);
|
||||||
|
#endif
|
||||||
return adc1_get_raw(pinToADC1Channel(pin));
|
return adc1_get_raw(pinToADC1Channel(pin));
|
||||||
}
|
}
|
||||||
int16_t ADCee::ADCmax() {
|
int16_t ADCee::ADCmax() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user