diff --git a/esphome/components/adc/__init__.py b/esphome/components/adc/__init__.py index b7dabc37c1..87d769fec2 100644 --- a/esphome/components/adc/__init__.py +++ b/esphome/components/adc/__init__.py @@ -1,13 +1,7 @@ import esphome.codegen as cg import esphome.config_validation as cv from esphome import pins -from esphome.const import ( - CONF_ANALOG, - CONF_INPUT, - CONF_NUMBER, - KEY_CORE, - KEY_TARGET_FRAMEWORK, -) +from esphome.const import CONF_ANALOG, CONF_INPUT, CONF_NUMBER from esphome.core import CORE from esphome.components.esp32 import get_esp32_variant @@ -199,21 +193,4 @@ def validate_adc_pin(value): {CONF_ANALOG: True, CONF_INPUT: True}, internal=True )(value) - if CORE.is_nrf52: - if CORE.data[KEY_CORE][KEY_TARGET_FRAMEWORK] == "zephyr": - # TODO - raise cv.Invalid( - f"ADC is not imlemented on {CORE.data[KEY_CORE][KEY_TARGET_FRAMEWORK]}" - ) - - conf = pins.gpio_pin_schema( - {CONF_ANALOG: True, CONF_INPUT: True}, internal=True - )(value) - number = conf[CONF_NUMBER] - if number not in (2, 3, 4, 5, 28, 29, 30, 31): - raise cv.Invalid( - "nRF52840: Only pins 2, 3, 4, 5, 28, 29, 30 and 31 support ADC" - ) - return conf - raise NotImplementedError diff --git a/esphome/components/adc/adc_sensor.cpp b/esphome/components/adc/adc_sensor.cpp index 7394237a06..a9ac5a5cfe 100644 --- a/esphome/components/adc/adc_sensor.cpp +++ b/esphome/components/adc/adc_sensor.cpp @@ -294,23 +294,6 @@ float ADCSensor::sample() { } #endif // USE_LIBRETINY -#if defined(USE_NRF52) && defined(USE_ARDUINO) -float ADCSensor::sample() { - // https://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.1.pdf - // 6.23.2 Reference voltage and gain settings - // Default settings are internal reference with 1/6 gain (GND..3.6V ADC range) - // With internal reference, single-ended input (grounded negative input) and a gain of 1/6, the input range will be: - // Input range = (0.6 V)/(1/6) = 3.6 V - - uint32_t raw = analogRead(this->pin_->get_pin()); // NOLINT - if (output_raw_) { - return raw; - } - // default 10-bit resolution - return raw * 3.6f / 1024.0f; -} -#endif // USE_NRF52 - #ifdef USE_ESP8266 std::string ADCSensor::unique_id() { return get_mac_address() + "-adc"; } #endif diff --git a/esphome/components/nrf52/gpio.py b/esphome/components/nrf52/gpio.py index 9ceafbd837..8aa311fb6b 100644 --- a/esphome/components/nrf52/gpio.py +++ b/esphome/components/nrf52/gpio.py @@ -7,7 +7,6 @@ from esphome.const import ( CONF_MODE, CONF_INVERTED, CONF_NUMBER, - CONF_ANALOG, ) nrf52_ns = cg.esphome_ns.namespace("nrf52") @@ -43,9 +42,7 @@ def validate_gpio_pin(value): NRF52_PIN_SCHEMA = cv.All( pins.gpio_base_schema( - NRF52GPIOPin, - validate_gpio_pin, - modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,), + NRF52GPIOPin, validate_gpio_pin, modes=pins.GPIO_STANDARD_MODES ), )