17 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
36 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
44 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
51void GxEPD2_102::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
53 _writeImage(0x13, bitmap, x, y, w, h, invert, mirror_y, pgm);
58 _writeImage(0x10, bitmap, x, y, w, h, invert, mirror_y, pgm);
59 _writeImage(0x13, bitmap, x, y, w, h, invert, mirror_y, pgm);
62void GxEPD2_102::_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)
66 int16_t wb = (w + 7) / 8;
69 int16_t x1 = x < 0 ? 0 : x;
70 int16_t y1 = y < 0 ? 0 : y;
71 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
72 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
77 if ((w1 <= 0) || (h1 <= 0))
return;
81 _setPartialRamArea(x1, y1, w1, h1);
84 for (int16_t i = 0; i < h1; i++)
86 for (int16_t j = 0; j < w1 / 8; j++)
90 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
93#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
94 data = pgm_read_byte(&bitmap[idx]);
103 if (invert) data = ~data;
114 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
116 _writeImagePart(0x13, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
119void GxEPD2_102::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
120 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
124 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
125 if ((x_part < 0) || (x_part >= w_bitmap))
return;
126 if ((y_part < 0) || (y_part >= h_bitmap))
return;
127 int16_t wb_bitmap = (w_bitmap + 7) / 8;
128 x_part -= x_part % 8;
129 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
130 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
132 w = 8 * ((w + 7) / 8);
133 int16_t x1 = x < 0 ? 0 : x;
134 int16_t y1 = y < 0 ? 0 : y;
135 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
136 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
141 if ((w1 <= 0) || (h1 <= 0))
return;
144 _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;
175void GxEPD2_102::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)
179 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
183void GxEPD2_102::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,
184 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
188 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
192void GxEPD2_102::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)
196 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
200void GxEPD2_102::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
202 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
204 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
208 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
210 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
212 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
215void GxEPD2_102::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)
217 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
219 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
222void GxEPD2_102::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,
223 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
225 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
227 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
230void GxEPD2_102::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)
232 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
234 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
252 int16_t w1 = x < 0 ? w + x : w;
253 int16_t h1 = y < 0 ? h + y : h;
254 int16_t x1 = x < 0 ? 0 : x;
255 int16_t y1 = y < 0 ? 0 : y;
256 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
257 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
258 if ((w1 <= 0) || (h1 <= 0))
return;
261 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
265 _setPartialRamArea(x1, y1, w1, h1);
286void GxEPD2_102::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
288 uint16_t xe = (x + w - 1) | 0x0007;
289 uint16_t ye = y + h - 1;
299void GxEPD2_102::_PowerOn()
309void GxEPD2_102::_PowerOff()
317void GxEPD2_102::_InitDisplay()
349const unsigned char GxEPD2_102::lut_w_full[]
PROGMEM =
351 0x60, 0x5A, 0x5A, 0x00, 0x00, 0x01,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360const unsigned char GxEPD2_102::lut_b_full[]
PROGMEM =
362 0x90, 0x5A, 0x5A, 0x00, 0x00, 0x01,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371const unsigned char GxEPD2_102::lut_w_partial[]
PROGMEM =
373 0x60, 0x01, 0x01, 0x00, 0x00, 0x01,
374 0x80, 0x0f, 0x00, 0x00, 0x00, 0x01,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382const unsigned char GxEPD2_102::lut_b_partial[]
PROGMEM =
384 0x90, 0x01, 0x01, 0x00, 0x00, 0x01,
385 0x40, 0x0f, 0x00, 0x00, 0x00, 0x01,
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,
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393void GxEPD2_102::_Init_Full()
404void GxEPD2_102::_Init_Part()
423void GxEPD2_102::_Update_Full()
429void GxEPD2_102::_Update_Part()
const unsigned char GxEPD2_102::lut_w_full[] PROGMEM
void writeImageForFullRefresh(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 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 clearScreen(uint8_t value=0xFF)
static const uint16_t HEIGHT
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 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 bool useOTPforFullRefresh
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 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 writeScreenBuffer(uint8_t value=0xFF)
GxEPD2_102(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t power_off_time
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 power_on_time
static const uint16_t partial_refresh_time
static const uint16_t WIDTH
static const bool usePartialUpdateWindow
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
void _transfer(uint8_t value)
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)