Skip to content

Commit 1688b7c

Browse files
authored
Fix analogWidth for ESP32S2 in esp32-hal-adc.c (espressif#5711)
1 parent 36ff442 commit 1688b7c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: cores/esp32/esp32-hal-adc.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static uint8_t __analogVRefPin = 0;
3737
#include "soc/rtc_io_reg.h"
3838
#elif CONFIG_IDF_TARGET_ESP32C3
3939
#include "esp32c3/rom/ets_sys.h"
40-
#else
40+
#else
4141
#error Target CONFIG_IDF_TARGET is not supported
4242
#endif
4343
#else // ESP32 Before IDF 4.0
@@ -46,7 +46,11 @@ static uint8_t __analogVRefPin = 0;
4646
#endif
4747

4848
static uint8_t __analogAttenuation = 3;//11db
49-
static uint8_t __analogWidth = 3;//12 bits
49+
#if CONFIG_IDF_TARGET_ESP32S2
50+
static uint8_t __analogWidth = 4; // 13 bits
51+
#else
52+
static uint8_t __analogWidth = 3; // 12 bits
53+
#endif
5054
static uint8_t __analogClockDiv = 1;
5155
static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT];
5256

0 commit comments

Comments
 (0)