From d99847b4106bfb767029e81eda810168ab5a5d03 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jan 2022 12:40:41 -0800 Subject: [PATCH] Refactor pin reset on ESP This makes it easier to blanket never reset flash and USB pins. It also allows us to set a custom state after reset. The first case is for the double tap reset that needs to be pulled low. Fixes #5893 --- .../boards/adafruit_esp32s2_camera/board.c | 4 -- .../adafruit_esp32s2_camera/mpconfigboard.h | 2 + .../boards/adafruit_feather_esp32s2/board.c | 4 -- .../adafruit_feather_esp32s2/mpconfigboard.h | 2 + .../adafruit_feather_esp32s2_tft/board.c | 4 -- .../mpconfigboard.h | 2 + .../board.c | 4 -- .../mpconfigboard.h | 2 + .../boards/adafruit_funhouse/board.c | 4 -- .../boards/adafruit_funhouse/mpconfigboard.h | 2 + .../adafruit_magtag_2.9_grayscale/board.c | 4 -- .../mpconfigboard.h | 2 + .../boards/adafruit_metro_esp32s2/board.c | 3 -- .../adafruit_metro_esp32s2/mpconfigboard.h | 2 + .../boards/adafruit_qtpy_esp32s2/board.c | 3 -- .../adafruit_qtpy_esp32s2/mpconfigboard.h | 5 +++ .../adafruit_qtpy_esp32s3_nopsram/board.c | 13 ------ .../mpconfigboard.h | 2 + .../boards/ai_thinker_esp32-c3s/board.c | 10 ----- .../boards/ai_thinker_esp_12k_nodemcu/board.c | 4 -- ports/espressif/boards/artisense_rd00/board.c | 7 ---- .../boards/atmegazero_esp32s2/board.c | 13 ------ .../boards/crumpspace_crumps2/board.c | 4 -- .../boards/electroniccats_bastwifi/board.c | 4 -- .../espressif_esp32c3_devkitm_1_n4/board.c | 10 ----- .../boards/espressif_esp32s3_box/board.c | 18 -------- .../espressif_esp32s3_devkitc_1_n8/board.c | 13 ------ .../espressif_esp32s3_devkitc_1_n8r2/board.c | 13 ------ .../espressif_esp32s3_devkitc_1_n8r8/board.c | 19 --------- .../boards/espressif_hmi_devkit_1/board.c | 4 -- .../boards/espressif_kaluga_1.3/board.c | 4 -- .../boards/espressif_kaluga_1/board.c | 4 -- .../boards/espressif_saola_1_wroom/board.c | 4 -- .../boards/espressif_saola_1_wrover/board.c | 4 -- .../boards/franzininho_wifi_wroom/board.c | 4 -- .../boards/franzininho_wifi_wrover/board.c | 4 -- .../boards/gravitech_cucumber_m/board.c | 4 -- .../boards/gravitech_cucumber_ms/board.c | 4 -- .../boards/gravitech_cucumber_r/board.c | 4 -- .../boards/gravitech_cucumber_rs/board.c | 4 -- .../boards/lilygo_ttgo_t8_s2_st7789/board.c | 4 -- ports/espressif/boards/lolin_s2_mini/board.c | 13 ------ ports/espressif/boards/lolin_s2_pico/board.c | 13 ------ .../boards/microdev_micro_c3/board.c | 13 ------ .../boards/microdev_micro_s2/board.c | 13 ------ .../boards/morpheans_morphesp-240/board.c | 4 -- .../boards/muselab_nanoesp32_s2_wroom/board.c | 4 -- .../muselab_nanoesp32_s2_wrover/board.c | 4 -- .../boards/odt_pixelwing_esp32_s2/board.c | 3 -- .../boards/targett_module_clip_wroom/board.c | 4 -- .../boards/targett_module_clip_wrover/board.c | 4 -- .../boards/unexpectedmaker_feathers2/board.c | 13 ------ .../unexpectedmaker_feathers2_neo/board.c | 13 ------ .../board.c | 13 ------ .../boards/unexpectedmaker_tinys2/board.c | 13 ------ .../common-hal/microcontroller/Pin.c | 41 ++++++++++++++++++- .../esp-idf-config/sdkconfig-debug.defaults | 8 ++-- 57 files changed, 64 insertions(+), 339 deletions(-) diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/board.c b/ports/espressif/boards/adafruit_esp32s2_camera/board.c index 15f573ea96..38e7c0458c 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s2_camera/board.c @@ -51,10 +51,6 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - busio_spi_obj_t *spi = common_hal_board_create_spi(); displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h index 25b2f2aa54..f7f988b861 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h @@ -44,3 +44,5 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DOUBLE_TAP_PIN (&pin_GPIO42) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/board.c b/ports/espressif/boards/adafruit_feather_esp32s2/board.c index be678c23ab..8918870a8e 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2/board.c @@ -32,10 +32,6 @@ #include "common-hal/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Turn on I2C common_hal_never_reset_pin(&pin_GPIO7); gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h index fcd4a2cf60..2eb3344029 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h @@ -47,3 +47,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO38) #define DEFAULT_UART_BUS_TX (&pin_GPIO39) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index 68e4171948..f6c5c856e3 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -71,10 +71,6 @@ uint8_t display_init_sequence[] = { void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // I2C/TFT power pin common_hal_never_reset_pin(&pin_GPIO21); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h index b850b85e01..a68593a308 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h @@ -47,3 +47,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO2) #define DEFAULT_UART_BUS_TX (&pin_GPIO1) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 943d91feda..71b381616f 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -50,10 +50,6 @@ uint8_t display_init_sequence[] = { */ void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h index d2cd01a681..9c759ac1ca 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -44,3 +44,5 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_funhouse/board.c b/ports/espressif/boards/adafruit_funhouse/board.c index a4a1d07947..34e74c45f9 100644 --- a/ports/espressif/boards/adafruit_funhouse/board.c +++ b/ports/espressif/boards/adafruit_funhouse/board.c @@ -50,10 +50,6 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO37); diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h index 6379147c30..a268020b7c 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h @@ -41,3 +41,5 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO33) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO34) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c index 020e6f6a1f..4a8234aa41 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c @@ -110,10 +110,6 @@ const uint8_t display_stop_sequence[] = { }; void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index 343bb525f1..ad81cc2ca7 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -42,3 +42,5 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/board.c b/ports/espressif/boards/adafruit_metro_esp32s2/board.c index 5abd1ce1b3..6772768da5 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_metro_esp32s2/board.c @@ -29,9 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h index ec992383aa..51d93224a4 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -46,3 +46,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO5) #define DEFAULT_UART_BUS_TX (&pin_GPIO6) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c index 5abd1ce1b3..6772768da5 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c @@ -29,9 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h index dd8b1a2ac8..62766631c3 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h @@ -47,3 +47,8 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO16) #define DEFAULT_UART_BUS_TX (&pin_GPIO5) + +#define DOUBLE_TAP_PIN (&pin_GPIO10) + +#define DEBUG_UART_RX DEFAULT_UART_BUS_RX +#define DEBUG_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c index dd24db581b..ff9418ec86 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h index 90d65ea71e..a08fe9e45b 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h @@ -47,3 +47,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO16) #define DEFAULT_UART_BUS_TX (&pin_GPIO5) + +#define DOUBLE_TAP_PIN (&pin_GPIO10) diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c index 83ef690007..f9cb98aa8f 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c @@ -29,21 +29,11 @@ #include "supervisor/board.h" void board_init(void) { - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO20); common_hal_never_reset_pin(&pin_GPIO21); #endif - - // SPI Flash - common_hal_never_reset_pin(&pin_GPIO11); - common_hal_never_reset_pin(&pin_GPIO12); - common_hal_never_reset_pin(&pin_GPIO13); - common_hal_never_reset_pin(&pin_GPIO14); - common_hal_never_reset_pin(&pin_GPIO15); - common_hal_never_reset_pin(&pin_GPIO16); - common_hal_never_reset_pin(&pin_GPIO17); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/artisense_rd00/board.c b/ports/espressif/boards/artisense_rd00/board.c index 2b18dd7592..ea363f6b54 100644 --- a/ports/espressif/boards/artisense_rd00/board.c +++ b/ports/espressif/boards/artisense_rd00/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); @@ -42,9 +38,6 @@ void board_init(void) { // Crystal common_hal_never_reset_pin(&pin_GPIO15); common_hal_never_reset_pin(&pin_GPIO16); - - // PSRAM - common_hal_never_reset_pin(&pin_GPIO26); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/atmegazero_esp32s2/board.c b/ports/espressif/boards/atmegazero_esp32s2/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/board.c +++ b/ports/espressif/boards/atmegazero_esp32s2/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/crumpspace_crumps2/board.c b/ports/espressif/boards/crumpspace_crumps2/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/crumpspace_crumps2/board.c +++ b/ports/espressif/boards/crumpspace_crumps2/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/electroniccats_bastwifi/board.c b/ports/espressif/boards/electroniccats_bastwifi/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/board.c +++ b/ports/espressif/boards/electroniccats_bastwifi/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c index 76353e4ff9..e3b71f4832 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c @@ -28,21 +28,11 @@ #include "supervisor/board.h" void board_init(void) { - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO20); common_hal_never_reset_pin(&pin_GPIO21); #endif - - // SPI Flash - common_hal_never_reset_pin(&pin_GPIO11); - common_hal_never_reset_pin(&pin_GPIO12); - common_hal_never_reset_pin(&pin_GPIO13); - common_hal_never_reset_pin(&pin_GPIO14); - common_hal_never_reset_pin(&pin_GPIO15); - common_hal_never_reset_pin(&pin_GPIO16); - common_hal_never_reset_pin(&pin_GPIO17); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/espressif_esp32s3_box/board.c b/ports/espressif/boards/espressif_esp32s3_box/board.c index c425c5c24e..ad76c60ddd 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box/board.c @@ -90,29 +90,11 @@ void board_init(void) { true, // backlight_on_high false); // SH1107_addressing - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); - common_hal_never_reset_pin(&pin_GPIO33); - common_hal_never_reset_pin(&pin_GPIO34); - common_hal_never_reset_pin(&pin_GPIO35); - common_hal_never_reset_pin(&pin_GPIO36); - common_hal_never_reset_pin(&pin_GPIO37); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c index dd24db581b..ff9418ec86 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c index dd24db581b..ff9418ec86 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c index b9558bfbdf..ff9418ec86 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c @@ -29,30 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); - common_hal_never_reset_pin(&pin_GPIO33); - common_hal_never_reset_pin(&pin_GPIO34); - common_hal_never_reset_pin(&pin_GPIO35); - common_hal_never_reset_pin(&pin_GPIO36); - common_hal_never_reset_pin(&pin_GPIO37); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/board.c b/ports/espressif/boards/espressif_hmi_devkit_1/board.c index ff5d9cfb6c..93aa1c0436 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/board.c +++ b/ports/espressif/boards/espressif_hmi_devkit_1/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); diff --git a/ports/espressif/boards/espressif_kaluga_1.3/board.c b/ports/espressif/boards/espressif_kaluga_1.3/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/board.c +++ b/ports/espressif/boards/espressif_kaluga_1.3/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/espressif_kaluga_1/board.c b/ports/espressif/boards/espressif_kaluga_1/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/espressif_kaluga_1/board.c +++ b/ports/espressif/boards/espressif_kaluga_1/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/espressif_saola_1_wroom/board.c b/ports/espressif/boards/espressif_saola_1_wroom/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/board.c +++ b/ports/espressif/boards/espressif_saola_1_wroom/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/espressif_saola_1_wrover/board.c b/ports/espressif/boards/espressif_saola_1_wrover/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/board.c +++ b/ports/espressif/boards/espressif_saola_1_wrover/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/franzininho_wifi_wroom/board.c b/ports/espressif/boards/franzininho_wifi_wroom/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/board.c +++ b/ports/espressif/boards/franzininho_wifi_wroom/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/franzininho_wifi_wrover/board.c b/ports/espressif/boards/franzininho_wifi_wrover/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/board.c +++ b/ports/espressif/boards/franzininho_wifi_wrover/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/gravitech_cucumber_m/board.c b/ports/espressif/boards/gravitech_cucumber_m/board.c index ec84d3209c..16a6af0742 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/board.c +++ b/ports/espressif/boards/gravitech_cucumber_m/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/gravitech_cucumber_ms/board.c b/ports/espressif/boards/gravitech_cucumber_ms/board.c index ec84d3209c..16a6af0742 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/board.c +++ b/ports/espressif/boards/gravitech_cucumber_ms/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/gravitech_cucumber_r/board.c b/ports/espressif/boards/gravitech_cucumber_r/board.c index ec84d3209c..16a6af0742 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/board.c +++ b/ports/espressif/boards/gravitech_cucumber_r/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/gravitech_cucumber_rs/board.c b/ports/espressif/boards/gravitech_cucumber_rs/board.c index ec84d3209c..16a6af0742 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/board.c +++ b/ports/espressif/boards/gravitech_cucumber_rs/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c index b00a1ed8ed..38fba815e5 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c @@ -131,10 +131,6 @@ static void display_init(void) { } void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/lolin_s2_mini/board.c b/ports/espressif/boards/lolin_s2_mini/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/lolin_s2_mini/board.c +++ b/ports/espressif/boards/lolin_s2_mini/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/lolin_s2_pico/board.c b/ports/espressif/boards/lolin_s2_pico/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/lolin_s2_pico/board.c +++ b/ports/espressif/boards/lolin_s2_pico/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/microdev_micro_c3/board.c b/ports/espressif/boards/microdev_micro_c3/board.c index 7ffd406cfe..e3b71f4832 100644 --- a/ports/espressif/boards/microdev_micro_c3/board.c +++ b/ports/espressif/boards/microdev_micro_c3/board.c @@ -28,24 +28,11 @@ #include "supervisor/board.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO18); - common_hal_never_reset_pin(&pin_GPIO19); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO20); common_hal_never_reset_pin(&pin_GPIO21); #endif - - // SPI Flash - common_hal_never_reset_pin(&pin_GPIO11); - common_hal_never_reset_pin(&pin_GPIO12); - common_hal_never_reset_pin(&pin_GPIO13); - common_hal_never_reset_pin(&pin_GPIO14); - common_hal_never_reset_pin(&pin_GPIO15); - common_hal_never_reset_pin(&pin_GPIO16); - common_hal_never_reset_pin(&pin_GPIO17); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/microdev_micro_s2/board.c b/ports/espressif/boards/microdev_micro_s2/board.c index 52d640618c..6ba5d975d7 100644 --- a/ports/espressif/boards/microdev_micro_s2/board.c +++ b/ports/espressif/boards/microdev_micro_s2/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/morpheans_morphesp-240/board.c b/ports/espressif/boards/morpheans_morphesp-240/board.c index aad2f0257a..ace1778766 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/board.c +++ b/ports/espressif/boards/morpheans_morphesp-240/board.c @@ -139,10 +139,6 @@ uint8_t display_init_sequence[] = { void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO6); diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c index e40b6335bc..0432485111 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c b/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c index 5abd1ce1b3..6772768da5 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c @@ -29,9 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/targett_module_clip_wroom/board.c b/ports/espressif/boards/targett_module_clip_wroom/board.c index 00b94a0259..66aea4bdd5 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/board.c +++ b/ports/espressif/boards/targett_module_clip_wroom/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/targett_module_clip_wrover/board.c b/ports/espressif/boards/targett_module_clip_wrover/board.c index 00b94a0259..66aea4bdd5 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/board.c +++ b/ports/espressif/boards/targett_module_clip_wrover/board.c @@ -29,10 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/board.c b/ports/espressif/boards/unexpectedmaker_feathers2/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/board.c b/ports/espressif/boards/unexpectedmaker_tinys2/board.c index a0e399b1ef..0432485111 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinys2/board.c @@ -29,24 +29,11 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // USB - common_hal_never_reset_pin(&pin_GPIO19); - common_hal_never_reset_pin(&pin_GPIO20); - // Debug UART #ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 37a235d0b3..dbc1045cc8 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -50,6 +50,43 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { never_reset_pin_number(pin->number); } +STATIC void _reset_pin(gpio_num_t pin_number) { + #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + // Never ever reset pins used for flash and RAM. + if (26 <= pin_number && pin_number <= 32) { + return; + } + #ifdef CONFIG_SPIRAM_MODE_OCT + // Octal DQ4-DQ7 and DQS/DM + if (33 <= pin_number && pin_number <= 37) { + return; + } + #endif + + #if CIRCUITPY_USB + // Never reset USB pins. + if (pin_number == 19 || pin_number == 20) { + return; + } + #endif + #elif CONFIG_IDF_TARGET_ESP32C3 + // Never ever reset pins used for flash and RAM. + if (11 <= pin_number && pin_number <= 17) { + return; + } + #endif + + gpio_reset_pin(pin_number); + + #ifdef DOUBLE_TAP_PIN + // Pull the double tap pin down so that resets come back to CircuitPython. + if (pin_number == DOUBLE_TAP_PIN->number) { + gpio_pullup_dis(pin_number); + gpio_pulldown_en(pin_number); + } + #endif +} + // Mark pin as free and return it to a quiescent state. void reset_pin_number(gpio_num_t pin_number) { if (pin_number == NO_PIN) { @@ -58,7 +95,7 @@ void reset_pin_number(gpio_num_t pin_number) { never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); in_use[pin_number / 32] &= ~(1 << pin_number % 32); - gpio_reset_pin(pin_number); + _reset_pin(pin_number); } void common_hal_mcu_pin_reset_number(uint8_t i) { @@ -79,7 +116,7 @@ void reset_all_pins(void) { (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { continue; } - gpio_reset_pin(i); + _reset_pin(i); } in_use[0] = never_reset_pins[0]; in_use[1] = never_reset_pins[1]; diff --git a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults index 381483a8b9..9d02c62445 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults @@ -1,17 +1,17 @@ # # Bootloader config # -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE is not set -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG=y +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # end of Bootloader config -CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set # # Compiler options # -# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_COMPILER_OPTIMIZATION_NONE is not set CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y