16 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
28 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++)
49 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
61 else _writeScreenBuffer(value);
64void GxEPD2_213::_writeScreenBuffer(uint8_t value)
69 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
75void GxEPD2_213::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
79 int16_t wb = (w + 7) / 8;
82 int16_t x1 = x < 0 ? 0 : x;
83 int16_t y1 = y < 0 ? 0 : y;
84 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
85 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
90 if ((w1 <= 0) || (h1 <= 0))
return;
92 _setPartialRamArea(x1, y1, w1, h1);
94 for (int16_t i = 0; i < h1; i++)
96 for (int16_t j = 0; j < w1 / 8; j++)
100 int16_t idx = mirror_y ? j + dx / 8 + (h - 1 - i) * wb : j + dx / 8 + i * wb;
103#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
104 data = pgm_read_byte(&bitmap[idx]);
113 if (invert) data = ~data;
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;
144 _setPartialRamArea(x1, y1, w1, h1);
146 for (int16_t i = 0; i < h1; i++)
148 for (int16_t j = 0; j < w1 / 8; j++)
152 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;
155#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
156 data = pgm_read_byte(&bitmap[idx]);
165 if (invert) data = ~data;
172void GxEPD2_213::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)
176 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
180void GxEPD2_213::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,
181 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
185 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
189void GxEPD2_213::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)
193 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
197void GxEPD2_213::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
199 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
201 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
205 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
207 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
209 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
212void GxEPD2_213::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 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
216 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
219void GxEPD2_213::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,
220 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
222 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
224 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
227void GxEPD2_213::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)
229 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
231 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
249 int16_t w1 = x < 0 ? w + x : w;
250 int16_t h1 = y < 0 ? h + y : h;
251 int16_t x1 = x < 0 ? 0 : x;
252 int16_t y1 = y < 0 ? 0 : y;
253 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
254 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
255 if ((w1 <= 0) || (h1 <= 0))
return;
258 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
261 _setPartialRamArea(x1, y1, w1, h1);
281void GxEPD2_213::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
300void GxEPD2_213::_PowerOn()
312void GxEPD2_213::_PowerOff()
322void GxEPD2_213::_InitDisplay()
342const uint8_t GxEPD2_213::LUTDefault_full[]
PROGMEM =
345 0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x01, 0x00, 0x00, 0x00, 0x00
349const uint8_t GxEPD2_213::LUTDefault_part[]
PROGMEM =
352 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
356void GxEPD2_213::_Init_Full()
364void GxEPD2_213::_Init_Part()
372void GxEPD2_213::_Update_Full()
381void GxEPD2_213::_Update_Part()
const uint8_t GxEPD2_213::LUTDefault_full[] PROGMEM
void clearScreen(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 refresh(bool partial_update_mode=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(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t power_on_time
static const uint16_t power_off_time
static const uint16_t HEIGHT
static const uint16_t WIDTH
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 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 partial_refresh_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 full_refresh_time
void writeScreenBuffer(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)
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
void _writeCommandDataPGM(const uint8_t *pCommandData, uint8_t datalen)