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++)
43 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
49void GxEPD2_270::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
51 _writeImage(0x15, bitmap, x, y, w, h, invert, mirror_y, pgm);
56 _writeImage(0x14, bitmap, x, y, w, h, invert, mirror_y, pgm);
59void GxEPD2_270::_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)
63 int16_t wb = (w + 7) / 8;
66 int16_t x1 = x < 0 ? 0 : x;
67 int16_t y1 = y < 0 ? 0 : y;
68 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
69 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
74 if ((w1 <= 0) || (h1 <= 0))
return;
76 _setPartialRamArea(command, x1, y1, w1, h1);
77 for (int16_t i = 0; i < h1; i++)
79 for (int16_t j = 0; j < w1 / 8; j++)
83 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
86#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
87 data = pgm_read_byte(&bitmap[idx]);
96 if (invert) data = ~data;
104 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
106 _writeImagePart(0x15, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
110 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
112 _writeImagePart(0x14, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
115void GxEPD2_270::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
116 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
120 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
121 if ((x_part < 0) || (x_part >= w_bitmap))
return;
122 if ((y_part < 0) || (y_part >= h_bitmap))
return;
123 int16_t wb_bitmap = (w_bitmap + 7) / 8;
124 x_part -= x_part % 8;
125 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
126 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
128 w = 8 * ((w + 7) / 8);
129 int16_t x1 = x < 0 ? 0 : x;
130 int16_t y1 = y < 0 ? 0 : y;
131 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
132 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
137 if ((w1 <= 0) || (h1 <= 0))
return;
139 _setPartialRamArea(command, x1, y1, w1, h1);
140 for (int16_t i = 0; i < h1; i++)
142 for (int16_t j = 0; j < w1 / 8; j++)
146 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;
149#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
150 data = pgm_read_byte(&bitmap[idx]);
159 if (invert) data = ~data;
166void GxEPD2_270::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)
170 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
174void GxEPD2_270::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,
175 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
179 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
183void GxEPD2_270::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)
187 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
191void GxEPD2_270::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
193 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
199 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
201 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
203 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
206void GxEPD2_270::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)
210 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
214void GxEPD2_270::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,
215 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
219 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
223void GxEPD2_270::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)
227 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
246 int16_t w1 = x < 0 ? w + x : w;
247 int16_t h1 = y < 0 ? h + y : h;
248 int16_t x1 = x < 0 ? 0 : x;
249 int16_t y1 = y < 0 ? 0 : y;
250 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
251 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
252 if ((w1 <= 0) || (h1 <= 0))
return;
255 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
257 _refreshWindow(x1, y1, w1, h1);
277void GxEPD2_270::_setPartialRamArea(uint8_t command, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
279 w = (w + 7 + (x % 8)) & 0xfff8;
291void GxEPD2_270::_refreshWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
293 w = (w + 7 + (x % 8)) & 0xfff8;
306void GxEPD2_270::_PowerOn()
316void GxEPD2_270::_PowerOff()
324void GxEPD2_270::_InitDisplay()
354const uint8_t GxEPD2_270::lut_20_vcomDC[]
PROGMEM =
357 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
358 0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
359 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
360 0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
366const uint8_t GxEPD2_270::lut_21_ww[]
PROGMEM =
368 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
369 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
370 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
371 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
377const uint8_t GxEPD2_270::lut_22_bw[]
PROGMEM =
379 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
380 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
381 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
382 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
388const uint8_t GxEPD2_270::lut_23_wb[]
PROGMEM =
390 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
391 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
392 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
393 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
399const uint8_t GxEPD2_270::lut_24_bb[]
PROGMEM =
401 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
402 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
403 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
404 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
411const uint8_t GxEPD2_270::lut_20_vcomDC_partial[]
PROGMEM =
414 0x00, 0x19, 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 uint8_t GxEPD2_270::lut_21_ww_partial[]
PROGMEM =
425 0x00, 0x19, 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
434const uint8_t GxEPD2_270::lut_22_bw_partial[]
PROGMEM =
436 0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
439 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
445const uint8_t GxEPD2_270::lut_23_wb_partial[]
PROGMEM =
447 0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
452 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
456const uint8_t GxEPD2_270::lut_24_bb_partial[]
PROGMEM =
458 0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
467void GxEPD2_270::_Init_Full()
486void GxEPD2_270::_Init_Part()
505void GxEPD2_270::_Update_Full()
511void GxEPD2_270::_Update_Part()
const uint8_t GxEPD2_270::lut_20_vcomDC[] PROGMEM
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 power_on_time
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 writeScreenBufferAgain(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
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 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 writeScreenBuffer(uint8_t value=0xFF)
GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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)
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 refresh(bool partial_update_mode=false)
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 WIDTH
static const uint16_t power_off_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)
static const uint16_t full_refresh_time
void clearScreen(uint8_t value=0xFF)
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
void _writeDataPGM_sCS(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)
static uint16_t gx_uint16_min(uint16_t a, uint16_t b)