16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
32 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
39 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
50 int16_t wb = (w + 7) / 8;
53 int16_t x1 = x < 0 ? 0 : x;
54 int16_t y1 = y < 0 ? 0 : y;
55 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
56 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
61 if ((w1 <= 0) || (h1 <= 0))
return;
64 _setPartialRamArea(x1, y1, w1, h1);
66 for (int16_t i = 0; i < h1; i++)
68 for (int16_t j = 0; j < w1 / 8; j++)
72 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
75#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
76 data = pgm_read_byte(&bitmap[idx]);
85 if (invert) data = ~data;
94 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
98 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
99 if ((x_part < 0) || (x_part >= w_bitmap))
return;
100 if ((y_part < 0) || (y_part >= h_bitmap))
return;
101 int16_t wb_bitmap = (w_bitmap + 7) / 8;
102 x_part -= x_part % 8;
103 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
104 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
106 w = 8 * ((w + 7) / 8);
107 int16_t x1 = x < 0 ? 0 : x;
108 int16_t y1 = y < 0 ? 0 : y;
109 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
110 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
115 if ((w1 <= 0) || (h1 <= 0))
return;
118 _setPartialRamArea(x1, y1, w1, h1);
120 for (int16_t i = 0; i < h1; i++)
122 for (int16_t j = 0; j < w1 / 8; j++)
126 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;
129#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
130 data = pgm_read_byte(&bitmap[idx]);
139 if (invert) data = ~data;
147void GxEPD2_213_flex::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)
151 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
156 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
160 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
164void GxEPD2_213_flex::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)
168 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
174 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
176 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
180 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
182 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
184 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
187void GxEPD2_213_flex::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)
189 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
191 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
195 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
197 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
199 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
202void GxEPD2_213_flex::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)
204 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
206 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
224 int16_t w1 = x < 0 ? w + x : w;
225 int16_t h1 = y < 0 ? h + y : h;
226 int16_t x1 = x < 0 ? 0 : x;
227 int16_t y1 = y < 0 ? 0 : y;
228 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
229 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
230 if ((w1 <= 0) || (h1 <= 0))
return;
233 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
237 _setPartialRamArea(x1, y1, w1, h1);
258void GxEPD2_213_flex::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
260 uint16_t xe = (x + w - 1) | 0x0007;
261 uint16_t ye = y + h - 1;
276void GxEPD2_213_flex::_PowerOn()
286void GxEPD2_213_flex::_PowerOff()
294void GxEPD2_213_flex::_InitDisplay()
319const unsigned char GxEPD2_213_flex::lut_20_vcomDC[]
PROGMEM =
321 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
322 0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
323 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
324 0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331const unsigned char GxEPD2_213_flex::lut_21_ww[]
PROGMEM =
333 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
334 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
335 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
336 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342const unsigned char GxEPD2_213_flex::lut_22_bw[]
PROGMEM =
344 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
345 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
346 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
347 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353const unsigned char GxEPD2_213_flex::lut_23_wb[]
PROGMEM =
355 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
356 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
357 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
358 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364const unsigned char GxEPD2_213_flex::lut_24_bb[]
PROGMEM =
366 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
367 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
368 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
369 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378const unsigned char GxEPD2_213_flex::lut_20_vcomDC_partial[]
PROGMEM =
380 0x00,
Fx19, 0x01, 0x00, 0x00, 0x01,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390const unsigned char GxEPD2_213_flex::lut_21_ww_partial[]
PROGMEM =
392 0x00,
Fx19, 0x01, 0x00, 0x00, 0x01,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401const unsigned char GxEPD2_213_flex::lut_22_bw_partial[]
PROGMEM =
403 0x80,
Fx19, 0x01, 0x00, 0x00, 0x01,
404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412const unsigned char GxEPD2_213_flex::lut_23_wb_partial[]
PROGMEM =
414 0x40,
Fx19, 0x01, 0x00, 0x00, 0x01,
415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
423const unsigned char GxEPD2_213_flex::lut_24_bb_partial[]
PROGMEM =
425 0x00,
Fx19, 0x01, 0x00, 0x00, 0x01,
426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434void GxEPD2_213_flex::_Init_Full()
455void GxEPD2_213_flex::_Init_Part()
463 _writeDataPGM(lut_20_vcomDC_partial,
sizeof(lut_20_vcomDC_partial));
476void GxEPD2_213_flex::_Update_Full()
482void GxEPD2_213_flex::_Update_Part()
const unsigned char GxEPD2_213_flex::lut_20_vcomDC[] PROGMEM
static const uint16_t full_refresh_time
void writeScreenBuffer(uint8_t value=0xFF)
static const uint16_t HEIGHT
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)
static const uint16_t WIDTH
void refresh(bool partial_update_mode=false)
static const uint16_t partial_refresh_time
static const uint16_t power_on_time
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)
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)
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 clearScreen(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)
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)
GxEPD2_213_flex(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t power_off_time
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)