diff options
Diffstat (limited to 'ports/esp32/machine_adc.c')
-rw-r--r-- | ports/esp32/machine_adc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c index 4c19d5992..739d47da5 100644 --- a/ports/esp32/machine_adc.c +++ b/ports/esp32/machine_adc.c @@ -43,6 +43,7 @@ typedef struct _madc_obj_t { } madc_obj_t; STATIC const madc_obj_t madc_obj[] = { + #if CONFIG_IDF_TARGET_ESP32 {{&machine_adc_type}, GPIO_NUM_36, ADC1_CHANNEL_0}, {{&machine_adc_type}, GPIO_NUM_37, ADC1_CHANNEL_1}, {{&machine_adc_type}, GPIO_NUM_38, ADC1_CHANNEL_2}, @@ -51,6 +52,18 @@ STATIC const madc_obj_t madc_obj[] = { {{&machine_adc_type}, GPIO_NUM_33, ADC1_CHANNEL_5}, {{&machine_adc_type}, GPIO_NUM_34, ADC1_CHANNEL_6}, {{&machine_adc_type}, GPIO_NUM_35, ADC1_CHANNEL_7}, + #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + {{&machine_adc_type}, GPIO_NUM_1, ADC1_CHANNEL_0}, + {{&machine_adc_type}, GPIO_NUM_2, ADC1_CHANNEL_1}, + {{&machine_adc_type}, GPIO_NUM_3, ADC1_CHANNEL_2}, + {{&machine_adc_type}, GPIO_NUM_4, ADC1_CHANNEL_3}, + {{&machine_adc_type}, GPIO_NUM_5, ADC1_CHANNEL_4}, + {{&machine_adc_type}, GPIO_NUM_6, ADC1_CHANNEL_5}, + {{&machine_adc_type}, GPIO_NUM_7, ADC1_CHANNEL_6}, + {{&machine_adc_type}, GPIO_NUM_8, ADC1_CHANNEL_7}, + {{&machine_adc_type}, GPIO_NUM_9, ADC1_CHANNEL_8}, + {{&machine_adc_type}, GPIO_NUM_10, ADC1_CHANNEL_9}, + #endif }; STATIC uint8_t adc_bit_width; @@ -145,7 +158,7 @@ STATIC mp_obj_t madc_width(mp_obj_t cls_in, mp_obj_t width_in) { case ADC_WIDTH_12Bit: adc_bit_width = 12; break; - #elif CONFIG_IDF_TARGET_ESP32S2 + #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 case ADC_WIDTH_BIT_13: adc_bit_width = 13; break; @@ -175,7 +188,7 @@ STATIC const mp_rom_map_elem_t madc_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WIDTH_10BIT), MP_ROM_INT(ADC_WIDTH_10Bit) }, { MP_ROM_QSTR(MP_QSTR_WIDTH_11BIT), MP_ROM_INT(ADC_WIDTH_11Bit) }, { MP_ROM_QSTR(MP_QSTR_WIDTH_12BIT), MP_ROM_INT(ADC_WIDTH_12Bit) }, - #elif CONFIG_IDF_TARGET_ESP32S2 + #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 { MP_ROM_QSTR(MP_QSTR_WIDTH_13BIT), MP_ROM_INT(ADC_WIDTH_BIT_13) }, #endif }; |