16 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
33 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
45 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
53 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
58 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
61void GxEPD2_213_B72::_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;
78 _setPartialRamArea(x1, y1, w1, h1);
80 for (int16_t i = 0; i < h1; i++)
82 for (int16_t j = 0; j < w1 / 8; j++)
86 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
89#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
90 data = pgm_read_byte(&bitmap[idx]);
99 if (invert) data = ~data;
107 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
109 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
113 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
115 _writeImagePart(0x26, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
118void GxEPD2_213_B72::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
119 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
123 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
124 if ((x_part < 0) || (x_part >= w_bitmap))
return;
125 if ((y_part < 0) || (y_part >= h_bitmap))
return;
126 int16_t wb_bitmap = (w_bitmap + 7) / 8;
127 x_part -= x_part % 8;
128 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
129 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
131 w = 8 * ((w + 7) / 8);
132 int16_t x1 = x < 0 ? 0 : x;
133 int16_t y1 = y < 0 ? 0 : y;
134 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
135 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
140 if ((w1 <= 0) || (h1 <= 0))
return;
142 _setPartialRamArea(x1, y1, w1, h1);
144 for (int16_t i = 0; i < h1; i++)
146 for (int16_t j = 0; j < w1 / 8; j++)
150 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;
153#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
154 data = pgm_read_byte(&bitmap[idx]);
163 if (invert) data = ~data;
170void GxEPD2_213_B72::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)
174 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
179 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
183 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
187void GxEPD2_213_B72::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)
191 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
197 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
203 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
205 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
207 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
210void GxEPD2_213_B72::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)
214 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
219 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
223 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
227void GxEPD2_213_B72::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)
231 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
250 int16_t w1 = x < 0 ? w + x : w;
251 int16_t h1 = y < 0 ? h + y : h;
252 int16_t x1 = x < 0 ? 0 : x;
253 int16_t y1 = y < 0 ? 0 : y;
254 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
255 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
256 if ((w1 <= 0) || (h1 <= 0))
return;
259 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
262 _setPartialRamArea(x1, y1, w1, h1);
282void GxEPD2_213_B72::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
301void GxEPD2_213_B72::_PowerOn()
313void GxEPD2_213_B72::_PowerOff()
323void GxEPD2_213_B72::_InitDisplay()
351const uint8_t GxEPD2_213_B72::LUT_DATA_full[]
PROGMEM =
353 0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,
354 0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
355 0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,
356 0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
358 0x03, 0x03, 0x00, 0x00, 0x02,
359 0x09, 0x09, 0x00, 0x00, 0x02,
360 0x03, 0x03, 0x00, 0x00, 0x02,
361 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00,
364 0x00, 0x00, 0x00, 0x00, 0x00,
367const uint8_t GxEPD2_213_B72::LUT_DATA_part[]
PROGMEM =
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x0A, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 0x00, 0x00, 0x00, 0x00,
383void GxEPD2_213_B72::_Init_Full()
392void GxEPD2_213_B72::_Init_Part()
403void GxEPD2_213_B72::_Update_Full()
411void GxEPD2_213_B72::_Update_Part()
const uint8_t GxEPD2_213_B72::LUT_DATA_full[] PROGMEM
static const uint16_t WIDTH
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 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
static const uint16_t partial_refresh_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)
static const uint16_t full_refresh_time
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)
GxEPD2_213_B72(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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 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)
static const uint16_t HEIGHT
static const uint16_t power_off_time
void writeScreenBuffer(uint8_t value=0xFF)
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 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 writeScreenBufferAgain(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(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)