17 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
33 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
40 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
47void GxEPD2_154_T8::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 int16_t wb = (w + 7) / 8;
54 int16_t x1 = x < 0 ? 0 : x;
55 int16_t y1 = y < 0 ? 0 : y;
56 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
57 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
62 if ((w1 <= 0) || (h1 <= 0))
return;
65 _setPartialRamArea(x1, y1, w1, h1);
67 for (int16_t i = 0; i < h1; i++)
69 for (int16_t j = 0; j < w1 / 8; j++)
73 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
76#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
77 data = pgm_read_byte(&bitmap[idx]);
86 if (invert) data = ~data;
95 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
99 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
100 if ((x_part < 0) || (x_part >= w_bitmap))
return;
101 if ((y_part < 0) || (y_part >= h_bitmap))
return;
102 int16_t wb_bitmap = (w_bitmap + 7) / 8;
103 x_part -= x_part % 8;
104 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
105 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
107 w = 8 * ((w + 7) / 8);
108 int16_t x1 = x < 0 ? 0 : x;
109 int16_t y1 = y < 0 ? 0 : y;
110 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
111 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
116 if ((w1 <= 0) || (h1 <= 0))
return;
119 _setPartialRamArea(x1, y1, w1, h1);
121 for (int16_t i = 0; i < h1; i++)
123 for (int16_t j = 0; j < w1 / 8; j++)
127 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;
130#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
131 data = pgm_read_byte(&bitmap[idx]);
140 if (invert) data = ~data;
148void GxEPD2_154_T8::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)
152 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
157 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
161 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
165void GxEPD2_154_T8::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)
169 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
173void GxEPD2_154_T8::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
175 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
177 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
181 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
183 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
185 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
188void GxEPD2_154_T8::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)
190 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
192 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
196 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
198 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
200 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
203void GxEPD2_154_T8::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)
205 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
207 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
225 int16_t w1 = x < 0 ? w + x : w;
226 int16_t h1 = y < 0 ? h + y : h;
227 int16_t x1 = x < 0 ? 0 : x;
228 int16_t y1 = y < 0 ? 0 : y;
229 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
230 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
231 if ((w1 <= 0) || (h1 <= 0))
return;
234 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
238 _setPartialRamArea(x1, y1, w1, h1);
259void GxEPD2_154_T8::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
261 uint16_t xe = (x + w - 1) | 0x0007;
262 uint16_t ye = y + h - 1;
277void GxEPD2_154_T8::_PowerOn()
287void GxEPD2_154_T8::_PowerOff()
295void GxEPD2_154_T8::_InitDisplay()
322const unsigned char GxEPD2_154_T8::lut_20_vcomDC[]
PROGMEM =
324 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
325 0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
326 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
327 0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334const unsigned char GxEPD2_154_T8::lut_21_ww[]
PROGMEM =
336 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
337 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
338 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
339 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345const unsigned char GxEPD2_154_T8::lut_22_bw[]
PROGMEM =
347 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
348 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
349 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
350 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356const unsigned char GxEPD2_154_T8::lut_23_wb[]
PROGMEM =
358 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
359 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
360 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
361 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367const unsigned char GxEPD2_154_T8::lut_24_bb[]
PROGMEM =
369 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
370 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
371 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
372 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381const unsigned char GxEPD2_154_T8::lut_20_vcomDC_partial[]
PROGMEM =
383 0x00,
Tx19, 0x01, 0x00, 0x00, 0x01,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393const unsigned char GxEPD2_154_T8::lut_21_ww_partial[]
PROGMEM =
395 0x00,
Tx19, 0x01, 0x00, 0x00, 0x01,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
404const unsigned char GxEPD2_154_T8::lut_22_bw_partial[]
PROGMEM =
406 0x80,
Tx19, 0x01, 0x00, 0x00, 0x01,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
415const unsigned char GxEPD2_154_T8::lut_23_wb_partial[]
PROGMEM =
417 0x40,
Tx19, 0x01, 0x00, 0x00, 0x01,
418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
426const unsigned char GxEPD2_154_T8::lut_24_bb_partial[]
PROGMEM =
428 0x00,
Tx19, 0x01, 0x00, 0x00, 0x01,
429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
437void GxEPD2_154_T8::_Init_Full()
458void GxEPD2_154_T8::_Init_Part()
466 _writeDataPGM(lut_20_vcomDC_partial,
sizeof(lut_20_vcomDC_partial));
479void GxEPD2_154_T8::_Update_Full()
485void GxEPD2_154_T8::_Update_Part()
const unsigned char GxEPD2_154_T8::lut_20_vcomDC[] PROGMEM
GxEPD2_154_T8(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
void writeScreenBuffer(uint8_t value=0xFF)
static const uint16_t HEIGHT
static const uint16_t full_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 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 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
void clearScreen(uint8_t value=0xFF)
static const uint16_t power_on_time
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 power_off_time
static const bool hasFastPartialUpdate
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 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 WIDTH
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)