16 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
31 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
36 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
54 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
59 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
67 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
70void GxEPD2_154_Z90c::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)
74 int16_t wb = (w + 7) / 8;
77 int16_t x1 = x < 0 ? 0 : x;
78 int16_t y1 = y < 0 ? 0 : y;
79 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
80 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
85 if ((w1 <= 0) || (h1 <= 0))
return;
87 _setPartialRamArea(x1, y1, w1, h1);
89 for (int16_t i = 0; i < h1; i++)
91 for (int16_t j = 0; j < w1 / 8; j++)
97 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
100#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
101 data = pgm_read_byte(&black[idx]);
110 if (invert) data = ~data;
116 for (int16_t i = 0; i < h1; i++)
118 for (int16_t j = 0; j < w1 / 8; j++)
124 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
127#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
128 data = pgm_read_byte(&color[idx]);
137 if (invert) data = ~data;
146 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
148 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
152 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
156 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
157 if ((x_part < 0) || (x_part >= w_bitmap))
return;
158 if ((y_part < 0) || (y_part >= h_bitmap))
return;
159 int16_t wb_bitmap = (w_bitmap + 7) / 8;
160 x_part -= x_part % 8;
161 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
162 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
164 w = 8 * ((w + 7) / 8);
165 int16_t x1 = x < 0 ? 0 : x;
166 int16_t y1 = y < 0 ? 0 : y;
167 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
168 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
173 if ((w1 <= 0) || (h1 <= 0))
return;
175 _setPartialRamArea(x1, y1, w1, h1);
177 for (int16_t i = 0; i < h1; i++)
179 for (int16_t j = 0; j < w1 / 8; j++)
183 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;
186#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
187 data = pgm_read_byte(&black[idx]);
196 if (invert) data = ~data;
201 for (int16_t i = 0; i < h1; i++)
203 for (int16_t j = 0; j < w1 / 8; j++)
209 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;
212#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
213 data = pgm_read_byte(&color[idx]);
222 if (invert) data = ~data;
230void GxEPD2_154_Z90c::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)
234 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
240 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
245 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
247 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
251void GxEPD2_154_Z90c::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)
253 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
258 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
260 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
264void GxEPD2_154_Z90c::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)
266 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
279 int16_t w1 = x < 0 ? w + x : w;
280 int16_t h1 = y < 0 ? h + y : h;
281 int16_t x1 = x < 0 ? 0 : x;
282 int16_t y1 = y < 0 ? 0 : y;
283 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
284 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
285 if ((w1 <= 0) || (h1 <= 0))
return;
288 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
291 _setPartialRamArea(x1, y1, w1, h1);
311void GxEPD2_154_Z90c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
313 uint16_t xe = (x + w - 1);
314 uint16_t ye = y + h - 1;
330void GxEPD2_154_Z90c::_PowerOn()
342void GxEPD2_154_Z90c::_PowerOff()
351void GxEPD2_154_Z90c::_InitDisplay()
369void GxEPD2_154_Z90c::_Init_Full()
375void GxEPD2_154_Z90c::_Init_Part()
381void GxEPD2_154_Z90c::_Update_Full()
389void GxEPD2_154_Z90c::_Update_Part()
void writeScreenBuffer(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
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)
GxEPD2_154_Z90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t full_refresh_time
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 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 HEIGHT
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 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 power_on_time
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)
static const uint16_t WIDTH
void clearScreen(uint8_t value=0xFF)
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)