|
5 | 5 | // SPDX-License-Identifier: MIT
|
6 | 6 |
|
7 | 7 | #include "supervisor/board.h"
|
8 |
| - |
9 |
| -// Below section commented out due to LCD not being included by default with StampS3 |
10 |
| -// Can be re-enabled to add LCD functionality included by Cardputer replacement kit |
11 |
| - |
12 |
| -/* |
13 |
| -
|
14 |
| -#include "mpconfigboard.h" |
15 |
| -#include "supervisor/shared/serial.h" |
16 |
| -#include "shared-bindings/busio/SPI.h" |
17 |
| -#include "shared-bindings/fourwire/FourWire.h" |
18 |
| -#include "shared-bindings/microcontroller/Pin.h" |
19 |
| -#include "shared-module/displayio/__init__.h" |
20 |
| -#include "shared-module/displayio/mipi_constants.h" |
21 |
| -#include "shared-bindings/board/__init__.h" |
22 |
| -#include "py/runtime.h" |
23 |
| -#include "py/ringbuf.h" |
24 |
| -#include "shared/runtime/interrupt_char.h" |
25 |
| -
|
26 |
| -
|
27 |
| -#define DELAY 0x80 |
28 |
| -
|
29 |
| -uint8_t display_init_sequence[] = { |
30 |
| - // SWRESET and Delay 140ms |
31 |
| - 0x01, 0 | DELAY, 140, |
32 |
| - // SLPOUT and Delay 10ms |
33 |
| - 0x11, 0 | DELAY, 10, |
34 |
| - // COLMOD 65k colors and 16 bit 5-6-5 |
35 |
| - 0x3A, 1, 0x55, |
36 |
| - // INVON Iiversion on |
37 |
| - 0x21, 0, |
38 |
| - // NORON normal operation (full update) |
39 |
| - 0x13, 0, |
40 |
| - // MADCTL columns RTL, page/column reverse order |
41 |
| - 0x36, 1, 0x60, |
42 |
| - // RAMCTRL color word little endian |
43 |
| - 0xB0, 2, 0x00, 0xF8, |
44 |
| - // DIPON display on |
45 |
| - 0x29, 0, |
46 |
| -}; |
47 |
| -
|
48 |
| -
|
49 |
| -// Overrides the weakly linked function from supervisor/shared/board.c |
50 |
| -void board_init(void) { |
51 |
| - busio_spi_obj_t *spi = common_hal_board_create_spi(0); |
52 |
| - fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; |
53 |
| - bus->base.type = &fourwire_fourwire_type; |
54 |
| -
|
55 |
| - // see here for inspiration: https://github.com/m5stack/M5GFX/blob/33d7d3135e816a86a008fae8ab3757938cee95d2/src/M5GFX.cpp#L1350 |
56 |
| - common_hal_fourwire_fourwire_construct( |
57 |
| - bus, |
58 |
| - spi, |
59 |
| - &pin_GPIO34, // DC |
60 |
| - &pin_GPIO37, // CS |
61 |
| - &pin_GPIO33, // RST |
62 |
| - 40000000, // baudrate |
63 |
| - 0, // polarity |
64 |
| - 0 // phase |
65 |
| - ); |
66 |
| - busdisplay_busdisplay_obj_t *display = &allocate_display()->display; |
67 |
| - display->base.type = &busdisplay_busdisplay_type; |
68 |
| -
|
69 |
| - common_hal_busdisplay_busdisplay_construct( |
70 |
| - display, |
71 |
| - bus, |
72 |
| - 240, // width (after rotation) |
73 |
| - 135, // height (after rotation) |
74 |
| - 40, // column start |
75 |
| - 53, // row start |
76 |
| - 0, // rotation |
77 |
| - 16, // color depth |
78 |
| - false, // grayscale |
79 |
| - false, // pixels in a byte share a row. Only valid for depths < 8 |
80 |
| - 1, // bytes per cell. Only valid for depths < 8 |
81 |
| - false, // reverse_pixels_in_byte. Only valid for depths < 8 |
82 |
| - false, // reverse_pixels_in_word |
83 |
| - MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command |
84 |
| - MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command |
85 |
| - MIPI_COMMAND_WRITE_MEMORY_START, // write memory command |
86 |
| - display_init_sequence, |
87 |
| - sizeof(display_init_sequence), |
88 |
| - &pin_GPIO38, // backlight pin |
89 |
| - NO_BRIGHTNESS_COMMAND, |
90 |
| - 1.0f, // brightness |
91 |
| - false, // single_byte_bounds |
92 |
| - false, // data_as_commands |
93 |
| - true, // auto_refresh |
94 |
| - 60, // native_frames_per_second |
95 |
| - true, // backlight_on_high |
96 |
| - false, // SH1107_addressing |
97 |
| - 350 // backlight pwm frequency |
98 |
| - ); |
99 |
| -} |
100 |
| -
|
101 |
| -// TODO: Should we turn off the display when asleep, in board_deinit() ? |
102 |
| -
|
103 |
| -*/ |
0 commit comments