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++)
69void GxEPD2_290c::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
71 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
74void GxEPD2_290c::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)
78 int16_t wb = (w + 7) / 8;
81 int16_t x1 = x < 0 ? 0 : x;
82 int16_t y1 = y < 0 ? 0 : y;
83 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
84 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
89 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++)
102 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
105#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
106 data = pgm_read_byte(&black[idx]);
115 if (invert) data = ~data;
121 for (int16_t i = 0; i < h1; i++)
123 for (int16_t j = 0; j < w1 / 8; j++)
129 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
132#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
133 data = pgm_read_byte(&color[idx]);
142 if (invert) data = ~data;
152 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
154 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
158 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
162 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
163 if ((x_part < 0) || (x_part >= w_bitmap))
return;
164 if ((y_part < 0) || (y_part >= h_bitmap))
return;
165 int16_t wb_bitmap = (w_bitmap + 7) / 8;
166 x_part -= x_part % 8;
167 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
168 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
170 w = 8 * ((w + 7) / 8);
171 int16_t x1 = x < 0 ? 0 : x;
172 int16_t y1 = y < 0 ? 0 : y;
173 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
174 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
179 if ((w1 <= 0) || (h1 <= 0))
return;
182 _setPartialRamArea(x1, y1, w1, h1);
184 for (int16_t i = 0; i < h1; i++)
186 for (int16_t j = 0; j < w1 / 8; j++)
190 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;
193#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
194 data = pgm_read_byte(&black[idx]);
203 if (invert) data = ~data;
208 for (int16_t i = 0; i < h1; i++)
210 for (int16_t j = 0; j < w1 / 8; j++)
216 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;
219#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
220 data = pgm_read_byte(&color[idx]);
229 if (invert) data = ~data;
238void GxEPD2_290c::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)
242 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
246void GxEPD2_290c::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
248 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
253 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
255 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
259void GxEPD2_290c::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)
261 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
265void GxEPD2_290c::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,
266 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
268 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
272void GxEPD2_290c::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)
274 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
287 int16_t w1 = x < 0 ? w + x : w;
288 int16_t h1 = y < 0 ? h + y : h;
289 int16_t x1 = x < 0 ? 0 : x;
290 int16_t y1 = y < 0 ? 0 : y;
291 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
292 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
293 if ((w1 <= 0) || (h1 <= 0))
return;
296 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
300 _setPartialRamArea(x1, y1, w1, h1);
321void GxEPD2_290c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
323 uint16_t xe = (x + w - 1) | 0x0007;
324 uint16_t ye = y + h - 1;
339void GxEPD2_290c::_PowerOn()
349void GxEPD2_290c::_PowerOff()
358void GxEPD2_290c::_InitDisplay()
378void GxEPD2_290c::_Init_Full()
384void GxEPD2_290c::_Init_Part()
392void GxEPD2_290c::_Update_Full()
398void GxEPD2_290c::_Update_Part()
static const uint16_t power_off_time
void writeScreenBuffer(uint8_t value=0xFF)
static const uint16_t full_refresh_time
static const uint16_t power_on_time
static const bool usePartialUpdateWindow
static const uint16_t HEIGHT
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 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)
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 uint16_t WIDTH
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 clearScreen(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
void refresh(bool partial_update_mode=false)
GxEPD2_290c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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 _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)