17 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
32 _writeScreenBuffer(0x13, value);
39 _writeScreenBuffer(0x10, value);
42void GxEPD2_154_M09::_writeScreenBuffer(uint8_t command, uint8_t value)
45 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
53 _writeImage(0x13, bitmap, x, y, w, h, invert, mirror_y, pgm);
58 _writeImage(0x10, bitmap, x, y, w, h, invert, mirror_y, pgm);
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)
65 int16_t wb = (w + 7) / 8;
68 int16_t x1 = x < 0 ? 0 : x;
69 int16_t y1 = y < 0 ? 0 : y;
70 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
71 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
76 if ((w1 <= 0) || (h1 <= 0))
return;
79 _setPartialRamArea(x1, y1, w1, h1);
81 for (int16_t i = 0; i < h1; i++)
83 for (int16_t j = 0; j < w1 / 8; j++)
87 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
90#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
91 data = pgm_read_byte(&bitmap[idx]);
100 if (invert) data = ~data;
109 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
111 _writeImagePart(0x13, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
115 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
117 _writeImagePart(0x10, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
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)
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;
129 x_part -= x_part % 8;
130 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
131 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
133 w = 8 * ((w + 7) / 8);
134 int16_t x1 = x < 0 ? 0 : x;
135 int16_t y1 = y < 0 ? 0 : y;
136 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
137 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
142 if ((w1 <= 0) || (h1 <= 0))
return;
145 _setPartialRamArea(x1, y1, w1, h1);
147 for (int16_t i = 0; i < h1; i++)
149 for (int16_t j = 0; j < w1 / 8; j++)
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;
156#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
157 data = pgm_read_byte(&bitmap[idx]);
166 if (invert) data = ~data;
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)
178 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
183 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
187 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
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)
195 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
201 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
207 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
209 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
211 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
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)
218 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
223 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
227 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
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)
235 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
254 int16_t w1 = x < 0 ? w + x : w;
255 int16_t h1 = y < 0 ? h + y : h;
256 int16_t x1 = x < 0 ? 0 : x;
257 int16_t y1 = y < 0 ? 0 : y;
258 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
259 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
260 if ((w1 <= 0) || (h1 <= 0))
return;
263 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
267 _setPartialRamArea(x1, y1, w1, h1);
288void GxEPD2_154_M09::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
290 uint16_t xe = (x + w - 1) | 0x0007;
291 uint16_t ye = y + h - 1;
306void GxEPD2_154_M09::_PowerOn()
316void GxEPD2_154_M09::_PowerOff()
328void GxEPD2_154_M09::_InitDisplay()
369const unsigned char GxEPD2_154_M09::lut_20_vcomDC[]
PROGMEM =
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,
381const unsigned char GxEPD2_154_M09::lut_21_ww[]
PROGMEM =
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,
391const unsigned char GxEPD2_154_M09::lut_22_bw[]
PROGMEM =
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,
403const unsigned char GxEPD2_154_M09::lut_23_wb[]
PROGMEM =
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,
415const unsigned char GxEPD2_154_M09::lut_24_bb[]
PROGMEM =
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,
427const unsigned char GxEPD2_154_M09::lut_20_vcomDC_partial[]
PROGMEM =
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,
439const unsigned char GxEPD2_154_M09::lut_21_ww_partial[]
PROGMEM =
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,
448const unsigned char GxEPD2_154_M09::lut_22_bw_partial[]
PROGMEM =
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,
460const unsigned char GxEPD2_154_M09::lut_23_wb_partial[]
PROGMEM =
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,
472const unsigned char GxEPD2_154_M09::lut_24_bb_partial[]
PROGMEM =
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,
484void GxEPD2_154_M09::_Init_Full()
501void GxEPD2_154_M09::_Init_Part()
505 _writeDataPGM(lut_20_vcomDC_partial,
sizeof(lut_20_vcomDC_partial));
518void GxEPD2_154_M09::_Update_Full()
524void GxEPD2_154_M09::_Update_Part()
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)
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)