diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-03-08 15:30:31 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-03-12 11:18:29 -0700 |
| commit | b1c572e82ec94725cdead322267dfdf7b0b0ce1b (patch) | |
| tree | ce8ace12f4a9323efddf7af3fd30df36cb937ea0 | |
| parent | 37e10d4a812a119905ad7e5fcb1421d79c341f82 (diff) | |
Fixup the pybadge definition so the screen works.
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/board.c | 18 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/mpconfigboard.h | 2 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 6b6a65cbb..0881d8f45 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -27,6 +27,7 @@ #include "boards/board.h" #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" +#include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/FourWire.h" #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" @@ -50,7 +51,7 @@ uint8_t display_init_sequence[] = { 0xc4, 2, 0x8a, 0xee, 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V 0x2a, 0, // _INVOFF - 0x36, 1, 0x18, // _MADCTL bottom to top refresh + 0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order. // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color @@ -68,11 +69,16 @@ uint8_t display_init_sequence[] = { 0x29, 0 | DELAY, 100, // _DISPON }; +STATIC busio_spi_obj_t display_spi_obj; + void board_init(void) { + common_hal_busio_spi_construct(&display_spi_obj, &pin_PB13, &pin_PB12, NULL); + common_hal_busio_spi_never_reset(&display_spi_obj); + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, - board_spi(), + &display_spi_obj, &pin_PB05, // TFT_DC Command or data &pin_PB07, // TFT_CS Chip select &pin_PA01); // TFT_RST Reset @@ -81,11 +87,11 @@ void board_init(void) { display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, - 128, // Width + 160, // Width 128, // Height - 2, // column start - 1, // row start - 0, // rotation + 0, // column start + 0, // row start + 270, // rotation 16, // Color depth MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.h b/ports/atmel-samd/boards/pybadge/mpconfigboard.h index a72859fb0..36115bc87 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.h +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.h @@ -4,7 +4,7 @@ #define CIRCUITPY_MCU_FAMILY samd51 // This is for Rev B -#define MICROPY_HW_LED_STATUS (&pin_PA22) +#define MICROPY_HW_LED_STATUS (&pin_PA23) // These are pins not to reset. // QSPI Data pins diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index f4e8c977f..8ab759865 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -1,7 +1,7 @@ LD_FILE = boards/samd51x19-bootloader-external-flash.ld USB_VID = 0x239A USB_PID = 0x802C -USB_PRODUCT = "Pybadge" +USB_PRODUCT = "PyBadge" USB_MANUFACTURER = "Adafruit Industries LLC" QSPI_FLASH_FILESYSTEM = 1 |
