16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
32 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
37 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
57 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
62 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
71 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
74void GxEPD2_213_Z19c::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)
76 _writeImage(0x10, black, x, y, w, h, invert, mirror_y, pgm);
77 _writeImage(0x13, color, x, y, w, h, invert, mirror_y, pgm);
80void GxEPD2_213_Z19c::_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)
84 int16_t wb = (w + 7) / 8;
87 int16_t x1 = x < 0 ? 0 : x;
88 int16_t y1 = y < 0 ? 0 : y;
89 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
90 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
95 if ((w1 <= 0) || (h1 <= 0))
return;
98 _setPartialRamArea(x1, y1, w1, h1);
100 for (int16_t i = 0; i < h1; i++)
102 for (int16_t j = 0; j < w1 / 8; j++)
108 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
111#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
112 data = pgm_read_byte(&bitmap[idx]);
121 if (invert) data = ~data;
132 _writeImage(0x10, black, x, y, w, h, invert, mirror_y, pgm);
137 _writeImage(0x13, black, x, y, w, h, invert, mirror_y, pgm);
141 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
143 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
147 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
149 _writeImagePart(0x10, black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
150 _writeImagePart(0x13, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
153void GxEPD2_213_Z19c::_writeImagePart(uint8_t command,
const uint8_t* bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
154 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
158 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
159 if ((x_part < 0) || (x_part >= w_bitmap))
return;
160 if ((y_part < 0) || (y_part >= h_bitmap))
return;
161 int16_t wb_bitmap = (w_bitmap + 7) / 8;
162 x_part -= x_part % 8;
163 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
164 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
166 w = 8 * ((w + 7) / 8);
167 int16_t x1 = x < 0 ? 0 : x;
168 int16_t y1 = y < 0 ? 0 : y;
169 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
170 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
175 if ((w1 <= 0) || (h1 <= 0))
return;
178 _setPartialRamArea(x1, y1, w1, h1);
180 for (int16_t i = 0; i < h1; i++)
182 for (int16_t j = 0; j < w1 / 8; j++)
186 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;
189#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
190 data = pgm_read_byte(&bitmap[idx]);
199 if (invert) data = ~data;
208 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
210 _writeImagePart(0x10, black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
214 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
216 _writeImagePart(0x13, black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
219void GxEPD2_213_Z19c::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)
223 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
229 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
234 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
236 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
240void GxEPD2_213_Z19c::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)
242 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
247 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
249 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
253void GxEPD2_213_Z19c::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)
255 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
268 int16_t w1 = x < 0 ? w + x : w;
269 int16_t h1 = y < 0 ? h + y : h;
270 int16_t x1 = x < 0 ? 0 : x;
271 int16_t y1 = y < 0 ? 0 : y;
272 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
273 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
274 if ((w1 <= 0) || (h1 <= 0))
return;
277 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
281 _setPartialRamArea(x1, y1, w1, h1);
302void GxEPD2_213_Z19c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
304 uint16_t xe = (x + w - 1) | 0x0007;
305 uint16_t ye = y + h - 1;
320void GxEPD2_213_Z19c::_PowerOn()
330void GxEPD2_213_Z19c::_PowerOff()
337void GxEPD2_213_Z19c::_InitDisplay()
350void GxEPD2_213_Z19c::_Init_Full()
356void GxEPD2_213_Z19c::_Init_Part()
362void GxEPD2_213_Z19c::_Update_Full()
368void GxEPD2_213_Z19c::_Update_Part()
374const unsigned char GxEPD2_213_Z19c::lut_20_vcomDC_partial[] =
376 0x00, 0x1F, 0x01, 0x00, 0x00, 0x01,
379const unsigned char GxEPD2_213_Z19c::lut_21_ww_partial[] =
381 0x00, 0x1F, 0x01, 0x00, 0x00, 0x01,
384const unsigned char GxEPD2_213_Z19c::lut_22_bw_partial[]
PROGMEM =
386 0x80, 0x1F, 0x01, 0x00, 0x00, 0x01,
389const unsigned char GxEPD2_213_Z19c::lut_23_wb_partial[]
PROGMEM =
391 0x40, 0x1F, 0x01, 0x00, 0x00, 0x01,
394const unsigned char GxEPD2_213_Z19c::lut_24_bb_partial[]
PROGMEM =
396 0x00, 0x1F, 0x01, 0x00, 0x00, 0x01,
403 int16_t x1 = x < 0 ? 0 : x;
404 int16_t y1 = y < 0 ? 0 : y;
405 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
406 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
411 _writeDataPGM(lut_20_vcomDC_partial,
sizeof(lut_20_vcomDC_partial), 44 -
sizeof(lut_20_vcomDC_partial));
413 _writeDataPGM(lut_21_ww_partial,
sizeof(lut_21_ww_partial), 42 -
sizeof(lut_21_ww_partial));
415 _writeDataPGM(lut_22_bw_partial,
sizeof(lut_22_bw_partial), 42 -
sizeof(lut_22_bw_partial));
417 _writeDataPGM(lut_23_wb_partial,
sizeof(lut_23_wb_partial), 42 -
sizeof(lut_23_wb_partial));
419 _writeDataPGM(lut_24_bb_partial,
sizeof(lut_24_bb_partial), 42 -
sizeof(lut_24_bb_partial));
425 _setPartialRamArea(x1, y1, w1, h1);
const unsigned char GxEPD2_213_Z19c::lut_22_bw_partial[] 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)
void writeImageNew(const uint8_t *black, 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 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)
GxEPD2_213_Z19c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t power_off_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 writeImagePartNew(const uint8_t *black, 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)
static const uint16_t partial_refresh_time
static const uint16_t WIDTH
void writeImagePrevious(const uint8_t *black, 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 writeImagePartPrevious(const uint8_t *black, 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 power_on_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 refresh_bw(int16_t x, int16_t y, int16_t w, int16_t h)
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 bool usePartialUpdateWindow
void refresh(bool partial_update_mode=false)
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)