|
22 | 22 |
|
23 | 23 | #define DELAY 0x80 |
24 | 24 |
|
25 | | -// ST7789V display init sequence for 320x240 |
| 25 | +// ST7789V display init sequence for 320x240 parallel bus |
| 26 | +// Based on Pimoroni's pimoroni-pico ST7789 driver configuration |
26 | 27 | uint8_t display_init_sequence[] = { |
27 | | - // sw reset |
| 28 | + // Software reset |
28 | 29 | 0x01, 0 | DELAY, 150, |
29 | | - // sleep out |
| 30 | + // Sleep out |
30 | 31 | 0x11, 0 | DELAY, 255, |
31 | | - // colmod 16-bit color |
32 | | - 0x3A, 1 | DELAY, 0x55, 10, |
33 | | - // inversion on |
34 | | - 0x21, 0 | DELAY, 10, |
35 | | - // normal display mode on |
| 32 | + // Tearing effect line on (frame sync) |
| 33 | + 0x35, 1, 0x00, |
| 34 | + // COLMOD: 16-bit color (5-6-5 RGB) |
| 35 | + 0x3A, 1, 0x55, |
| 36 | + // Porch control (PORCTRL) |
| 37 | + 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, |
| 38 | + // Gate control (GCTRL) - VGH=13.26V, VGL=-10.43V |
| 39 | + 0xB7, 1, 0x35, |
| 40 | + // VCOM setting (VCOMS) |
| 41 | + 0xBB, 1, 0x1F, |
| 42 | + // LCM control (LCMCTRL) |
| 43 | + 0xC0, 1, 0x2C, |
| 44 | + // VDV and VRH command enable (VDVVRHEN) |
| 45 | + 0xC2, 1, 0x01, |
| 46 | + // VRH set (VRHS) |
| 47 | + 0xC3, 1, 0x12, |
| 48 | + // VDV set (VDVS) |
| 49 | + 0xC4, 1, 0x20, |
| 50 | + // Frame rate control (FRCTRL2) |
| 51 | + 0xC6, 1, 0x0F, |
| 52 | + // Power control 1 (PWCTRL1) |
| 53 | + 0xD0, 2, 0xA4, 0xA1, |
| 54 | + // RAM control (RAMCTRL) - for proper endianness |
| 55 | + 0xB0, 2, 0x00, 0xC0, |
| 56 | + // Positive gamma correction |
| 57 | + 0xE0, 14, 0xD0, 0x08, 0x11, 0x08, 0x0C, 0x15, 0x39, 0x33, 0x50, 0x36, 0x13, 0x14, 0x29, 0x2D, |
| 58 | + // Negative gamma correction |
| 59 | + 0xE1, 14, 0xD0, 0x08, 0x10, 0x08, 0x06, 0x06, 0x39, 0x44, 0x51, 0x0B, 0x16, 0x14, 0x2F, 0x31, |
| 60 | + // Inversion on |
| 61 | + 0x21, 0, |
| 62 | + // Normal display mode on |
36 | 63 | 0x13, 0 | DELAY, 10, |
37 | | - // MADCTL: row/column addressing order and RGB/BGR |
38 | | - 0x36, 1, 0x00, |
39 | | - // display on |
40 | | - 0x29, 0 | DELAY, 255, |
| 64 | + // MADCTL: MX=0, MY=1, MV=1, ML=1 (COL_ORDER | SWAP_XY | SCAN_ORDER) = 0x70 |
| 65 | + // This configures the 320x240 display in landscape orientation |
| 66 | + 0x36, 1, 0x70, |
| 67 | + // Display on |
| 68 | + 0x29, 0 | DELAY, 100, |
41 | 69 | }; |
42 | 70 |
|
43 | 71 | static void display_init(void) { |
|
0 commit comments