|
14 | 14 | #include "shared-bindings/board/__init__.h"
|
15 | 15 | #include "shared-bindings/digitalio/DigitalInOut.h"
|
16 | 16 |
|
17 |
| -#define DELAY 0x80 |
18 | 17 | #define HEIGHT 300
|
19 | 18 | #define WIDTH 400
|
20 | 19 |
|
| 20 | +// Sequences pulled from InkyWhat driver (https://github.com/alanta/CircuitPython_InkyWhat) |
21 | 21 | uint8_t start_sequence[] = {
|
22 |
| - 0x01, 0x04, 0x03, 0x00, 0x2b, 0x2b, // power setting |
23 |
| - 0x06, 0x03, 0x17, 0x17, 0x17, // booster soft start |
24 |
| - 0x04, 0x80, 0xc8, // power on and wait 200 ms |
25 |
| - 0x00, 0x01, 0x0f, // panel setting |
26 |
| - 0x61, 0x04, (HEIGHT >> 8) & 0xFF, HEIGHT & 0xFF, (WIDTH >> 8) & 0xFF, WIDTH & 0xFF // Resolution |
| 22 | + 0x12, 0x80, 0x80, // Software reset ✅ TODO wait for busy instead of fixed delay |
| 23 | + 0x12, 0x80, 0x80, // Software reset ✅ TODO wait for busy instead of fixed delay |
| 24 | + 0x74, 0x01, 0x54, // set analog block control ✅ |
| 25 | + 0x7e, 0x01, 0x3b, // set digital block control ✅ |
| 26 | + 0x01, 0x03, 0x2b, 0x01, 0x00, // driver output control |
| 27 | + 0x03, 0x01, 0x17, // Gate driving voltage ✅ |
| 28 | + 0x04, 0x03, 0x07, 0xac, 0x32, // Source Driving voltage ✅ |
| 29 | + 0x3a, 0x01, 0x07, // Dummy line period ✅ |
| 30 | + 0x3b, 0x01, 0x04, // Gate line width ✅ |
| 31 | + 0x3c, 0x01, 0x00, // Border color |
| 32 | + 0x2c, 0x01, 0x3c, // VCOM Register, 0x3c = -1.5v? ✅ |
| 33 | + 0x22, 0x01, 0xc7, // Display update sequence ✅ |
| 34 | + 0x04, 0x03, 0x07, 0xac, 0x32, // Set voltage of VSH and VSL (yellow) |
| 35 | + // LUT (yellow) |
| 36 | + 0x32, 0x46, |
| 37 | + 0xfa, 0x94, 0x8c, 0xc0, 0xd0, 0x00, 0x00, |
| 38 | + 0xfa, 0x94, 0x2c, 0x80, 0xe0, 0x00, 0x00, |
| 39 | + 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 40 | + 0xfa, 0x94, 0xf8, 0x80, 0x50, 0x00, 0xcc, |
| 41 | + 0xbf, 0x58, 0xfc, 0x80, 0xd0, 0x00, 0x11, |
| 42 | + 0x40, 0x10, 0x40, 0x10, 0x08, |
| 43 | + 0x08, 0x10, 0x04, 0x04, 0x10, |
| 44 | + 0x08, 0x08, 0x03, 0x08, 0x20, |
| 45 | + 0x08, 0x04, 0x00, 0x00, 0x10, |
| 46 | + 0x10, 0x08, 0x08, 0x00, 0x20, |
| 47 | + 0x00, 0x00, 0x00, 0x00, 0x00, |
| 48 | + 0x00, 0x00, 0x00, 0x00, 0x00, |
| 49 | + 0x11, 0x01, 0x03, // Data entry mode setting 0x03 = X/Y increment ✅ |
| 50 | + // self._send_command(0x44, [0x00, (self.cols // 8) - 1]) # Set RAM X Start/End |
| 51 | + 0x44, 0x02, 0x00, 0x31, // Set RAM X Start/End |
| 52 | + // self._send_command(0x45, [0x00, 0x00] + packed_height) # Set RAM Y Start/End |
| 53 | + 0x45, 0x04, 0x00, 0x00, 0x2b, 0x01, // Set RAM Y Start/End |
27 | 54 | };
|
28 | 55 |
|
29 | 56 | uint8_t stop_sequence[] = {
|
30 |
| - 0x50, 0x01, 0xf7, // CDI setting |
31 |
| - 0x02, 0x80, 0xf0 // Power off |
| 57 | + 0x10, 0x01, 0x01 // Enter Deep Sleep |
32 | 58 | };
|
33 | 59 |
|
34 | 60 | uint8_t refresh_sequence[] = {
|
35 |
| - 0x12, 0x00 |
| 61 | + 0x20, 0x00 |
36 | 62 | };
|
37 | 63 |
|
38 | 64 | void board_init(void) {
|
@@ -79,11 +105,11 @@ void board_init(void) {
|
79 | 105 | 90, // rotation
|
80 | 106 | NO_COMMAND, // set_column_window_command
|
81 | 107 | NO_COMMAND, // set_row_window_command
|
82 |
| - NO_COMMAND, // set_current_column_command |
83 |
| - NO_COMMAND, // set_current_row_command |
84 |
| - 0x13, // write_black_ram_command |
| 108 | + 0x4E, // set_current_column_command |
| 109 | + 0x4F, // set_current_row_command |
| 110 | + 0x24, // write_black_ram_command |
85 | 111 | false, // black_bits_inverted
|
86 |
| - NO_COMMAND, // write_color_ram_command (can add this for grayscale eventually) |
| 112 | + 0x26, // write_color_ram_command (can add this for grayscale eventually) |
87 | 113 | false, // color_bits_inverted
|
88 | 114 | 0x000000, // highlight_color
|
89 | 115 | refresh_sequence, // refresh_display_sequence
|
|
0 commit comments