|
15 | 15 | #include "st7789_lcd.pio.h"
|
16 | 16 | #include "raspberry_256x256_rgb565.h"
|
17 | 17 |
|
| 18 | +// Tested with the parts that have the height of 240 and 320 |
18 | 19 | #define SCREEN_WIDTH 240
|
19 | 20 | #define SCREEN_HEIGHT 240
|
20 | 21 | #define IMAGE_SIZE 256
|
|
32 | 33 | // Format: cmd length (including cmd byte), post delay in units of 5 ms, then cmd payload
|
33 | 34 | // Note the delays have been shortened a little
|
34 | 35 | static const uint8_t st7789_init_seq[] = {
|
35 |
| - 1, 20, 0x01, // Software reset |
36 |
| - 1, 10, 0x11, // Exit sleep mode |
| 36 | + 1, 20, 0x01, // Software reset |
| 37 | + 1, 10, 0x11, // Exit sleep mode |
37 | 38 | 2, 2, 0x3a, 0x55, // Set colour mode to 16 bit
|
38 | 39 | 2, 0, 0x36, 0x00, // Set MADCTL: row then column, refresh is bottom to top ????
|
39 |
| - 5, 0, 0x2a, 0x00, 0x00, 0x00, 0xf0, // CASET: column addresses from 0 to 240 (f0) |
40 |
| - 5, 0, 0x2b, 0x00, 0x00, 0x00, 0xf0, // RASET: row addresses from 0 to 240 (f0) |
| 40 | + 5, 0, 0x2a, 0x00, 0x00, SCREEN_WIDTH >> 8, SCREEN_WIDTH & 0xff, // CASET: column addresses |
| 41 | + 5, 0, 0x2b, 0x00, 0x00, SCREEN_HEIGHT >> 8, SCREEN_HEIGHT & 0xff, // RASET: row addresses |
41 | 42 | 1, 2, 0x21, // Inversion on, then 10 ms delay (supposedly a hack?)
|
42 | 43 | 1, 2, 0x13, // Normal display on, then 10 ms delay
|
43 | 44 | 1, 2, 0x29, // Main screen turn on, then wait 500 ms
|
44 |
| - 0 // Terminate list |
| 45 | + 0 // Terminate list |
45 | 46 | };
|
46 | 47 |
|
47 | 48 | static inline void lcd_set_dc_cs(bool dc, bool cs) {
|
|
0 commit comments