esp32: Extend support for S2 series, and S3 where applicable.

Improvements made:
- PSRAM support for S2
- partition definition for 16MiB flash
- correct ADC and DAC pins
- correct GPIO and IRQ pins
- S3 components in CMakeLists

Based on original commit made by Seon Rozenblum aka @UnexpectedMaker.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-05-06 10:58:12 +10:00
parent 4cdcbdb753
commit 5093d49fae
9 changed files with 201 additions and 16 deletions

View File

@@ -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
};