Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_154_M09.cpp
Go to the documentation of this file.
1// Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
2// Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines!
3//
4// based on Demo Example from Good Display, available here: http://www.e-paper-display.com/download_detail/downloadsId=806.html
5// Panel: GDEW0154M09 : http://www.e-paper-display.com/products_detail/productId=513.html
6// Controller : JD79653A : http://www.e-paper-display.com/download_detail/downloadsId%3d943.html
7//
8// Author: Jean-Marc Zingg
9//
10// Version: see library.properties
11//
12// Library: https://github.com/ZinggJM/GxEPD2
13
14#include "GxEPD2_154_M09.h"
15
16GxEPD2_154_M09::GxEPD2_154_M09(int16_t cs, int16_t dc, int16_t rst, int16_t busy) :
17 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
18{
19}
20
21void GxEPD2_154_M09::clearScreen(uint8_t value)
22{
23 writeScreenBuffer(value);
24 refresh(true);
26}
27
29{
30 _initial_write = false; // initial full screen buffer clean done
31 if (!_using_partial_mode) _Init_Part();
32 _writeScreenBuffer(0x13, value); // set current
33 if (_initial_refresh) _writeScreenBuffer(0x26, value); // set previous
34}
35
37{
38 if (!_using_partial_mode) _Init_Part();
39 _writeScreenBuffer(0x10, value); // set previous
40}
41
42void GxEPD2_154_M09::_writeScreenBuffer(uint8_t command, uint8_t value)
43{
44 _writeCommand(command);
45 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
46 {
47 _writeData(value);
48 }
49}
50
51void GxEPD2_154_M09::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
52{
53 _writeImage(0x13, bitmap, x, y, w, h, invert, mirror_y, pgm);
54}
55
56void GxEPD2_154_M09::writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
57{
58 _writeImage(0x10, bitmap, x, y, w, h, invert, mirror_y, pgm);
59}
60
61void GxEPD2_154_M09::_writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
62{
63 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
64 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
65 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
66 x -= x % 8; // byte boundary
67 w = wb * 8; // byte boundary
68 int16_t x1 = x < 0 ? 0 : x; // limit
69 int16_t y1 = y < 0 ? 0 : y; // limit
70 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
71 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
72 int16_t dx = x1 - x;
73 int16_t dy = y1 - y;
74 w1 -= dx;
75 h1 -= dy;
76 if ((w1 <= 0) || (h1 <= 0)) return;
77 if (!_using_partial_mode) _Init_Part();
78 _writeCommand(0x91); // partial in
79 _setPartialRamArea(x1, y1, w1, h1);
80 _writeCommand(command);
81 for (int16_t i = 0; i < h1; i++)
82 {
83 for (int16_t j = 0; j < w1 / 8; j++)
84 {
85 uint8_t data;
86 // use wb, h of bitmap for index!
87 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
88 if (pgm)
89 {
90#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
91 data = pgm_read_byte(&bitmap[idx]);
92#else
93 data = bitmap[idx];
94#endif
95 }
96 else
97 {
98 data = bitmap[idx];
99 }
100 if (invert) data = ~data;
101 _writeData(data);
102 }
103 }
104 _writeCommand(0x92); // partial out
105 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
106}
107
108void GxEPD2_154_M09::writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
109 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
110{
111 _writeImagePart(0x13, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
112}
113
114void GxEPD2_154_M09::writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
115 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
116{
117 _writeImagePart(0x10, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
118}
119
120void GxEPD2_154_M09::_writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
121 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
122{
123 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
124 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
125 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
126 if ((x_part < 0) || (x_part >= w_bitmap)) return;
127 if ((y_part < 0) || (y_part >= h_bitmap)) return;
128 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
129 x_part -= x_part % 8; // byte boundary
130 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
131 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
132 x -= x % 8; // byte boundary
133 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
134 int16_t x1 = x < 0 ? 0 : x; // limit
135 int16_t y1 = y < 0 ? 0 : y; // limit
136 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
137 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
138 int16_t dx = x1 - x;
139 int16_t dy = y1 - y;
140 w1 -= dx;
141 h1 -= dy;
142 if ((w1 <= 0) || (h1 <= 0)) return;
143 if (!_using_partial_mode) _Init_Part();
144 _writeCommand(0x91); // partial in
145 _setPartialRamArea(x1, y1, w1, h1);
146 _writeCommand(command);
147 for (int16_t i = 0; i < h1; i++)
148 {
149 for (int16_t j = 0; j < w1 / 8; j++)
150 {
151 uint8_t data;
152 // use wb_bitmap, h_bitmap of bitmap for index!
153 int16_t idx = mirror_y ? x_part / 8 + j + dx / 8 + ((h_bitmap - 1 - (y_part + i + dy))) * wb_bitmap : x_part / 8 + j + dx / 8 + (y_part + i + dy) * wb_bitmap;
154 if (pgm)
155 {
156#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
157 data = pgm_read_byte(&bitmap[idx]);
158#else
159 data = bitmap[idx];
160#endif
161 }
162 else
163 {
164 data = bitmap[idx];
165 }
166 if (invert) data = ~data;
167 _writeData(data);
168 }
169 }
170 _writeCommand(0x92); // partial out
171 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
172}
173
174void GxEPD2_154_M09::writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
175{
176 if (black)
177 {
178 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
179 }
180}
181
182void GxEPD2_154_M09::writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
183 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
184{
185 if (black)
186 {
187 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
188 }
189}
190
191void GxEPD2_154_M09::writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
192{
193 if (data1)
194 {
195 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
196 }
197}
198
199void GxEPD2_154_M09::drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
200{
201 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
202 refresh(x, y, w, h);
203 writeImageAgain(bitmap, x, y, w, h, invert, mirror_y, pgm);
204}
205
206void GxEPD2_154_M09::drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
207 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
208{
209 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
210 refresh(x, y, w, h);
211 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
212}
213
214void GxEPD2_154_M09::drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
215{
216 if (black)
217 {
218 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
219 }
220}
221
222void GxEPD2_154_M09::drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
223 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
224{
225 if (black)
226 {
227 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
228 }
229}
230
231void GxEPD2_154_M09::drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
232{
233 if (data1)
234 {
235 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
236 }
237}
238
239void GxEPD2_154_M09::refresh(bool partial_update_mode)
240{
241 if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
242 else
243 {
244 if (_using_partial_mode) _Init_Full();
245 _Update_Full();
246 _initial_refresh = false; // initial full update done
247 }
248}
249
250void GxEPD2_154_M09::refresh(int16_t x, int16_t y, int16_t w, int16_t h)
251{
252 if (_initial_refresh) return refresh(false); // initial update needs be full update
253 // intersection with screen
254 int16_t w1 = x < 0 ? w + x : w; // reduce
255 int16_t h1 = y < 0 ? h + y : h; // reduce
256 int16_t x1 = x < 0 ? 0 : x; // limit
257 int16_t y1 = y < 0 ? 0 : y; // limit
258 w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit
259 h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit
260 if ((w1 <= 0) || (h1 <= 0)) return;
261 // make x1, w1 multiple of 8
262 w1 += x1 % 8;
263 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
264 x1 -= x1 % 8;
265 if (!_using_partial_mode) _Init_Part();
266 _writeCommand(0x91); // partial in
267 _setPartialRamArea(x1, y1, w1, h1);
268 _Update_Part();
269 _writeCommand(0x92); // partial out
270}
271
273{
274 _PowerOff();
275}
276
278{
279 _PowerOff();
280 if (_rst >= 0)
281 {
282 _writeCommand(0x07); // deep sleep
283 _writeData(0xA5); // check code
284 _hibernating = true;
285 }
286}
287
288void GxEPD2_154_M09::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
289{
290 uint16_t xe = (x + w - 1) | 0x0007; // byte boundary inclusive (last byte)
291 uint16_t ye = y + h - 1;
292 x &= 0xFFF8; // byte boundary
293 _writeCommand(0x90); // partial window
294 //_writeData(x / 256);
295 _writeData(x % 256);
296 //_writeData(xe / 256);
297 _writeData(xe % 256);
298 _writeData(y / 256);
299 _writeData(y % 256);
300 _writeData(ye / 256);
301 _writeData(ye % 256);
302 _writeData(0x01); // don't see any difference
303 //_writeData(0x00); // don't see any difference
304}
305
306void GxEPD2_154_M09::_PowerOn()
307{
308 if (!_power_is_on)
309 {
310 _writeCommand(0x04);
311 _waitWhileBusy("_PowerOn", power_on_time);
312 }
313 _power_is_on = true;
314}
315
316void GxEPD2_154_M09::_PowerOff()
317{
318 if (_power_is_on)
319 {
320 if (_using_partial_mode) _Update_Part(); // would hang on _powerOn() without
321 _writeCommand(0x02); // power off
322 _waitWhileBusy("_PowerOff", power_off_time);
323 _power_is_on = false;
324 _using_partial_mode = false;
325 }
326}
327
328void GxEPD2_154_M09::_InitDisplay()
329{
330 if (_hibernating) _reset();
331 _writeCommand(0x00); // panel setting
332 _writeData (0xff);
333 _writeData (0x0e);
334 _writeCommand(0x01); // power setting
335 _writeData(0x03);
336 _writeData(0x06); // 16V
337 _writeData(0x2A);//
338 _writeData(0x2A);//
339 _writeCommand(0x4D); // FITIinternal code
340 _writeData (0x55);
341 _writeCommand(0xaa);
342 _writeData (0x0f);
343 _writeCommand(0xE9);
344 _writeData (0x02);
345 _writeCommand(0xb6);
346 _writeData (0x11);
347 _writeCommand(0xF3);
348 _writeData (0x0a);
349 _writeCommand(0x06); // boost soft start
350 _writeData (0xc7);
351 _writeData (0x0c);
352 _writeData (0x0c);
353 _writeCommand(0x61); // resolution setting
354 _writeData (0xc8); // 200
355 _writeData (0x00);
356 _writeData (0xc8); // 200
357 _writeCommand(0x60); // Tcon setting
358 _writeData (0x00);
359 _writeCommand(0x82); // VCOM DC setting
360 _writeData (0x12);
361 _writeCommand(0x30); // PLL control
362 _writeData (0x3C); // default 50Hz
363 _writeCommand(0X50); // VCOM and data interval
364 _writeData(0x97);//
365 _writeCommand(0XE3); // power saving register
366 _writeData(0x00); // default
367}
368
369const unsigned char GxEPD2_154_M09::lut_20_vcomDC[] PROGMEM =
370{
371 0x01, 0x05, 0x05, 0x05, 0x05, 0x01, 0x01,
372 0x01, 0x05, 0x05, 0x05, 0x05, 0x01, 0x01,
373 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379};
380
381const unsigned char GxEPD2_154_M09::lut_21_ww[] PROGMEM =
382{
383 0x01, 0x45, 0x45, 0x43, 0x44, 0x01, 0x01,
384 0x01, 0x87, 0x83, 0x87, 0x06, 0x01, 0x01,
385 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389};
390
391const unsigned char GxEPD2_154_M09::lut_22_bw[] PROGMEM =
392{
393 0x01, 0x05, 0x05, 0x45, 0x42, 0x01, 0x01,
394 0x01, 0x87, 0x85, 0x85, 0x85, 0x01, 0x01,
395 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401};
402
403const unsigned char GxEPD2_154_M09::lut_23_wb[] PROGMEM =
404{
405 0x01, 0x08, 0x08, 0x82, 0x42, 0x01, 0x01,
406 0x01, 0x45, 0x45, 0x45, 0x45, 0x01, 0x01,
407 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
413};
414
415const unsigned char GxEPD2_154_M09::lut_24_bb[] PROGMEM =
416{
417 0x01, 0x85, 0x85, 0x85, 0x83, 0x01, 0x01,
418 0x01, 0x45, 0x45, 0x04, 0x48, 0x01, 0x01,
419 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
425};
426
427const unsigned char GxEPD2_154_M09::lut_20_vcomDC_partial[] PROGMEM =
428{
429 0x01, 0x04, 0x04, 0x03, 0x01, 0x01, 0x01,
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
435 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
437};
438
439const unsigned char GxEPD2_154_M09::lut_21_ww_partial[] PROGMEM =
440{
441 0x01, 0x04, 0x04, 0x03, 0x01, 0x01, 0x01,
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
444 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
447};
448const unsigned char GxEPD2_154_M09::lut_22_bw_partial[] PROGMEM =
449{
450 0x01, 0x84, 0x84, 0x83, 0x01, 0x01, 0x01,
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
458};
459
460const unsigned char GxEPD2_154_M09::lut_23_wb_partial[] PROGMEM =
461{
462 0x01, 0x44, 0x44, 0x43, 0x01, 0x01, 0x01,
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
468 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
470};
471
472const unsigned char GxEPD2_154_M09::lut_24_bb_partial[] PROGMEM =
473{
474 0x01, 0x04, 0x04, 0x03, 0x01, 0x01, 0x01,
475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
476 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
482};
483
484void GxEPD2_154_M09::_Init_Full()
485{
486 _InitDisplay();
487 _writeCommand(0x20);
488 _writeDataPGM(lut_20_vcomDC, sizeof(lut_20_vcomDC));
489 _writeCommand(0x21);
490 _writeDataPGM(lut_21_ww, sizeof(lut_21_ww));
491 _writeCommand(0x22);
492 _writeDataPGM(lut_22_bw, sizeof(lut_22_bw));
493 _writeCommand(0x23);
494 _writeDataPGM(lut_23_wb, sizeof(lut_23_wb));
495 _writeCommand(0x24);
496 _writeDataPGM(lut_24_bb, sizeof(lut_24_bb));
497 _PowerOn();
498 _using_partial_mode = false;
499}
500
501void GxEPD2_154_M09::_Init_Part()
502{
503 _InitDisplay();
504 _writeCommand(0x20);
505 _writeDataPGM(lut_20_vcomDC_partial, sizeof(lut_20_vcomDC_partial));
506 _writeCommand(0x21);
507 _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial));
508 _writeCommand(0x22);
509 _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial));
510 _writeCommand(0x23);
511 _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial));
512 _writeCommand(0x24);
513 _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial));
514 _PowerOn();
515 _using_partial_mode = true;
516}
517
518void GxEPD2_154_M09::_Update_Full()
519{
520 _writeCommand(0x12); //display refresh
521 _waitWhileBusy("_Update_Full", full_refresh_time);
522}
523
524void GxEPD2_154_M09::_Update_Part()
525{
526 _writeCommand(0x12); //display refresh
527 _waitWhileBusy("_Update_Part", partial_refresh_time);
528}
const unsigned char GxEPD2_154_M09::lut_20_vcomDC[] PROGMEM
void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
static const uint16_t power_off_time
void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void clearScreen(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
static const uint16_t full_refresh_time
void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void writeScreenBuffer(uint8_t value=0xFF)
void writeNative(const uint8_t *data1, const uint8_t *data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void writeScreenBufferAgain(uint8_t value=0xFF)
void drawNative(const uint8_t *data1, const uint8_t *data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
static const uint16_t WIDTH
static const uint16_t power_on_time
GxEPD2_154_M09(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void refresh(bool partial_update_mode=false)
static const uint16_t HEIGHT
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
bool _using_partial_mode
Definition GxEPD2_EPD.h:118
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
bool _power_is_on
Definition GxEPD2_EPD.h:118
bool _initial_refresh
Definition GxEPD2_EPD.h:117
void _reset()
bool _initial_write
Definition GxEPD2_EPD.h:117
int16_t _rst
Definition GxEPD2_EPD.h:112
bool _hibernating
Definition GxEPD2_EPD.h:118
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)