diff --git a/cpu/esp32/include/adc_ctrl.h b/cpu/esp32/include/adc_ctrl.h index 812cb00cc8..856fa7cd40 100644 --- a/cpu/esp32/include/adc_ctrl.h +++ b/cpu/esp32/include/adc_ctrl.h @@ -83,16 +83,6 @@ struct _adc_hw_t { */ extern const struct _adc_hw_t _adc_hw[]; -/** - * @brief Configure sleep mode for an GPIO pin if the pin is a RTCIO pin - * @param pin GPIO pin - * @param mode active in sleep mode if true - * @param input as input if true, as output otherwise - * @return 0 success - * @return -1 on invalid pin - */ -int rtcio_config_sleep_mode (gpio_t pin, bool mode, bool input); - #ifdef __cplusplus } #endif diff --git a/cpu/esp32/include/gpio_arch.h b/cpu/esp32/include/gpio_arch.h index a773e86caa..07fe7072ba 100644 --- a/cpu/esp32/include/gpio_arch.h +++ b/cpu/esp32/include/gpio_arch.h @@ -48,17 +48,7 @@ void gpio_pullup_dis (gpio_t pin); int8_t gpio_is_rtcio (gpio_t pin); /** - * @brief Configure sleep mode for an GPIO pin if the pin is an RTCIO pin - * @param pin GPIO pin - * @param mode active in sleep mode if true - * @param input as input if true, as output otherwise - * @return 0 on success - * @return -1 on invalid pin - */ -int gpio_config_sleep_mode (gpio_t pin, bool sleep_mode, bool input); - -/** - * @brief GPIO set direction init the pin calling gpio_init + * @brief Set the direction of a pin (initializes the pin calling gpio_init) * @param pin GPIO pin * @param mode active in sleep mode if true * @return 0 on success diff --git a/cpu/esp32/periph/adc_ctrl.c b/cpu/esp32/periph/adc_ctrl.c index 876af31eaa..9c5422e4f0 100644 --- a/cpu/esp32/periph/adc_ctrl.c +++ b/cpu/esp32/periph/adc_ctrl.c @@ -167,85 +167,3 @@ void _adc2_ctrl_init(void) _adc2_ctrl_initialized = true; } - -int rtcio_config_sleep_mode (gpio_t pin, bool mode, bool input) -{ - CHECK_PARAM_RET(pin < GPIO_PIN_NUMOF, -1); - - uint8_t rtcio = _gpio_rtcio_map[pin]; - uint8_t idx; - - /* route pads to RTC and if possible, disable input, pull-up/pull-down */ - switch (rtcio) { - case RTCIO_SENSOR_SENSE1: /* GPIO36, RTC0 */ - RTCIO.sensor_pads.sense1_mux_sel = 1; /* route to RTC */ - RTCIO.sensor_pads.sense1_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.sensor_pads.sense1_slp_sel = mode; /* sleep mode */ - RTCIO.sensor_pads.sense1_slp_ie = input; /* input enabled */ - break; - case RTCIO_SENSOR_SENSE2: /* GPIO37, RTC1 */ - RTCIO.sensor_pads.sense2_mux_sel = 1; /* route to RTC */ - RTCIO.sensor_pads.sense2_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.sensor_pads.sense2_slp_sel = mode; /* sleep mode */ - RTCIO.sensor_pads.sense2_slp_ie = input; /* input enabled */ - break; - case RTCIO_SENSOR_SENSE3: /* GPIO38, RTC2 */ - RTCIO.sensor_pads.sense3_mux_sel = 1; /* route to RTC */ - RTCIO.sensor_pads.sense3_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.sensor_pads.sense3_slp_sel = mode; /* sleep mode */ - RTCIO.sensor_pads.sense3_slp_ie = input; /* input enabled */ - break; - case RTCIO_SENSOR_SENSE4: /* GPIO39, RTC3 */ - RTCIO.sensor_pads.sense4_mux_sel = 1; /* route to RTC */ - RTCIO.sensor_pads.sense4_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.sensor_pads.sense4_slp_sel = mode; /* sleep mode */ - RTCIO.sensor_pads.sense4_slp_ie = input; /* input enabled */ - break; - - case RTCIO_TOUCH0: /* GPIO4, RTC10 */ - case RTCIO_TOUCH1: /* GPIO0, RTC11 */ - case RTCIO_TOUCH2: /* GPIO2, RTC12 */ - case RTCIO_TOUCH3: /* GPIO15, RTC13 */ - case RTCIO_TOUCH4: /* GPIO13, RTC14 */ - case RTCIO_TOUCH5: /* GPIO12, RTC15 */ - case RTCIO_TOUCH6: /* GPIO14, RTC16 */ - case RTCIO_TOUCH7: /* GPIO27, RTC17 */ - case RTCIO_TOUCH8: /* GPIO33, RTC8 */ - case RTCIO_TOUCH9: /* GPIO32, RTC9 */ - idx = rtcio - RTCIO_TOUCH0; - RTCIO.touch_pad[idx].mux_sel = 1; /* route to RTC */ - RTCIO.touch_pad[idx].fun_sel = 0; /* RTC mux function 0 */ - RTCIO.touch_pad[idx].slp_sel = mode; /* sleep mode */ - RTCIO.touch_pad[idx].slp_ie = input; /* input enabled */ - RTCIO.touch_pad[idx].slp_oe = ~input; /* output enabled*/ - break; - - case RTCIO_ADC_ADC1: /* GPIO34, RTC4 */ - RTCIO.adc_pad.adc1_mux_sel = 1; /* route to RTC */ - RTCIO.adc_pad.adc1_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.adc_pad.adc1_slp_sel = mode; /* sleep mode */ - RTCIO.adc_pad.adc1_slp_ie = input; /* input enabled */ - break; - case RTCIO_ADC_ADC2: /* GPIO35, RTC5 */ - RTCIO.adc_pad.adc2_mux_sel = 1; /* route to RTC */ - RTCIO.adc_pad.adc2_fun_sel = 0; /* RTC mux function 0 */ - RTCIO.adc_pad.adc2_slp_sel = mode; /* sleep mode */ - RTCIO.adc_pad.adc2_slp_ie = input; /* input enabled */ - break; - - case RTCIO_DAC1: /* GPIO25, RTC6 */ - case RTCIO_DAC2: /* GPIO26, RTC7 */ - idx = rtcio - RTCIO_DAC1; - RTCIO.pad_dac[idx].mux_sel = 1; /* route to RTC */ - RTCIO.pad_dac[idx].fun_sel = 0; /* RTC mux function 0 */ - RTCIO.pad_dac[idx].slp_sel = mode; /* sleep mode */ - RTCIO.pad_dac[idx].slp_ie = input; /* input enabled */ - RTCIO.pad_dac[idx].slp_oe = ~input; /* output enabled*/ - break; - default: - LOG_TAG_ERROR("gpio", "GPIO %d is not an RTCIO pin and " - "cannot be used in sleep mode\n", pin); - return -1; - } - return 0; -} diff --git a/cpu/esp32/periph/gpio.c b/cpu/esp32/periph/gpio.c index 75ee946d2c..743850bc9d 100644 --- a/cpu/esp32/periph/gpio.c +++ b/cpu/esp32/periph/gpio.c @@ -537,11 +537,6 @@ int8_t gpio_is_rtcio (gpio_t pin) return _gpio_to_rtc[pin]; } -int gpio_config_sleep_mode (gpio_t pin, bool mode, bool input) -{ - return rtcio_config_sleep_mode (pin, mode, input); -} - int gpio_set_direction(gpio_t pin, gpio_mode_t mode) { /* TODO implementation, for the moment we simply initialize the GPIO */