Merge pull request #6753 from tannewt/esp_led_reset
Audit all boards with LED pins defined
This commit is contained in:
commit
fa3e265bfb
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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}}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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}}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -28,3 +28,5 @@
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "BastWiFi"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO14)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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}}
|
||||
|
||||
|
@ -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) },
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user