From f0c6a8c49a3702aba4b41a4bb9c22d3e09e2247b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 1 Aug 2022 15:52:01 -0700 Subject: [PATCH] Odroid pin defs --- .../boards/hardkernel_odroid_go/board.c | 44 ++++++++--------- .../hardkernel_odroid_go/mpconfigboard.mk | 4 +- .../boards/hardkernel_odroid_go/pins.c | 47 +++++++++++++++++++ 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/ports/espressif/boards/hardkernel_odroid_go/board.c b/ports/espressif/boards/hardkernel_odroid_go/board.c index eff481e63d..2249adeacd 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/board.c +++ b/ports/espressif/boards/hardkernel_odroid_go/board.c @@ -35,31 +35,31 @@ #define DELAY 0x80 +// ILI9341 init sequence from: +// https://github.com/hardkernel/ODROID-GO-MicroPython/blob/loboris/odroid_go/utils/lcd/lcd.py#L55 uint8_t display_init_sequence[] = { 0x0f, 3, 0x03, 0x80, 0x02, // RDDSDR 0xcf, 3, 0x00, 0xcf, 0x30, // PWCRTLB - 0xed, 4, 0x64, 0x03, 0x12, 0x81, // PWRONCTRL, b"\x64\x03\x12\x81"), - 0xe8, 3, 0x85, 0x00, 0x78, // (_DTCTRLA, b"\x85\x00\x78"), - 0xcb, 5, 0x39, 0x2c, 0x00, 0x34, 0x02, // (_PWCTRLA, b"\x39\x2c\x00\x34\x02"), - 0xf7, 1, 0x20, // (_PRCTRL, b"\x20"), - 0xea, 2, 0x00, 0x00, // (_DTCTRLB, b"\x00\x00"), - 0xc0, 1, 0x1b, // (_PWCTRL1, b"\x1b"), - 0xc1, 1, 0x12, // (_PWCTRL2, b"\x12"), - 0xc5, 2, 0x3e, 0x3c, // (_VMCTRL1, b"\x3e\x3c"), - 0xc7, 1, 0x91, // (_VMCTRL2, b"\x91"), - 0x36, 1, 0xa8, // (_MADCTL, b"\xa8"), - 0x3a, 1, 0x55, // (_PIXSET, b"\x55"), - 0xb1, 2, 0x00, 0x1b, // (_FRMCTR1, b"\x00\x1b"), - 0xb6, 3, 0x0a, 0xa2, 0x27, // (_DISCTRL, b"\x0a\xa2\x27"), - 0xf6, 2, 0x01, 0x30, // (_INTFACE, b"\x01\x30"), - 0xf2, 1, 0x00, // (_ENA3G, b"\x00"), - 0x26, 1, 0x01, // (_GAMSET, b"\x01"), - 0xe0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00, - // (_PGAMCTRL, b"\x0f\x31\x2b\x0c\x0e\x08\x4e\xf1\x37\x07\x10\x03\x0e\x09\x00"), - 0xe1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xc1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f, - // (_NGAMCTRL, b"\x00\x0e\x14\x03\x11\x07\x31\xc1\x48\x08\x0f\x0c\x31\x36\x0f")): - 0x11, 0 | DELAY, 10, // _SLPOUT - 0x29, 0 | DELAY, 100, // _DISPON + 0xed, 4, 0x64, 0x03, 0x12, 0x81, // PWRONCTRL + 0xe8, 3, 0x85, 0x00, 0x78, // DTCTRLA + 0xcb, 5, 0x39, 0x2c, 0x00, 0x34, 0x02, // PWCTRLA + 0xf7, 1, 0x20, // PRCTRL + 0xea, 2, 0x00, 0x00, // DTCTRLB + 0xc0, 1, 0x1b, // PWCTRL1 + 0xc1, 1, 0x12, // PWCTRL2 + 0xc5, 2, 0x3e, 0x3c, // VMCTRL1 + 0xc7, 1, 0x91, // VMCTRL2 + 0x36, 1, 0xa8, // MADCTL + 0x3a, 1, 0x55, // PIXSET + 0xb1, 2, 0x00, 0x1b, // FRMCTR1 + 0xb6, 3, 0x0a, 0xa2, 0x27, // DISCTRL + 0xf6, 2, 0x01, 0x30, // INTFACE + 0xf2, 1, 0x00, // ENA3G + 0x26, 1, 0x01, // GAMSET + 0xe0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00, // PGAMCTRL + 0xe1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xc1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f, // NGAMCTRL + 0x11, 0 | DELAY, 10, // SLPOUT + 0x29, 0 | DELAY, 100, // DISPON }; void board_init(void) { diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk index 1e08a80972..80cd6cd11c 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk @@ -1,5 +1,5 @@ -CIRCUITPY_CREATOR_ID = 0x0000239A -CIRCUITPY_CREATION_ID = 0x00320002 +CIRCUITPY_CREATOR_ID = 0x0D10D000 +CIRCUITPY_CREATION_ID = 0x00320060 IDF_TARGET = esp32 diff --git a/ports/espressif/boards/hardkernel_odroid_go/pins.c b/ports/espressif/boards/hardkernel_odroid_go/pins.c index 4d4ff5258e..c7152bf365 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/pins.c +++ b/ports/espressif/boards/hardkernel_odroid_go/pins.c @@ -1,10 +1,57 @@ #include "shared-bindings/board/__init__.h" +// Pin names from: https://wiki.odroid.com/odroid_go/odroid_go + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + // Left side + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_START), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_AXIS_X), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_AXIS_Y), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_A), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_B), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER_IN_M), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER_IN_P), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_SELECT), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT_PWM), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_EXT3), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_MENU), MP_ROM_PTR(&pin_GPIO13) }, + + // Right side. + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_EXT8), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_EXT7), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_EXT2), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_EXT5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_BTN_VOLUME), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_EXT4), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);