From 63357899ab858c136819a3586134b0ba7bd97c24 Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Sat, 20 Jan 2024 07:24:28 -0500 Subject: [PATCH 01/19] initial working m5stack cardputer setup --- ports/espressif/m5stack_cardputer/board.c | 137 ++++++++++++++++++ .../m5stack_cardputer/mpconfigboard.h | 55 +++++++ .../m5stack_cardputer/mpconfigboard.mk | 11 ++ ports/espressif/m5stack_cardputer/pins.c | 80 ++++++++++ ports/espressif/m5stack_cardputer/sdkconfig | 15 ++ 5 files changed, 298 insertions(+) create mode 100644 ports/espressif/m5stack_cardputer/board.c create mode 100644 ports/espressif/m5stack_cardputer/mpconfigboard.h create mode 100644 ports/espressif/m5stack_cardputer/mpconfigboard.mk create mode 100644 ports/espressif/m5stack_cardputer/pins.c create mode 100644 ports/espressif/m5stack_cardputer/sdkconfig diff --git a/ports/espressif/m5stack_cardputer/board.c b/ports/espressif/m5stack_cardputer/board.c new file mode 100644 index 0000000000000..8716cf5416559 --- /dev/null +++ b/ports/espressif/m5stack_cardputer/board.c @@ -0,0 +1,137 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/fourwire/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/board/__init__.h" + +fourwire_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +// display init sequence according to LilyGO example app +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0 | DELAY, 150, + // sleep out + 0x11, 0 | DELAY, 255, + // normal display mode on + 0x13, 0, + // display and color format settings + 0x36, 1, 0x68, + 0xB6, 2, 0x0A, 0x82, + 0x3A, 1 | DELAY, 0x55, 10, + // ST7789V frame rate setting + 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, + // voltages: VGH / VGL + 0xB7, 1, 0x35, + // ST7789V power setting + 0xBB, 1, 0x28, + 0xC0, 1, 0x0C, + 0xC2, 2, 0x01, 0xFF, + 0xC3, 1, 0x10, + 0xC4, 1, 0x20, + 0xC6, 1, 0x0F, + 0xD0, 2, 0xA4, 0xA1, + // ST7789V gamma setting + 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, + 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E, + 0x21, 0, + // display on + 0x29, 0 | DELAY, 255, +}; + + +void board_init(void) { + busio_spi_obj_t *spi = common_hal_board_create_spi(0); + fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + bus->base.type = &fourwire_fourwire_type; + + // see here for inspiration: https://github.com/m5stack/M5GFX/blob/33d7d3135e816a86a008fae8ab3757938cee95d2/src/M5GFX.cpp#L1350 + common_hal_fourwire_fourwire_construct( + bus, + spi, + &pin_GPIO34, // DC + &pin_GPIO37, // CS + &pin_GPIO33, // RST + 40000000, // baudrate + 0, // polarity + 0 // phase + ); + busdisplay_busdisplay_obj_t *display = &allocate_display()->display; + display->base.type = &busdisplay_busdisplay_type; + + common_hal_busdisplay_busdisplay_construct( + display, + bus, + 240, // width (after rotation) + 135, // height (after rotation) + 40, // column start + 53, // row start + 0, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command + MIPI_COMMAND_WRITE_MEMORY_START, // write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO38, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Override the I2C/TFT power pin reset to prevent resetting the display. + if (pin_number == 21) { + // Turn on TFT and I2C + gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(21, true); + return true; + } + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + +// TODO: Should we turn off the display when asleep, in board_deinit() ? diff --git a/ports/espressif/m5stack_cardputer/mpconfigboard.h b/ports/espressif/m5stack_cardputer/mpconfigboard.h new file mode 100644 index 0000000000000..9ca1f2376f583 --- /dev/null +++ b/ports/espressif/m5stack_cardputer/mpconfigboard.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "M5 Stack Cardputer" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO21) +// #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) + +// sd - do not use here, causes tft to stop working +// #define DEFAULT_SPI_BUS_SCK (&pin_GPIO40) +// #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO14) +// #define DEFAULT_SPI_BUS_MISO (&pin_GPIO39) +// orig +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO34) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) +// orig +// #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/m5stack_cardputer/mpconfigboard.mk b/ports/espressif/m5stack_cardputer/mpconfigboard.mk new file mode 100644 index 0000000000000..5f5ee17a8643a --- /dev/null +++ b/ports/espressif/m5stack_cardputer/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303A +USB_PID = 0x811A +USB_PRODUCT = "M5STACK CoreS3 - CircuitPython" +USB_MANUFACTURER = "M5STACK" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/m5stack_cardputer/pins.c b/ports/espressif/m5stack_cardputer/pins.c new file mode 100644 index 0000000000000..3f115994ed5c5 --- /dev/null +++ b/ports/espressif/m5stack_cardputer/pins.c @@ -0,0 +1,80 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Port A + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_PORTA1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_PORTA2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + // Keyboard + // { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_2), MP_ROM_PTR(&pin_GPIO3) }, + // { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_3), MP_ROM_PTR(&pin_GPIO4) }, + // { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_4), MP_ROM_PTR(&pin_GPIO5) }, + // { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_5), MP_ROM_PTR(&pin_GPIO6) }, + // { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_6), MP_ROM_PTR(&pin_GPIO7) }, + // { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_KB_A_0), MP_ROM_PTR(&pin_GPIO8) }, + // { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_KB_A_1), MP_ROM_PTR(&pin_GPIO9) }, + // { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_KB_A_2), MP_ROM_PTR(&pin_GPIO11) }, + // { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_0), MP_ROM_PTR(&pin_GPIO13) }, + // { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_1), MP_ROM_PTR(&pin_GPIO15) }, + + // Neopixel + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, + + // Speaker + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + + // IR + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + + // SD + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO12) }, + + + // Display + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RS), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DATA), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BL), MP_ROM_PTR(&pin_GPIO38) }, + + // Button + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + + // Other + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/m5stack_cardputer/sdkconfig b/ports/espressif/m5stack_cardputer/sdkconfig new file mode 100644 index 0000000000000..f5ef79768114c --- /dev/null +++ b/ports/espressif/m5stack_cardputer/sdkconfig @@ -0,0 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration From 96b5286d7bc92c82d8e5521de0dad5585554c539 Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Sat, 20 Jan 2024 07:28:15 -0500 Subject: [PATCH 02/19] move folder to correct spot --- ports/espressif/{ => boards}/m5stack_cardputer/board.c | 0 ports/espressif/{ => boards}/m5stack_cardputer/mpconfigboard.h | 0 ports/espressif/{ => boards}/m5stack_cardputer/mpconfigboard.mk | 0 ports/espressif/{ => boards}/m5stack_cardputer/pins.c | 0 ports/espressif/{ => boards}/m5stack_cardputer/sdkconfig | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename ports/espressif/{ => boards}/m5stack_cardputer/board.c (100%) rename ports/espressif/{ => boards}/m5stack_cardputer/mpconfigboard.h (100%) rename ports/espressif/{ => boards}/m5stack_cardputer/mpconfigboard.mk (100%) rename ports/espressif/{ => boards}/m5stack_cardputer/pins.c (100%) rename ports/espressif/{ => boards}/m5stack_cardputer/sdkconfig (100%) diff --git a/ports/espressif/m5stack_cardputer/board.c b/ports/espressif/boards/m5stack_cardputer/board.c similarity index 100% rename from ports/espressif/m5stack_cardputer/board.c rename to ports/espressif/boards/m5stack_cardputer/board.c diff --git a/ports/espressif/m5stack_cardputer/mpconfigboard.h b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h similarity index 100% rename from ports/espressif/m5stack_cardputer/mpconfigboard.h rename to ports/espressif/boards/m5stack_cardputer/mpconfigboard.h diff --git a/ports/espressif/m5stack_cardputer/mpconfigboard.mk b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk similarity index 100% rename from ports/espressif/m5stack_cardputer/mpconfigboard.mk rename to ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk diff --git a/ports/espressif/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c similarity index 100% rename from ports/espressif/m5stack_cardputer/pins.c rename to ports/espressif/boards/m5stack_cardputer/pins.c diff --git a/ports/espressif/m5stack_cardputer/sdkconfig b/ports/espressif/boards/m5stack_cardputer/sdkconfig similarity index 100% rename from ports/espressif/m5stack_cardputer/sdkconfig rename to ports/espressif/boards/m5stack_cardputer/sdkconfig From 5b04d56b861c97e270a6667d4ec80b812f3c15b5 Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Sat, 20 Jan 2024 07:36:59 -0500 Subject: [PATCH 03/19] clean up comments --- .../boards/m5stack_cardputer/mpconfigboard.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h index 9ca1f2376f583..a1014186ec559 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h @@ -30,26 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S3" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) -// #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) - -// sd - do not use here, causes tft to stop working -// #define DEFAULT_SPI_BUS_SCK (&pin_GPIO40) -// #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO14) -// #define DEFAULT_SPI_BUS_MISO (&pin_GPIO39) -// orig #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO34) - -#define DEFAULT_UART_BUS_RX (&pin_GPIO44) -#define DEFAULT_UART_BUS_TX (&pin_GPIO43) -// orig -// #define DEFAULT_UART_BUS_RX (&pin_GPIO2) -// #define DEFAULT_UART_BUS_TX (&pin_GPIO1) - -// #define DOUBLE_TAP_PIN (&pin_GPIO38) From f24757065c0480ed677044f7114509b172073e5f Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Sun, 21 Jan 2024 20:46:25 -0500 Subject: [PATCH 04/19] add gifio and set proper name for Ir tx --- ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk | 2 ++ ports/espressif/boards/m5stack_cardputer/pins.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk index 5f5ee17a8643a..9a74d499ae5f5 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk @@ -9,3 +9,5 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESPCAMERA = 0 + +CIRCUITPY_GIFIO = 1 diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 3f115994ed5c5..562c2d2bb287d 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -44,7 +44,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, // IR - { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IR_TX), MP_ROM_PTR(&pin_GPIO44) }, // SD { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO14) }, From 65a0073e5787b98286012a5cc93a7925fe01bfb9 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 22 Jan 2024 08:38:20 -0500 Subject: [PATCH 05/19] clean up pins per pull request comment --- ports/espressif/boards/m5stack_cardputer/pins.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 562c2d2bb287d..4ccbbb7075217 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -14,26 +14,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, // Keyboard - // { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_0), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_KB_COL_1), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_KB_COL_2), MP_ROM_PTR(&pin_GPIO3) }, - // { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_KB_COL_3), MP_ROM_PTR(&pin_GPIO4) }, - // { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_KB_COL_4), MP_ROM_PTR(&pin_GPIO5) }, - // { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_KB_COL_5), MP_ROM_PTR(&pin_GPIO6) }, - // { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_KB_COL_6), MP_ROM_PTR(&pin_GPIO7) }, - // { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_KB_A_0), MP_ROM_PTR(&pin_GPIO8) }, - // { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_KB_A_1), MP_ROM_PTR(&pin_GPIO9) }, - // { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_KB_A_2), MP_ROM_PTR(&pin_GPIO11) }, - // { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_KB_COL_0), MP_ROM_PTR(&pin_GPIO13) }, - // { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_KB_COL_1), MP_ROM_PTR(&pin_GPIO15) }, // Neopixel { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, From 2ef9b135aeaf0754fff64a06f3cb240293e31a4d Mon Sep 17 00:00:00 2001 From: James Date: Mon, 29 Jan 2024 07:29:13 -0500 Subject: [PATCH 06/19] Update pins.c add microphone pins, thanks @panguin6010 --- ports/espressif/boards/m5stack_cardputer/pins.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 4ccbbb7075217..67b0de5bd72ef 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -33,6 +33,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + // Mic + { MP_ROM_QSTR(MP_QSTR_MIC_DATA), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_MIC_CLK), MP_ROM_PTR(&pin_GPIO43) }, + // IR { MP_ROM_QSTR(MP_QSTR_IR_TX), MP_ROM_PTR(&pin_GPIO44) }, From c6ad46a048acd2a48a6a736f5bbb910e59c5be2d Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Thu, 15 Feb 2024 15:53:56 -0500 Subject: [PATCH 07/19] rename pins per suggestion from @RetiredWizard --- ports/espressif/boards/m5stack_cardputer/pins.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 67b0de5bd72ef..010721d99d833 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -29,9 +29,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, // Speaker - { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, - { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IS2_DATA), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO43) }, // Mic { MP_ROM_QSTR(MP_QSTR_MIC_DATA), MP_ROM_PTR(&pin_GPIO46) }, From a491be6911bac33ec28396e015d70dc384fb119c Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:02:35 -0500 Subject: [PATCH 08/19] integrate new usb PID per suggestion from @tannewt Co-authored-by: Scott Shawcroft --- ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk index 9a74d499ae5f5..d5e12f1ebfac7 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x303A -USB_PID = 0x811A +USB_PID = 0x81DA USB_PRODUCT = "M5STACK CoreS3 - CircuitPython" USB_MANUFACTURER = "M5STACK" From f9c6a40ca385caf6ddcb943d90dc17b34bcda7f3 Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Thu, 15 Feb 2024 16:03:46 -0500 Subject: [PATCH 09/19] rename usb to more clearly define which product --- ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk index d5e12f1ebfac7..d3edbf918089e 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x303A USB_PID = 0x81DA -USB_PRODUCT = "M5STACK CoreS3 - CircuitPython" +USB_PRODUCT = "M5STACK Cardputer - CircuitPython" USB_MANUFACTURER = "M5STACK" IDF_TARGET = esp32s3 From e898e65303486040eda93b314752657ae2981140 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:08:03 -0500 Subject: [PATCH 10/19] add I2C bus per suggestion from @CDarius Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/mpconfigboard.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h index a1014186ec559..bdb1b77b09b73 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h @@ -30,7 +30,8 @@ #define MICROPY_HW_MCU_NAME "ESP32S3" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) - +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO34) From ae30f51dfc7164bf8b34f0245b5f83f21e75e8bf Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:10:04 -0500 Subject: [PATCH 11/19] Update I2C pins via suggestoin from @CDarius Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 010721d99d833..13f75e8f70eea 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -65,7 +65,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // Other { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, From 7811adcd6a29382863d58a47e96112285dadecd8 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:11:14 -0500 Subject: [PATCH 12/19] improve display init, thanks @CDarius Co-authored-by: CDarius --- .../boards/m5stack_cardputer/board.c | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/board.c b/ports/espressif/boards/m5stack_cardputer/board.c index 8716cf5416559..f8068d3b54abb 100644 --- a/ports/espressif/boards/m5stack_cardputer/board.c +++ b/ports/espressif/boards/m5stack_cardputer/board.c @@ -37,36 +37,23 @@ fourwire_fourwire_obj_t board_display_obj; #define DELAY 0x80 -// display init sequence according to LilyGO example app uint8_t display_init_sequence[] = { - // sw reset - 0x01, 0 | DELAY, 150, - // sleep out - 0x11, 0 | DELAY, 255, - // normal display mode on - 0x13, 0, - // display and color format settings - 0x36, 1, 0x68, - 0xB6, 2, 0x0A, 0x82, - 0x3A, 1 | DELAY, 0x55, 10, - // ST7789V frame rate setting - 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, - // voltages: VGH / VGL - 0xB7, 1, 0x35, - // ST7789V power setting - 0xBB, 1, 0x28, - 0xC0, 1, 0x0C, - 0xC2, 2, 0x01, 0xFF, - 0xC3, 1, 0x10, - 0xC4, 1, 0x20, - 0xC6, 1, 0x0F, - 0xD0, 2, 0xA4, 0xA1, - // ST7789V gamma setting - 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, - 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E, + // SWRESET and Delay 140ms + 0x01, 0 | DELAY, 140, + // SLPOUT and Delay 10ms + 0x11, 0 | DELAY, 10, + // COLMOD 65k colors and 16 bit 5-6-5 + 0x3A, 1, 0x55, + // INVON Iiversion on 0x21, 0, - // display on - 0x29, 0 | DELAY, 255, + // NORON normal operation (full update) + 0x13, 0, + // MADCTL columns RTL, page/column reverse order + 0x36, 1, 0x60, + // RAMCTRL color word little endian + 0xB0, 2, 0x00, 0xF8, + // DIPON display on + 0x29, 0, }; From 3c6d33a1d1b10b763a8464d589ebd47004051813 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:12:09 -0500 Subject: [PATCH 13/19] don't swap word in software Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/board.c b/ports/espressif/boards/m5stack_cardputer/board.c index f8068d3b54abb..55e862f8ff497 100644 --- a/ports/espressif/boards/m5stack_cardputer/board.c +++ b/ports/espressif/boards/m5stack_cardputer/board.c @@ -89,7 +89,7 @@ void board_init(void) { false, // pixels in a byte share a row. Only valid for depths < 8 1, // bytes per cell. Only valid for depths < 8 false, // reverse_pixels_in_byte. Only valid for depths < 8 - true, // reverse_pixels_in_word + false, // reverse_pixels_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command MIPI_COMMAND_WRITE_MEMORY_START, // write memory command From be6804c2c24bc8e637bdf5a9abcfb633b8de3e74 Mon Sep 17 00:00:00 2001 From: James Nadeau Date: Thu, 15 Feb 2024 16:13:22 -0500 Subject: [PATCH 14/19] remove UART per suggestion --- ports/espressif/boards/m5stack_cardputer/pins.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 010721d99d833..fd83af7736620 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -67,7 +67,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; From 9d97f79e9edce0cdeb56a68f1c5c59d0e38e2166 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:14:16 -0500 Subject: [PATCH 15/19] Update ports/espressif/boards/m5stack_cardputer/board.c Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/board.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/board.c b/ports/espressif/boards/m5stack_cardputer/board.c index 55e862f8ff497..e055cfcbc7498 100644 --- a/ports/espressif/boards/m5stack_cardputer/board.c +++ b/ports/espressif/boards/m5stack_cardputer/board.c @@ -108,16 +108,6 @@ void board_init(void) { ); } -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Override the I2C/TFT power pin reset to prevent resetting the display. - if (pin_number == 21) { - // Turn on TFT and I2C - gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(21, true); - return true; - } - return false; -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. From 8bb01a8a96e84af1b48bba4b8c9ccd627070f652 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:15:20 -0500 Subject: [PATCH 16/19] @CDarius found hte correct backlight PWM Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/board.c b/ports/espressif/boards/m5stack_cardputer/board.c index e055cfcbc7498..9546f4efbeaa7 100644 --- a/ports/espressif/boards/m5stack_cardputer/board.c +++ b/ports/espressif/boards/m5stack_cardputer/board.c @@ -104,7 +104,7 @@ void board_init(void) { 60, // native_frames_per_second true, // backlight_on_high false, // SH1107_addressing - 50000 // backlight pwm frequency + 350 // backlight pwm frequency ); } From 2874dc297a0dfdd2c22ab12017be0d2b3325aa98 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:16:44 -0500 Subject: [PATCH 17/19] configure 2 default spi's thanks @CDarius Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/mpconfigboard.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h index bdb1b77b09b73..7a726dfdc0690 100644 --- a/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_cardputer/mpconfigboard.h @@ -32,6 +32,6 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO34) +#define CIRCUITPY_BOARD_SPI (2) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO36, .mosi = &pin_GPIO35}, \ + {.clock = &pin_GPIO40, .mosi = &pin_GPIO14, .miso = &pin_GPIO39}} From baf0e0022b1bd5daf8b1ffdc07597d8471597aa1 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 15 Feb 2024 16:17:16 -0500 Subject: [PATCH 18/19] set up dual spi busses Co-authored-by: CDarius --- ports/espressif/boards/m5stack_cardputer/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index 13f75e8f70eea..0f9bcc6e41cf8 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -1,7 +1,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-module/displayio/__init__.h" - +CIRCUITPY_BOARD_BUS_SINGLETON(sd_spi, spi, 1) STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS From d532aaf496f3cd97a591b3842ba83f891ebbabb2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 6 Mar 2024 14:58:38 -0600 Subject: [PATCH 19/19] expose both SPI bus on board --- ports/espressif/boards/m5stack_cardputer/pins.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_cardputer/pins.c b/ports/espressif/boards/m5stack_cardputer/pins.c index c6e976348c685..b0c4c604265f5 100644 --- a/ports/espressif/boards/m5stack_cardputer/pins.c +++ b/ports/espressif/boards/m5stack_cardputer/pins.c @@ -66,7 +66,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // Other { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_TFT_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_sd_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} };