16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
23 if (value == 0xFF) value = 0x33;
29 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 2; i++)
46 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
48 _send8pixel(~black_value, ~color_value);
58 if (value == 0xFF) value = 0x33;
64 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 2; i++)
80 for (uint32_t i = 0; uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
82 _send8pixel(~black_value, ~color_value);
88void GxEPD2_750c::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
90 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
93void GxEPD2_750c::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)
97 uint16_t wb = (w + 7) / 8;
100 int16_t x1 = x < 0 ? 0 : x;
101 int16_t y1 = y < 0 ? 0 : y;
102 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
103 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
108 if ((w1 <= 0) || (h1 <= 0))
return;
111 _setPartialRamArea(x1, y1, w1, h1);
114 for (int16_t i = 0; i < h1; i++)
116 for (int16_t j = 0; j < w1 / 8; j++)
118 uint8_t black_data = 0xFF;
119 uint8_t color_data = 0xFF;
123 uint16_t idx = mirror_y ? j + dx / 8 + uint16_t((h - 1 - (i + dy))) * wb : j + dx / 8 + uint16_t(i + dy) * wb;
126#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
127 black_data = pgm_read_byte(&black[idx]);
129 black_data = black[idx];
134 black_data = black[idx];
136 if (invert) black_data = ~black_data;
141 uint16_t idx = mirror_y ? j + dx / 8 + uint16_t((h - 1 - (i + dy))) * wb : j + dx / 8 + uint16_t(i + dy) * wb;
144#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
145 color_data = pgm_read_byte(&color[idx]);
147 color_data = color[idx];
152 color_data = color[idx];
154 if (invert) color_data = ~color_data;
156 _send8pixel(~black_data, ~color_data);
165 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
167 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
171 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
175 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
176 if ((x_part < 0) || (x_part >= w_bitmap))
return;
177 if ((y_part < 0) || (y_part >= h_bitmap))
return;
178 uint16_t wb_bitmap = (w_bitmap + 7) / 8;
179 x_part -= x_part % 8;
180 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
181 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
183 w = 8 * ((w + 7) / 8);
184 int16_t x1 = x < 0 ? 0 : x;
185 int16_t y1 = y < 0 ? 0 : y;
186 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
187 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
192 if ((w1 <= 0) || (h1 <= 0))
return;
195 _setPartialRamArea(x1, y1, w1, h1);
198 for (int16_t i = 0; i < h1; i++)
200 for (int16_t j = 0; j < w1 / 8; j++)
202 uint8_t black_data = 0xFF;
203 uint8_t color_data = 0xFF;
205 uint16_t idx = mirror_y ? x_part / 8 + j + dx / 8 + uint16_t((h_bitmap - 1 - (y_part + i + dy))) * wb_bitmap : x_part / 8 + j + dx / 8 + uint16_t(y_part + i + dy) * wb_bitmap;
210#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
211 black_data = pgm_read_byte(&black[idx]);
213 black_data = black[idx];
218 black_data = black[idx];
220 if (invert) black_data = ~black_data;
226#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
227 color_data = pgm_read_byte(&color[idx]);
229 color_data = color[idx];
234 color_data = color[idx];
236 if (invert) color_data = ~color_data;
238 _send8pixel(~black_data, ~color_data);
249void GxEPD2_750c::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)
255 uint16_t wb = (w + 1) / 2;
258 int16_t x1 = x < 0 ? 0 : x;
259 int16_t y1 = y < 0 ? 0 : y;
260 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
261 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
266 if ((w1 <= 0) || (h1 <= 0))
return;
269 _setPartialRamArea(x1, y1, w1, h1);
272 for (int16_t i = 0; i < h1; i++)
274 for (int16_t j = 0; j < w1 / 2; j++)
278 uint16_t idx = mirror_y ? j + dx / 2 + uint16_t((h - 1 - (i + dy))) * wb : j + dx / 2 + uint16_t(i + dy) * wb;
281#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
282 data = pgm_read_byte(&data1[idx]);
291 if (invert) data = ~data;
301void GxEPD2_750c::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
303 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
308 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
310 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
314void GxEPD2_750c::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)
316 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
320void GxEPD2_750c::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,
321 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
323 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
327void GxEPD2_750c::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)
329 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
342 int16_t w1 = x < 0 ? w + x : w;
343 int16_t h1 = y < 0 ? h + y : h;
344 int16_t x1 = x < 0 ? 0 : x;
345 int16_t y1 = y < 0 ? 0 : y;
346 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
347 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
348 if ((w1 <= 0) || (h1 <= 0))
return;
351 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
354 _setPartialRamArea(x1, y1, w1, h1);
375void GxEPD2_750c::_send8pixel(uint8_t black_data, uint8_t color_data)
377 for (uint8_t j = 0; j < 8; j++)
380 if (black_data & 0x80);
381 else if (color_data & 0x80) t = 0x04;
387 if (black_data & 0x80);
388 else if (color_data & 0x80) t |= 0x04;
396void GxEPD2_750c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
398 uint16_t xe = (x + w - 1) | 0x0007;
399 uint16_t ye = y + h - 1;
415void GxEPD2_750c::_PowerOn()
425void GxEPD2_750c::_PowerOff()
432void GxEPD2_750c::_InitDisplay()
473void GxEPD2_750c::_Init_Full()
479void GxEPD2_750c::_Init_Part()
485void GxEPD2_750c::_Update_Full()
491void GxEPD2_750c::_Update_Part()
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 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 full_refresh_time
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 partial_refresh_time
static const uint16_t power_off_time
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)
static const uint16_t power_on_time
void writeScreenBuffer(uint8_t value=0x33)
GxEPD2_750c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
void clearScreen(uint8_t value=0x33)
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 refresh(bool partial_update_mode=false)
static const uint16_t WIDTH
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)