mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
Merge branch 'bugfix/gpio_8_16_bit_access' into 'master'
feat(gpio): add gpio_config_as_analog() API Closes IDF-10247 and IDFGH-12754 See merge request espressif/esp-idf!35856
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "ulp_lp_core_lp_adc_shared.h"
|
||||
#include "soc/adc_periph.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/rtc_io.h"
|
||||
#include "driver/temperature_sensor.h"
|
||||
|
||||
#include "unity.h"
|
||||
@@ -33,17 +34,17 @@ static void test_adc_set_io_level(adc_unit_t unit, adc_channel_t channel, bool l
|
||||
{
|
||||
TEST_ASSERT(channel < SOC_ADC_CHANNEL_NUM(unit) && "invalid channel");
|
||||
|
||||
#if !ADC_LL_RTC_GPIO_SUPPORTED
|
||||
uint32_t io_num = ADC_GET_IO_NUM(unit, channel);
|
||||
TEST_ESP_OK(gpio_set_pull_mode(io_num, (level ? GPIO_PULLUP_ONLY : GPIO_PULLDOWN_ONLY)));
|
||||
#else
|
||||
gpio_num_t io_num = ADC_GET_IO_NUM(unit, channel);
|
||||
if (level) {
|
||||
TEST_ESP_OK(rtc_gpio_pullup_en(io_num));
|
||||
TEST_ESP_OK(rtc_gpio_pulldown_dis(io_num));
|
||||
} else {
|
||||
TEST_ESP_OK(rtc_gpio_pullup_dis(io_num));
|
||||
TEST_ESP_OK(rtc_gpio_pulldown_en(io_num));
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
if (rtc_gpio_is_valid_gpio(io_num)) {
|
||||
if (level) {
|
||||
TEST_ESP_OK(rtc_gpio_pullup_en(io_num));
|
||||
TEST_ESP_OK(rtc_gpio_pulldown_dis(io_num));
|
||||
} else {
|
||||
TEST_ESP_OK(rtc_gpio_pullup_dis(io_num));
|
||||
TEST_ESP_OK(rtc_gpio_pulldown_en(io_num));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user