From b368950f02ac4f81b132c75fa1bf9bf09c5d52de Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 27 Jul 2023 17:12:09 +0100 Subject: [PATCH] PicoGraphics: Add Pico W Explorer SPI pins. --- micropython/modules/picographics/picographics.c | 1 + micropython/modules/picographics/picographics.cpp | 4 +++- micropython/modules/picographics/picographics.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/micropython/modules/picographics/picographics.c b/micropython/modules/picographics/picographics.c index 3a620256..01c58763 100644 --- a/micropython/modules/picographics/picographics.c +++ b/micropython/modules/picographics/picographics.c @@ -155,6 +155,7 @@ STATIC const mp_map_elem_t picographics_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_DISPLAY_STELLAR_UNICORN), MP_ROM_INT(DISPLAY_STELLAR_UNICORN) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY_UNICORN_PACK), MP_ROM_INT(DISPLAY_UNICORN_PACK) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY_SCROLL_PACK), MP_ROM_INT(DISPLAY_SCROLL_PACK) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY_PICO_W_EXPLORER), MP_ROM_INT(DISPLAY_PICO_W_EXPLORER) }, { MP_ROM_QSTR(MP_QSTR_PEN_1BIT), MP_ROM_INT(PEN_1BIT) }, { MP_ROM_QSTR(MP_QSTR_PEN_P4), MP_ROM_INT(PEN_P4) }, diff --git a/micropython/modules/picographics/picographics.cpp b/micropython/modules/picographics/picographics.cpp index ed269185..56dde371 100644 --- a/micropython/modules/picographics/picographics.cpp +++ b/micropython/modules/picographics/picographics.cpp @@ -61,10 +61,10 @@ bool get_display_settings(PicoGraphicsDisplay display, int &width, int &height, if(pen_type == -1) pen_type = PEN_RGB332; break; case DISPLAY_PICO_DISPLAY_2: + case DISPLAY_PICO_W_EXPLORER: width = 320; height = 240; bus_type = BUS_SPI; - // Tufty display is upside-down if(rotate == -1) rotate = (int)Rotation::ROTATE_0; if(pen_type == -1) pen_type = PEN_RGB332; break; @@ -325,6 +325,8 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size spi_bus = {PIMORONI_SPI_DEFAULT_INSTANCE, SPI_BG_FRONT_CS, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 20, PIN_UNUSED}; } else if (display == DISPLAY_GFX_PACK) { spi_bus = {PIMORONI_SPI_DEFAULT_INSTANCE, 17, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 20, 9}; + } else if (display == DISPLAY_PICO_W_EXPLORER) { + spi_bus = {PIMORONI_SPI_DEFAULT_INSTANCE, 17, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, SPI_DEFAULT_MISO, 9}; } } } diff --git a/micropython/modules/picographics/picographics.h b/micropython/modules/picographics/picographics.h index 4d64d5a0..2503cbbf 100644 --- a/micropython/modules/picographics/picographics.h +++ b/micropython/modules/picographics/picographics.h @@ -28,7 +28,8 @@ enum PicoGraphicsDisplay { DISPLAY_COSMIC_UNICORN, DISPLAY_STELLAR_UNICORN, DISPLAY_UNICORN_PACK, - DISPLAY_SCROLL_PACK + DISPLAY_SCROLL_PACK, + DISPLAY_PICO_W_EXPLORER }; enum PicoGraphicsPenType {