Skip to content

Commit cbae51c

Browse files
committed
PicoGraphics: Support for Explorer.
1 parent 40b67b7 commit cbae51c

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

drivers/st7789/st7789.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ namespace pimoroni {
5858
cs(pins.cs), dc(pins.dc), wr_sck(pins.wr_sck), rd_sck(pins.rd_sck), d0(pins.d0), bl(pins.bl) {
5959

6060
parallel_pio = pio1;
61+
pio_set_gpio_base(parallel_pio, d0 + 8 >= 32 ? 16 : 0);
6162
parallel_sm = pio_claim_unused_sm(parallel_pio, true);
6263
parallel_offset = pio_add_program(parallel_pio, &st7789_parallel_program);
63-
64+
6465
//gpio_init(wr_sck);
6566
//gpio_set_dir(wr_sck, GPIO_OUT);
6667
//gpio_set_function(wr_sck, GPIO_FUNC_SIO);

micropython/modules/picographics/picographics.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static const mp_map_elem_t picographics_globals_table[] = {
157157
{ MP_ROM_QSTR(MP_QSTR_DISPLAY_UNICORN_PACK), MP_ROM_INT(DISPLAY_UNICORN_PACK) },
158158
{ MP_ROM_QSTR(MP_QSTR_DISPLAY_SCROLL_PACK), MP_ROM_INT(DISPLAY_SCROLL_PACK) },
159159
{ MP_ROM_QSTR(MP_QSTR_DISPLAY_PICO_W_EXPLORER), MP_ROM_INT(DISPLAY_PICO_W_EXPLORER) },
160+
{ MP_ROM_QSTR(MP_QSTR_DISPLAY_EXPLORER), MP_ROM_INT(DISPLAY_EXPLORER) },
160161

161162
{ MP_ROM_QSTR(MP_QSTR_PEN_1BIT), MP_ROM_INT(PEN_1BIT) },
162163
{ MP_ROM_QSTR(MP_QSTR_PEN_P4), MP_ROM_INT(PEN_P4) },

micropython/modules/picographics/picographics.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ typedef struct _ModPicoGraphics_obj_t {
4444

4545
bool get_display_settings(PicoGraphicsDisplay display, int &width, int &height, int &rotate, int &pen_type, PicoGraphicsBusType &bus_type) {
4646
switch(display) {
47+
case DISPLAY_EXPLORER:
48+
width = 320;
49+
height = 240;
50+
bus_type = BUS_PARALLEL;
51+
if(rotate == -1) rotate = (int)Rotation::ROTATE_0;
52+
if(pen_type == -1) pen_type = PEN_RGB565;
53+
break;
4754
case DISPLAY_PICO_DISPLAY:
4855
width = 240;
4956
height = 135;
@@ -335,6 +342,10 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size
335342
} else if (display == DISPLAY_PICO_W_EXPLORER) {
336343
spi_bus = {PIMORONI_SPI_DEFAULT_INSTANCE, 17, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, SPI_DEFAULT_MISO, 9};
337344
}
345+
} else if (bus_type == BUS_PARALLEL) {
346+
if (display == DISPLAY_EXPLORER) {
347+
parallel_bus = {27, 28, 30, 31, 32, 26};
348+
}
338349
}
339350
}
340351

@@ -349,7 +360,8 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size
349360
// TODO grab BUSY and RESET from ARG_extra_pins
350361
self->display = m_new_class(Inky73, width, height, (Rotation)rotate, spi_bus);
351362

352-
} else if (display == DISPLAY_TUFTY_2040) {
363+
} else if (display == DISPLAY_TUFTY_2040
364+
|| display == DISPLAY_EXPLORER) {
353365
self->display = m_new_class(ST7789, width, height, (Rotation)rotate, parallel_bus);
354366

355367
} else if (display == DISPLAY_LCD_160X80) {

micropython/modules/picographics/picographics.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ enum PicoGraphicsDisplay {
3030
DISPLAY_STELLAR_UNICORN,
3131
DISPLAY_UNICORN_PACK,
3232
DISPLAY_SCROLL_PACK,
33-
DISPLAY_PICO_W_EXPLORER
33+
DISPLAY_PICO_W_EXPLORER,
34+
DISPLAY_EXPLORER
3435
};
3536

3637
enum PicoGraphicsPenType {

0 commit comments

Comments
 (0)