Skip to content

Commit b1c572e

Browse files
committed
Fixup the pybadge definition so the screen works.
1 parent 37e10d4 commit b1c572e

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

ports/atmel-samd/boards/pybadge/board.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "boards/board.h"
2828
#include "mpconfigboard.h"
2929
#include "hal/include/hal_gpio.h"
30+
#include "shared-bindings/busio/SPI.h"
3031
#include "shared-bindings/displayio/FourWire.h"
3132
#include "shared-module/displayio/__init__.h"
3233
#include "shared-module/displayio/mipi_constants.h"
@@ -50,7 +51,7 @@ uint8_t display_init_sequence[] = {
5051
0xc4, 2, 0x8a, 0xee,
5152
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
5253
0x2a, 0, // _INVOFF
53-
0x36, 1, 0x18, // _MADCTL bottom to top refresh
54+
0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order.
5455
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
5556
// fix on VTL
5657
0x3a, 1, 0x05, // COLMOD - 16bit color
@@ -68,11 +69,16 @@ uint8_t display_init_sequence[] = {
6869
0x29, 0 | DELAY, 100, // _DISPON
6970
};
7071

72+
STATIC busio_spi_obj_t display_spi_obj;
73+
7174
void board_init(void) {
75+
common_hal_busio_spi_construct(&display_spi_obj, &pin_PB13, &pin_PB12, NULL);
76+
common_hal_busio_spi_never_reset(&display_spi_obj);
77+
7278
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
7379
bus->base.type = &displayio_fourwire_type;
7480
common_hal_displayio_fourwire_construct(bus,
75-
board_spi(),
81+
&display_spi_obj,
7682
&pin_PB05, // TFT_DC Command or data
7783
&pin_PB07, // TFT_CS Chip select
7884
&pin_PA01); // TFT_RST Reset
@@ -81,11 +87,11 @@ void board_init(void) {
8187
display->base.type = &displayio_display_type;
8288
common_hal_displayio_display_construct(display,
8389
bus,
84-
128, // Width
90+
160, // Width
8591
128, // Height
86-
2, // column start
87-
1, // row start
88-
0, // rotation
92+
0, // column start
93+
0, // row start
94+
270, // rotation
8995
16, // Color depth
9096
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
9197
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command

ports/atmel-samd/boards/pybadge/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#define CIRCUITPY_MCU_FAMILY samd51
55

66
// This is for Rev B
7-
#define MICROPY_HW_LED_STATUS (&pin_PA22)
7+
#define MICROPY_HW_LED_STATUS (&pin_PA23)
88

99
// These are pins not to reset.
1010
// QSPI Data pins

ports/atmel-samd/boards/pybadge/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LD_FILE = boards/samd51x19-bootloader-external-flash.ld
22
USB_VID = 0x239A
33
USB_PID = 0x802C
4-
USB_PRODUCT = "Pybadge"
4+
USB_PRODUCT = "PyBadge"
55
USB_MANUFACTURER = "Adafruit Industries LLC"
66

77
QSPI_FLASH_FILESYSTEM = 1

0 commit comments

Comments
 (0)