17 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 30000000, 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++)
55 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
60 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
66void GxEPD2_266c::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
68 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
71void GxEPD2_266c::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)
75 int16_t wb = (w + 7) / 8;
78 int16_t x1 = x < 0 ? 0 : x;
79 int16_t y1 = y < 0 ? 0 : y;
80 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
81 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
86 if ((w1 <= 0) || (h1 <= 0))
return;
88 _setPartialRamArea(x1, y1, w1, h1);
90 for (int16_t i = 0; i < h1; i++)
92 for (int16_t j = 0; j < w1 / 8; j++)
98 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
101#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
102 data = pgm_read_byte(&black[idx]);
111 if (invert) data = ~data;
117 for (int16_t i = 0; i < h1; i++)
119 for (int16_t j = 0; j < w1 / 8; j++)
125 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
128#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
129 data = pgm_read_byte(&color[idx]);
138 if (invert) data = ~data;
147 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
149 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
153 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
157 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
158 if ((x_part < 0) || (x_part >= w_bitmap))
return;
159 if ((y_part < 0) || (y_part >= h_bitmap))
return;
160 int16_t wb_bitmap = (w_bitmap + 7) / 8;
161 x_part -= x_part % 8;
162 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
163 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
165 w = 8 * ((w + 7) / 8);
166 int16_t x1 = x < 0 ? 0 : x;
167 int16_t y1 = y < 0 ? 0 : y;
168 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
169 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
174 if ((w1 <= 0) || (h1 <= 0))
return;
176 _setPartialRamArea(x1, y1, w1, h1);
178 for (int16_t i = 0; i < h1; i++)
180 for (int16_t j = 0; j < w1 / 8; j++)
184 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;
187#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
188 data = pgm_read_byte(&black[idx]);
197 if (invert) data = ~data;
202 for (int16_t i = 0; i < h1; i++)
204 for (int16_t j = 0; j < w1 / 8; j++)
210 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;
213#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
214 data = pgm_read_byte(&color[idx]);
223 if (invert) data = ~data;
231void GxEPD2_266c::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)
235 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
239void GxEPD2_266c::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
241 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
246 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
248 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
252void GxEPD2_266c::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)
254 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
258void GxEPD2_266c::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,
259 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
261 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
265void GxEPD2_266c::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)
267 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
280 int16_t w1 = x < 0 ? w + x : w;
281 int16_t h1 = y < 0 ? h + y : h;
282 int16_t x1 = x < 0 ? 0 : x;
283 int16_t y1 = y < 0 ? 0 : y;
284 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
285 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
286 if ((w1 <= 0) || (h1 <= 0))
return;
289 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
292 _setPartialRamArea(x1, y1, w1, h1);
312void GxEPD2_266c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
329void GxEPD2_266c::_PowerOn()
341void GxEPD2_266c::_PowerOff()
353void GxEPD2_266c::_InitDisplay()
375void GxEPD2_266c::_Init_Full()
381void GxEPD2_266c::_Init_Part()
387void GxEPD2_266c::_Update_Full()
395void GxEPD2_266c::_Update_Part()
void clearScreen(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
static const uint16_t power_on_time
static const uint16_t HEIGHT
void writeScreenBuffer(uint8_t value=0xFF)
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 WIDTH
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_266c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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 refresh(bool partial_update_mode=false)
static const uint16_t full_refresh_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)
static const uint16_t power_off_time
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 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 _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)