Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_565c.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: http://www.e-paper-display.com/download_detail/downloadsId=808.html
5// Panel: 5.65inch ACeP 7-Color E-Paper : https://www.waveshare.com/product/displays/e-paper/5.65inch-e-paper-module-f.htm
6// Controller: unknonw
7// initcode extracted from Waveshare library file epd5in65f.cpp available here: https://www.waveshare.com/wiki/5.65inch_e-Paper_Module_(F)
8//
9// Author: Jean-Marc Zingg
10//
11// Version: see library.properties
12//
13// Library: https://github.com/ZinggJM/GxEPD2
14
15#include "GxEPD2_565c.h"
16
17GxEPD2_565c::GxEPD2_565c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) :
18 GxEPD2_EPD(cs, dc, rst, busy, LOW, 25000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
19{
20 _paged = false;
21}
22
23void GxEPD2_565c::clearScreen(uint8_t value)
24{
25 clearScreen(value, 0xFF);
26}
27
28void GxEPD2_565c::clearScreen(uint8_t black_value, uint8_t color_value)
29{
30 writeScreenBuffer(black_value, color_value);
31 _Update_Full();
32}
33
35{
36 writeScreenBuffer(value, 0xFF);
37}
38
39void GxEPD2_565c::writeScreenBuffer(uint8_t black_value, uint8_t color_value)
40{
41 _initial_write = false; // initial full screen buffer clean done
42 _Init_Full();
43 _writeCommand(0x10);
45 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 2; i++)
46 {
47 //_transfer(0x11);
48 _transfer(0xFF == black_value ? 0x11 : black_value);
49 }
51}
52
53void GxEPD2_565c::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
54{
55 //Serial.print("writeImage("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
56 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
57 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
58 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
59 {
60 //Serial.println("paged");
62 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 8; i++)
63 {
64 uint8_t data = bitmap[i];
65 for (int16_t k = 0; k < 4; k++)
66 {
67 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
68 data <<= 2;
69 _transfer(data2);
70 }
71 }
73 if (y + h == HEIGHT) // last page
74 {
75 //Serial.println("paged ended");
76 _paged = false;
77 }
78 }
79 else
80 {
81 _paged = false;
82 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
83 x -= x % 8; // byte boundary
84 w = wb * 8; // byte boundary
85 if ((w <= 0) || (h <= 0)) return;
86 _Init_Full();
87 _writeCommand(0x10);
89 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
90 {
91 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
92 {
93 uint8_t data = 0xFF;
94 if ((j >= x) && (j <= x + w) && (i >= y) && (i < y + h))
95 {
96 uint32_t idx = mirror_y ? (j - x) / 8 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 8 + uint32_t(i - y) * wb;
97 if (pgm)
98 {
99#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
100 data = pgm_read_byte(&bitmap[idx]);
101#else
102 data = bitmap[idx];
103#endif
104 }
105 else
106 {
107 data = bitmap[idx];
108 }
109 if (invert) data = ~data;
110 }
111 for (int16_t k = 0; k < 4; k++)
112 {
113 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
114 data <<= 2;
115 _transfer(data2);
116 }
117 }
118 }
119 _endTransfer();
120 }
121 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
122}
123
124void GxEPD2_565c::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)
125{
126 if (!black && !color) return;
127 if (!color) return writeImage(black, x, y, w, h, invert, mirror_y, pgm);
128 //Serial.print("writeImage("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
129 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
130 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
131 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
132 {
133 //Serial.println("paged");
135 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 8; i++)
136 {
137 uint8_t black_data = black[i];
138 uint8_t color_data = color[i];
139 for (int16_t k = 0; k < 4; k++)
140 {
141 uint8_t out_data = 0x00;
142 for (int16_t l = 0; l < 2; l++)
143 {
144 out_data <<= 4;
145 if (!(color_data & 0x80)) out_data |= 0x04;
146 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
147 black_data <<= 1;
148 color_data <<= 1;
149 }
150 _transfer(out_data);
151 }
152 }
153 _endTransfer();
154 if (y + h == HEIGHT) // last page
155 {
156 //Serial.println("paged ended");
157 _paged = false;
158 }
159 }
160 else
161 {
162 _paged = false;
163 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
164 x -= x % 8; // byte boundary
165 w = wb * 8; // byte boundary
166 if ((w <= 0) || (h <= 0)) return;
167 _Init_Full();
168 _writeCommand(0x10);
170 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
171 {
172 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
173 {
174 uint8_t black_data = 0xFF, color_data = 0xFF;
175 if ((j >= x) && (j < x + w) && (i >= y) && (i < y + h))
176 {
177 uint32_t idx = mirror_y ? (j - x) / 8 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 8 + uint32_t(i - y) * wb;
178 if (pgm)
179 {
180#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
181 black_data = pgm_read_byte(&black[idx]);
182 color_data = pgm_read_byte(&color[idx]);
183#else
184 black_data = black[idx];
185 color_data = color[idx];
186#endif
187 }
188 else
189 {
190 black_data = black[idx];
191 color_data = color[idx];
192 }
193 if (invert)
194 {
195 black_data = ~black_data;
196 color_data = ~color_data;
197 }
198 }
199 for (int16_t k = 0; k < 4; k++)
200 {
201 uint8_t out_data = 0x00;
202 for (int16_t l = 0; l < 2; l++)
203 {
204 out_data <<= 4;
205 if (!(color_data & 0x80)) out_data |= 0x04;
206 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
207 black_data <<= 1;
208 color_data <<= 1;
209 }
210 _transfer(out_data);
211 }
212 }
213 }
214 _endTransfer();
215 }
216 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
217}
218
219void GxEPD2_565c::writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
220 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
221{
222 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
223 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
224 if ((x_part < 0) || (x_part >= w_bitmap)) return;
225 if ((y_part < 0) || (y_part >= h_bitmap)) return;
226 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
227 x_part -= x_part % 8; // byte boundary
228 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
229 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
230 x -= x % 8; // byte boundary
231 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
232 int16_t x1 = x < 0 ? 0 : x; // limit
233 int16_t y1 = y < 0 ? 0 : y; // limit
234 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
235 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
236 int16_t dx = x1 - x;
237 int16_t dy = y1 - y;
238 w1 -= dx;
239 h1 -= dy;
240 if ((w1 <= 0) || (h1 <= 0)) return;
241 _Init_Full();
242 _writeCommand(0x10);
244 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
245 {
246 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
247 {
248 uint8_t data = 0xFF;
249 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
250 {
251 // use wb_bitmap, h_bitmap of bitmap for index!
252 uint32_t idx = mirror_y ? (x_part + j - x1) / 8 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + uint32_t(y_part + i - y1) * wb_bitmap;
253 if (pgm)
254 {
255#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
256 data = pgm_read_byte(&bitmap[idx]);
257#else
258 data = bitmap[idx];
259#endif
260 }
261 else
262 {
263 data = bitmap[idx];
264 }
265 if (invert) data = ~data;
266 }
267 for (int16_t k = 0; k < 4; k++)
268 {
269 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
270 data <<= 2;
271 _transfer(data2);
272 }
273 }
274 }
275 _endTransfer();
276 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
277}
278
279void GxEPD2_565c::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,
280 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
281{
282 //Serial.print("writeImagePart("); Serial.print(x_part); Serial.print(", "); Serial.print(y_part); Serial.print(", ");
283 //Serial.print(w_bitmap); Serial.print(", "); Serial.print(h_bitmap); Serial.print(", ");
284 //Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
285 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
286 if (!black && !color) return;
287 if (!color) return writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
288 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
289 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
290 if ((x_part < 0) || (x_part >= w_bitmap)) return;
291 if ((y_part < 0) || (y_part >= h_bitmap)) return;
292 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
293 x_part -= x_part % 8; // byte boundary
294 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
295 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
296 x -= x % 8; // byte boundary
297 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
298 int16_t x1 = x < 0 ? 0 : x; // limit
299 int16_t y1 = y < 0 ? 0 : y; // limit
300 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
301 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
302 int16_t dx = x1 - x;
303 int16_t dy = y1 - y;
304 w1 -= dx;
305 h1 -= dy;
306 if ((w1 <= 0) || (h1 <= 0)) return;
307 _Init_Full();
308 _writeCommand(0x10);
310 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
311 {
312 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
313 {
314 uint8_t black_data = 0xFF, color_data = 0xFF;
315 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
316 {
317 // use wb_bitmap, h_bitmap of bitmap for index!
318 uint32_t idx = mirror_y ? (x_part + j - x1) / 8 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + uint32_t(y_part + i - y1) * wb_bitmap;
319 if (pgm)
320 {
321#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
322 black_data = pgm_read_byte(&black[idx]);
323 color_data = pgm_read_byte(&color[idx]);
324#else
325 black_data = black[idx];
326 color_data = color[idx];
327#endif
328 }
329 else
330 {
331 black_data = black[idx];
332 color_data = color[idx];
333 }
334 if (invert)
335 {
336 black_data = ~black_data;
337 color_data = ~color_data;
338 }
339 }
340 for (int16_t k = 0; k < 4; k++)
341 {
342 uint8_t out_data = 0x00;
343 for (int16_t l = 0; l < 2; l++)
344 {
345 out_data <<= 4;
346 if (!(color_data & 0x80)) out_data |= 0x04;
347 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
348 black_data <<= 1;
349 color_data <<= 1;
350 }
351 _transfer(out_data);
352 }
353 }
354 }
355 _endTransfer();
356 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
357}
358
359void GxEPD2_565c::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)
360{
361 if (data1)
362 {
363 //Serial.print("writeNative("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
364 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
365 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
366 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
367 {
368 //Serial.println("paged");
370 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 2; i++)
371 {
372 uint8_t data = data1[i];
373 _transfer(data);
374 }
375 _endTransfer();
376 if (y + h == HEIGHT) // last page
377 {
378 //Serial.println("paged ended");
379 _paged = false;
380 }
381 }
382 else
383 {
384 _paged = false;
385 int16_t wb = (w + 1) / 2; // width bytes, bitmaps are padded
386 x -= x % 2; // byte boundary
387 w = wb * 2; // byte boundary
388 if ((w <= 0) || (h <= 0)) return;
389 _Init_Full();
390 _writeCommand(0x10);
392 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
393 {
394 for (int16_t j = 0; j < int16_t(WIDTH); j += 2)
395 {
396 uint8_t data = 0x11;
397 if (data1)
398 {
399 if ((j >= x) && (j < x + w) && (i >= y) && (i < y + h))
400 {
401 uint32_t idx = mirror_y ? (j - x) / 2 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 2 + uint32_t(i - y) * wb;
402 if (pgm)
403 {
404#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
405 data = pgm_read_byte(&data1[idx]);
406#else
407 data = data1[idx];
408#endif
409 }
410 else
411 {
412 data = data1[idx];
413 }
414 if (invert) data = ~data;
415 }
416 }
417 _transfer(data);
418 }
419 }
420 _endTransfer();
421 }
422 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
423 }
424}
425
426void GxEPD2_565c::writeNativePart(const uint8_t* data1, const uint8_t* data2, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
427 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
428{
429 //Serial.print("writeNativePart("); Serial.print(x_part); Serial.print(", "); Serial.print(y_part); Serial.print(", ");
430 //Serial.print(w_bitmap); Serial.print(", "); Serial.print(h_bitmap); Serial.print(", ");
431 //Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
432 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
433 if (!data1) return;
434 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
435 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
436 if ((x_part < 0) || (x_part >= w_bitmap)) return;
437 if ((y_part < 0) || (y_part >= h_bitmap)) return;
438 int16_t wb_bitmap = (w_bitmap + 1) / 2; // width bytes, bitmaps are padded
439 x_part -= x_part % 2; // byte boundary
440 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
441 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
442 x -= x % 2; // byte boundary
443 w = 2 * ((w + 1) / 2); // byte boundary, bitmaps are padded
444 int16_t x1 = x < 0 ? 0 : x; // limit
445 int16_t y1 = y < 0 ? 0 : y; // limit
446 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
447 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
448 int16_t dx = x1 - x;
449 int16_t dy = y1 - y;
450 w1 -= dx;
451 h1 -= dy;
452 if ((w1 <= 0) || (h1 <= 0)) return;
453 _Init_Full();
454 _writeCommand(0x10);
456 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
457 {
458 for (int16_t j = 0; j < int16_t(WIDTH); j += 2)
459 {
460 uint8_t data = 0x11;
461 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
462 {
463 // use wb_bitmap, h_bitmap of bitmap for index!
464 uint32_t idx = mirror_y ? (x_part + j - x1) / 2 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 2 + uint32_t(y_part + i - y1) * wb_bitmap;
465 if (pgm)
466 {
467#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
468 data = pgm_read_byte(&data1[idx]);
469#else
470 data = data1[idx];
471#endif
472 }
473 else
474 {
475 data = data1[idx];
476 }
477 if (invert) data = ~data;
478 }
479 _transfer(data);
480 }
481 }
482 _endTransfer();
483 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
484}
485
486void GxEPD2_565c::drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
487{
488 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
489 refresh(x, y, w, h);
490}
491
492void GxEPD2_565c::drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
493 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
494{
495 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
496 refresh(x, y, w, h);
497}
498
499void GxEPD2_565c::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)
500{
501 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
502 refresh(x, y, w, h);
503}
504
505void GxEPD2_565c::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,
506 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
507{
508 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
509 refresh(x, y, w, h);
510}
511
512void GxEPD2_565c::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)
513{
514 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
515 refresh(x, y, w, h);
516}
517
518void GxEPD2_565c::refresh(bool partial_update_mode)
519{
520 if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
521 else _Update_Full();
522}
523
524void GxEPD2_565c::refresh(int16_t x, int16_t y, int16_t w, int16_t h)
525{
526 _Update_Part();
527}
528
530{
531 _PowerOff();
532}
533
535{
536 _PowerOff();
537 if (_rst >= 0)
538 {
539 _writeCommand(0x07); // deep sleep
540 _writeData(0xA5); // control code
541 _hibernating = true;
542 }
543}
544
546{
547 _paged = true;
548 _Init_Full();
549 _writeCommand(0x10);
550}
551
552void GxEPD2_565c::_PowerOn()
553{
554 if (!_power_is_on)
555 {
556 _writeCommand(0x04);
557 _waitWhileBusy("_PowerOn", power_on_time);
558 }
559 _power_is_on = true;
560}
561
562void GxEPD2_565c::_PowerOff()
563{
564 if (_power_is_on)
565 {
566 _writeCommand(0x02);
567 _waitWhileBusy("_PowerOff", power_off_time);
568 }
569 _power_is_on = false;
570 _using_partial_mode = false;
571}
572
573void GxEPD2_565c::_InitDisplay()
574{
575 if (_hibernating) _reset();
576 _writeCommand(0x00); // Panel Settings
577 _writeData(0xEF);
578 _writeData(0x08);
579 _writeCommand(0x01); // Power Settings
580 _writeData(0x37);
581 _writeData(0x00);
582 _writeData(0x23);
583 _writeData(0x23);
584 _writeCommand(0x03); // Power Off Sequence
585 _writeData(0x00);
586 _writeCommand(0x06); // Booster Soft Start
587 _writeData(0xC7);
588 _writeData(0xC7);
589 _writeData(0x1D);
590 _writeCommand(0x30); // PLL Control
591 _writeData(0x3C); // 50 Hz
592 _writeCommand(0x40); // Temperature Sensor Command
593 _writeData(0x00); // ??
594 _writeCommand(0x50); // VCOM and Data Interval Setting
595 _writeData(0x37); // white border
596 _writeCommand(0x60); // undocumented
597 _writeData(0x22);
598 _writeCommand(0x61); // Resolution Setting
599 _writeData(0x02);
600 _writeData(0x58);
601 _writeData(0x01);
602 _writeData(0xC0);
603 _writeCommand(0xE3); // undocumented
604 _writeData(0xAA);
605 delay(100);
606 _writeCommand(0x50); // VCOM and Data Interval Setting
607 _writeData(0x37); // white border
608}
609
610void GxEPD2_565c::_Init_Full()
611{
612 _InitDisplay();
613 _PowerOn();
614}
615
616void GxEPD2_565c::_Init_Part()
617{
618 _InitDisplay();
619 _PowerOn();
620}
621
622void GxEPD2_565c::_Update_Full()
623{
624 _writeCommand(0x12); // Display Refresh
625 _waitWhileBusy("_Update_Full", full_refresh_time);
626}
627
628void GxEPD2_565c::_Update_Part()
629{
630 _writeCommand(0x12); // Display Refresh
631 _waitWhileBusy("_Update_Part", partial_refresh_time);
632}
void writeScreenBuffer(uint8_t value=0xFF)
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)
static const uint16_t partial_refresh_time
Definition GxEPD2_565c.h:33
static const uint16_t power_on_time
Definition GxEPD2_565c.h:30
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 HEIGHT
Definition GxEPD2_565c.h:25
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 writeNativePart(const uint8_t *data1, const uint8_t *data2, 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)
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)
GxEPD2_565c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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)
static const uint16_t full_refresh_time
Definition GxEPD2_565c.h:32
void clearScreen(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 power_off_time
Definition GxEPD2_565c.h:31
static const uint16_t WIDTH
Definition GxEPD2_565c.h:23
void _endTransfer()
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
void _startTransfer()
void _transfer(uint8_t value)
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