diff --git a/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.c b/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.c index c30531ae17..312159f719 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.c +++ b/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.c @@ -38,6 +38,7 @@ #include "esp32s2_rtc_gpio.h" #include "hardware/esp32s2_rtc_io.h" #include "hardware/esp32s2_sens.h" +#include "driver/rtc_io.h" /**************************************************************************** * Pre-processor Definitions @@ -342,6 +343,45 @@ int esp32s2_configrtcio(int rtcio_num, rtcio_pinattr_t attr) return OK; } +/**************************************************************************** + * Name: esp32s2_rtcioread + * + * Description: + * Read one or zero from the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - RTCIO rtcio_num to be read. + * + * Returned Value: + * The boolean representation of the input value (true/false). + * + ****************************************************************************/ + +int esp32s2_rtcioread(int rtcio_num) +{ + return rtc_gpio_get_level(rtcio_num); +} + +/**************************************************************************** + * Name: esp32s2_rtciowrite + * + * Description: + * Write one or zero to the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - GPIO pin to be modified. + * value - The value to be written (0 or 1). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void esp32s2_rtciowrite(int rtcio_num, bool value) +{ + rtc_gpio_set_level(rtcio_num, value); +} + /**************************************************************************** * Name: esp32s2_rtcioirqinitialize * diff --git a/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.h b/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.h index 9a91cd4aa9..5f46508790 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.h +++ b/arch/xtensa/src/esp32s2/esp32s2_rtc_gpio.h @@ -574,6 +574,39 @@ static const rtc_io_desc_t g_rtc_io_desc[RTC_GPIO_NUMBER] = int esp32s2_configrtcio(int rtcio_num, rtcio_pinattr_t attr); +/**************************************************************************** + * Name: esp32s2_rtcioread + * + * Description: + * Read one or zero from the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - RTCIO rtcio_num to be read. + * + * Returned Value: + * The boolean representation of the input value (true/false). + * + ****************************************************************************/ + +int esp32s2_rtcioread(int rtcio_num); + +/**************************************************************************** + * Name: esp32s2_rtciowrite + * + * Description: + * Write one or zero to the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - GPIO pin to be modified. + * value - The value to be written (0 or 1). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void esp32s2_rtciowrite(int rtcio_num, bool value); + /**************************************************************************** * Name: esp32s2_rtcioirqinitialize * diff --git a/arch/xtensa/src/esp32s2/hal.mk b/arch/xtensa/src/esp32s2/hal.mk index e4b2e5a2b5..6afa260643 100644 --- a/arch/xtensa/src/esp32s2/hal.mk +++ b/arch/xtensa/src/esp32s2/hal.mk @@ -183,6 +183,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)pcnt_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c +CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rtc_io_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)sdm_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2c_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2s_periph.c diff --git a/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.c b/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.c index 16dc36ff02..0e082379ef 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.c +++ b/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.c @@ -40,6 +40,7 @@ #include "hardware/esp32s3_rtc_io.h" #include "hardware/esp32s3_sens.h" #include "hardware/esp32s3_usb_serial_jtag.h" +#include "driver/rtc_io.h" /**************************************************************************** * Pre-processor Definitions @@ -386,6 +387,45 @@ int esp32s3_configrtcio(int rtcio_num, rtcio_pinattr_t attr) return OK; } +/**************************************************************************** + * Name: esp32s3_rtcioread + * + * Description: + * Read one or zero from the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - RTCIO rtcio_num to be read. + * + * Returned Value: + * The boolean representation of the input value (true/false). + * + ****************************************************************************/ + +int esp32s3_rtcioread(int rtcio_num) +{ + return rtc_gpio_get_level(rtcio_num); +} + +/**************************************************************************** + * Name: esp32s3_rtciowrite + * + * Description: + * Write one or zero to the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - GPIO pin to be modified. + * value - The value to be written (0 or 1). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void esp32s3_rtciowrite(int rtcio_num, bool value) +{ + rtc_gpio_set_level(rtcio_num, value); +} + /**************************************************************************** * Name: esp32s3_rtcioirqinitialize * diff --git a/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.h b/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.h index 26197c56c9..0700f2e68a 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.h +++ b/arch/xtensa/src/esp32s3/esp32s3_rtc_gpio.h @@ -575,6 +575,39 @@ static const rtc_io_desc_t g_rtc_io_desc[RTC_GPIO_NUMBER] = int esp32s3_configrtcio(int rtcio_num, rtcio_pinattr_t attr); +/**************************************************************************** + * Name: esp32s3_rtcioread + * + * Description: + * Read one or zero from the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - RTCIO rtcio_num to be read. + * + * Returned Value: + * The boolean representation of the input value (true/false). + * + ****************************************************************************/ + +int esp32s3_rtcioread(int rtcio_num); + +/**************************************************************************** + * Name: esp32s3_rtciowrite + * + * Description: + * Write one or zero to the selected RTC GPIO pin + * + * Input Parameters: + * rtcio_num - GPIO pin to be modified. + * value - The value to be written (0 or 1). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void esp32s3_rtciowrite(int rtcio_num, bool value); + /**************************************************************************** * Name: esp32s3_rtcioirqinitialize * diff --git a/arch/xtensa/src/esp32s3/hal.mk b/arch/xtensa/src/esp32s3/hal.mk index 74d8bfbb54..d5140c8914 100644 --- a/arch/xtensa/src/esp32s3/hal.mk +++ b/arch/xtensa/src/esp32s3/hal.mk @@ -182,6 +182,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)ledc_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)pcnt_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rmt_periph.c +CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)rtc_io_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)sdm_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2c_periph.c CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)$(CHIP_SERIES)$(DELIM)i2s_periph.c