Skip to content

Commit 41d8d91

Browse files
committed
add grayscale support (need to go back and fix tricolor)
1 parent 0b3d7e7 commit 41d8d91

File tree

2 files changed

+91
-55
lines changed

2 files changed

+91
-55
lines changed

src/drivers/Adafruit_IL91874.cpp

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -184,61 +184,9 @@ void Adafruit_IL91874::powerUp() {
184184
}
185185
EPD_commandList(init_code);
186186

187-
/*
188-
EPD_command(IL91874_POWER_ON);
189-
busy_wait();
190-
191-
buf[0] = 0xAF;
192-
EPD_command(IL91874_PANEL_SETTING, buf, 1);
193-
194-
buf[0] = 0x3a;
195-
EPD_command(IL91874_PLL, buf, 1);
196-
197-
buf[0] = 0x03;
198-
buf[1] = 0x00;
199-
buf[2] = 0x2b;
200-
buf[3] = 0x2b;
201-
buf[4] = 0x09;
202-
EPD_command(IL91874_POWER_SETTING, buf, 5);
203-
204-
buf[0] = 0x07;
205-
buf[1] = 0x07;
206-
buf[2] = 0x017;
207-
EPD_command(IL91874_BOOSTER_SOFT_START, buf, 3);
208-
209-
buf[0] = 0x60;
210-
buf[1] = 0xA5;
211-
EPD_command(0xF8, buf, 2);
212-
213-
buf[0] = 0x89;
214-
buf[1] = 0xA5;
215-
EPD_command(0xF8, buf, 2);
216-
217-
buf[0] = 0x90;
218-
buf[1] = 0x00;
219-
EPD_command(0xF8, buf, 2);
220-
221-
buf[0] = 0x93;
222-
buf[1] = 0x2A;
223-
EPD_command(0xF8, buf, 2);
224-
225-
buf[0] = 0x73;
226-
buf[1] = 0x41;
227-
EPD_command(0xF8, buf, 2);
228-
229-
buf[0] = 0x12;
230-
EPD_command(IL91874_VCM_DC_SETTING, buf, 1);
231-
232-
buf[0] = 0x87;
233-
EPD_command(IL91874_CDI, buf, 1);
234-
235-
EPD_command(IL91874_LUT1, lut_vcomDC, 44);
236-
EPD_command(IL91874_LUTWW, lut_ww, 42);
237-
EPD_command(IL91874_LUTBW, lut_bw, 42);
238-
EPD_command(IL91874_LUTWB, lut_wb, 42);
239-
EPD_command(IL91874_LUTBB, lut_bb, 42);
240-
241-
*/
187+
if (_epd_lut_code) {
188+
EPD_commandList(_epd_lut_code);
189+
}
242190

243191
buf[0] = (HEIGHT >> 8) & 0xFF;
244192
buf[1] = HEIGHT & 0xFF;

src/panels/ThinkInk_270_Grayscale4_W3.h

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,84 @@
33

44
#include "Adafruit_EPD.h"
55

6+
// clang-format off
7+
8+
static const uint8_t ti_270w3_gray4_init_code[] {
9+
IL91874_POWER_SETTING, 4, 0x03, 0x00, 0x2b, 0x2b,
10+
IL91874_BOOSTER_SOFT_START, 3, 0x07, 0x07, 0x17,
11+
0xF8, 2, 0x60, 0xA5, // boost
12+
0xF8, 2, 0x89, 0xA5, // boost
13+
0xF8, 2, 0x90, 0x00, // boost
14+
0xF8, 2, 0x93, 0x2A, // boost
15+
0xF8, 2, 0xA0, 0xA5, // boost
16+
0xF8, 2, 0xA1, 0x00, // boost
17+
0xF8, 2, 0x73, 0x41, // boost
18+
IL91874_PDRF, 1, 0x00,
19+
IL91874_POWER_ON, 0,
20+
0xFF, 200,
21+
IL91874_PANEL_SETTING, 1, 0xBF,
22+
IL91874_PLL, 1, 0x90,
23+
IL91874_VCM_DC_SETTING, 1, 0x12,
24+
IL91874_CDI, 1, 0x97,
25+
0xFE // EOM
26+
};
27+
28+
29+
static const uint8_t ti_270w3_gray4_lut_code[] = {
30+
// const unsigned char lut_vcom[]PROGMEM =
31+
IL91874_LUT1, 44,
32+
0x00, 0x00,
33+
0x00 , 0x0A, 0x00, 0x00, 0x00, 0x01,
34+
0x60, 0x14, 0x14, 0x00, 0x00, 0x01,
35+
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
36+
0x00, 0x13, 0x0A, 0x01, 0x00, 0x01,
37+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40+
41+
// const unsigned char lut_ww[]PROGMEM ={
42+
IL91874_LUTWW, 42,
43+
0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,
44+
0x90, 0x14, 0x14, 0x00, 0x00, 0x01,
45+
0x10, 0x14, 0x0A, 0x00, 0x00, 0x01,
46+
0xA0, 0x13, 0x01, 0x00, 0x00, 0x01,
47+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50+
51+
// const unsigned char lut_bw[]PROGMEM ={
52+
IL91874_LUTBW, 42,
53+
0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,
54+
0x90, 0x14, 0x14, 0x00, 0x00, 0x01,
55+
0x00, 0x14, 0x0A, 0x00, 0x00, 0x01,
56+
0x99, 0x0C, 0x01, 0x03, 0x04, 0x01,
57+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60+
61+
// const unsigned char lut_wb[]PROGMEM ={
62+
IL91874_LUTWB, 42,
63+
0x40, 0x0A, 0x00, 0x00, 0x00, 0x01,
64+
0x90, 0x14, 0x14, 0x00, 0x00, 0x01,
65+
0x00, 0x14, 0x0A, 0x00, 0x00, 0x01,
66+
0x99, 0x0B, 0x04, 0x04, 0x01, 0x01,
67+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70+
71+
// const unsigned char lut_bb[]PROGMEM ={
72+
IL91874_LUTBB, 42,
73+
0x80, 0x0A, 0x00, 0x00, 0x00, 0x01,
74+
0x90, 0x14, 0x14, 0x00, 0x00, 0x01,
75+
0x20, 0x14, 0x0A, 0x00, 0x00, 0x01,
76+
0x50, 0x13, 0x01, 0x00, 0x00, 0x01,
77+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80+
};
81+
82+
// clang-format on
83+
684
class ThinkInk_270_Grayscale4_W3 : public Adafruit_IL91874 {
785
private:
886
public:
@@ -31,6 +109,16 @@ class ThinkInk_270_Grayscale4_W3 : public Adafruit_IL91874 {
31109
layer_colors[EPD_LIGHT] = 0b00;
32110
layer_colors[EPD_DARK] = 0b10;
33111
}
112+
if (mode == THINKINK_GRAYSCALE4) {
113+
_epd_init_code = ti_270w3_gray4_init_code;
114+
_epd_lut_code = ti_270w3_gray4_lut_code;
115+
layer_colors[EPD_WHITE] = 0b00;
116+
layer_colors[EPD_BLACK] = 0b11;
117+
layer_colors[EPD_RED] = 0b10;
118+
layer_colors[EPD_GRAY] = 0b10;
119+
layer_colors[EPD_LIGHT] = 0b10;
120+
layer_colors[EPD_DARK] = 0b01;
121+
}
34122

35123
default_refresh_delay = 1000;
36124
powerDown();

0 commit comments

Comments
 (0)