diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h index 793b675784..ae0507fa8b 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) #define MICROPY_HW_NEOPIXEL_COUNT (6) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) + #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/board.c b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c index a76c5da36c..a13c3be4e6 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c @@ -49,17 +49,5 @@ void board_deinit(void) { } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == 13) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } return false; } diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h index 104fbfc86d..fc478ef005 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO0) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO20, .sda = &pin_GPIO22}} diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h index 0be1357939..4e7da01b5a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index 68505d37d7..63ad8e44fd 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -141,18 +141,6 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { gpio_set_level(21, true); return true; } - // Pull LED down on reset rather than the default up - if (pin_number == 13) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } return false; } diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h index bafb280014..e9eb3326ea 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) 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 6cbe314f42..b4034568c0 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h index da623f73be..ecaa13a344 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h index b6477c766b..e089c5c251 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h index f2bf81d3d2..0bc80a884e 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h index a6f46af978..2b2438432e 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h @@ -33,6 +33,8 @@ #define MICROPY_HW_APA102_SCK (&pin_GPIO15) #define MICROPY_HW_APA102_COUNT (5) +#define MICROPY_HW_LED_STATUS (&pin_GPIO37) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO33) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO34) 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 9f08ca330c..2892110f6e 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -34,6 +34,8 @@ #define CIRCUITPY_STATUS_LED_POWER_INVERTED (1) #define MICROPY_HW_NEOPIXEL_COUNT (4) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h index 3d9250bec1..698dc20764 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -31,6 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO42) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h index 3db8a44463..3b1caff2e9 100644 --- a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h @@ -30,7 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32-C3FN4" // Status LED -#define MICROPY_HW_NEOPIXEL (&pin_GPIO10) +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO9, .sda = &pin_GPIO8}} diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h index ca5d782036..ad0b899c1e 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h @@ -28,3 +28,7 @@ #define MICROPY_HW_BOARD_NAME "CrumpS2" #define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +#define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_APA102_COUNT (1) diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h index 478a06c70a..28ffad1f37 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h @@ -30,7 +30,8 @@ #define MICROPY_HW_MCU_NAME "ESP32S3" #define MICROPY_HW_NEOPIXEL (&pin_GPIO46) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO13) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h index 229af1c865..bf8c1efa60 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h @@ -28,3 +28,5 @@ #define MICROPY_HW_BOARD_NAME "BastWiFi" #define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO14) diff --git a/ports/espressif/boards/espressif_esp32_eye/board.c b/ports/espressif/boards/espressif_esp32_eye/board.c index d66ab9e5f1..38efb9e901 100644 --- a/ports/espressif/boards/espressif_esp32_eye/board.c +++ b/ports/espressif/boards/espressif_esp32_eye/board.c @@ -44,3 +44,18 @@ void reset_board(void) { void board_deinit(void) { } +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LEDs down on reset rather than the default up + if (pin_number == 21 || pin_number == 22) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; + } + return false; +} diff --git a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h index 63a6f2307e..accf539428 100644 --- a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h @@ -29,6 +29,8 @@ #define MICROPY_HW_BOARD_NAME "Espressif ESP32-EYE" #define MICROPY_HW_MCU_NAME "ESP32" +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO23, .sda = &pin_GPIO18}} diff --git a/ports/espressif/boards/espressif_esp32s3_eye/pins.c b/ports/espressif/boards/espressif_esp32s3_eye/pins.c index defa4e9c52..4b4da0b199 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/pins.c +++ b/ports/espressif/boards/espressif_esp32s3_eye/pins.c @@ -46,7 +46,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO44) }, { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO48) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h index a20ea362f2..fba644553f 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h @@ -31,5 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h index 17719c6f40..1fa96a84a6 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h @@ -31,6 +31,9 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h index 53409cf263..07d65735a6 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h @@ -31,5 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h index ee19f54ca5..1e91421574 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h @@ -31,6 +31,9 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.h b/ports/espressif/boards/hexky_s2/mpconfigboard.h index 31dd096beb..f49901332f 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.h +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.h @@ -30,7 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO39) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c index deeb8041ea..66246c6f77 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c @@ -15,22 +15,6 @@ bool board_requests_safe_mode(void) { return false; } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == MICROPY_HW_LED_STATUS->number) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } - return false; -} - void reset_board(void) { } diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c index deeb8041ea..66246c6f77 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -15,22 +15,6 @@ bool board_requests_safe_mode(void) { return false; } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == MICROPY_HW_LED_STATUS->number) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } - return false; -} - void reset_board(void) { } diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h index c490cd8ceb..e943e70184 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h @@ -29,6 +29,8 @@ #define MICROPY_HW_BOARD_NAME "S2Mini" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP +#define MICROPY_HW_LED_STATUS (&pin_GPIO15) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Wemos MP #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Wemos MP diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h index 19c41f84e4..a33e6ea4d0 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -29,6 +29,8 @@ #define MICROPY_HW_BOARD_NAME "S2Pico" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) // JST SH Connector Pin 3 NOT STEMMA QT / Feather pinout #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) // JST SH Connector Pin 2 NOT STEMMA QT / Feather pinout diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h index f5bc8faf0b..6e2bf9d7b8 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h @@ -28,10 +28,12 @@ #define MICROPY_HW_BOARD_NAME "MicroDev microC3" #define MICROPY_HW_MCU_NAME "ESP32-C3FN4" -// Status LED +// Status LEDs #define MICROPY_HW_NEOPIXEL (&pin_GPIO7) #define MICROPY_HW_NEOPIXEL_COUNT (2) +#define MICROPY_HW_LED_STATUS (&pin_GPIO8) + // Default bus pins #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO5) diff --git a/ports/espressif/boards/microdev_micro_s2/board.c b/ports/espressif/boards/microdev_micro_s2/board.c index 0a2b17e001..f6983f05a4 100644 --- a/ports/espressif/boards/microdev_micro_s2/board.c +++ b/ports/espressif/boards/microdev_micro_s2/board.c @@ -42,17 +42,6 @@ bool board_requests_safe_mode(void) { return false; } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pin 21 is a high side LED so pull it down to prevent lighting the LED. - if (pin_number == 21) { - gpio_reset_pin(21); - gpio_pullup_dis(21); - gpio_pulldown_en(21); - return true; - } - return false; -} - void reset_board(void) { } diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h index c9354cabcc..c692c5e664 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h @@ -28,9 +28,11 @@ #define MICROPY_HW_BOARD_NAME "MicroDev microS2" #define MICROPY_HW_MCU_NAME "ESP32-S2" -// Status LED +// Status LEDs #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + // Default bus pins #define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h index 9d7a480228..5d6ad95e1b 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h @@ -31,5 +31,7 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h index d10ab94223..ebea0f447b 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -32,6 +32,8 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h index af61a67fbb..aeaf23d248 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h index a2fadd85ea..1b11b37d66 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h @@ -32,6 +32,8 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO38) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h index a341cf0464..67054b8664 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h index ed9cbffa60..6a10db6061 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h @@ -29,4 +29,4 @@ #define MICROPY_HW_BOARD_NAME "Waveshare ESP32-S2-Pico" #define MICROPY_HW_MCU_NAME "ESP32S2" -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO9) +#define MICROPY_HW_LED_STATUS (&pin_GPIO9) diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 8a09c98d74..127505f0e9 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -130,15 +130,26 @@ STATIC void _reset_pin(gpio_num_t pin_number) { return; } - gpio_reset_pin(pin_number); + bool pull_down = false; + + // Special case the status LED pin. + #if defined(MICROPY_HW_LED_STATUS) && (!defined(MICROPY_HW_LED_STATUS_INVERTED) || !MICROPY_HW_LED_STATUS_INVERTED) + pull_down = pull_down || pin_number == MICROPY_HW_LED_STATUS->number; + #endif #ifdef DOUBLE_TAP_PIN // Pull the double tap pin down so that resets come back to CircuitPython. - if (pin_number == DOUBLE_TAP_PIN->number) { + pull_down = pull_down || pin_number == DOUBLE_TAP_PIN->number; + #endif + + // This will pull the pin up. For pins needing pull down it shouldn't be a + // problem for a moment. + gpio_reset_pin(pin_number); + + if (pull_down) { gpio_pullup_dis(pin_number); gpio_pulldown_en(pin_number); } - #endif } // Mark pin as free and return it to a quiescent state.