16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
30 if (value == 0xFF) value = 0x33;
33 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 2; i++)
40void GxEPD2_750::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
44 uint16_t wb = (w + 7) / 8;
47 int16_t x1 = x < 0 ? 0 : x;
48 int16_t y1 = y < 0 ? 0 : y;
49 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
50 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
55 if ((w1 <= 0) || (h1 <= 0))
return;
58 _setPartialRamArea(x1, y1, w1, h1);
61 for (int16_t i = 0; i < h1; i++)
63 for (int16_t j = 0; j < w1 / 8; j++)
67 uint16_t idx = mirror_y ? j + dx / 8 + uint16_t((h - 1 - (i + dy))) * wb : j + dx / 8 + uint16_t(i + dy) * wb;
70#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
71 data = pgm_read_byte(&bitmap[idx]);
80 if (invert) data = ~data;
90 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
94 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
95 if ((x_part < 0) || (x_part >= w_bitmap))
return;
96 if ((y_part < 0) || (y_part >= h_bitmap))
return;
97 uint16_t wb_bitmap = (w_bitmap + 7) / 8;
99 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
100 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
102 w = 8 * ((w + 7) / 8);
103 int16_t x1 = x < 0 ? 0 : x;
104 int16_t y1 = y < 0 ? 0 : y;
105 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
106 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
111 if ((w1 <= 0) || (h1 <= 0))
return;
114 _setPartialRamArea(x1, y1, w1, h1);
117 for (int16_t i = 0; i < h1; i++)
119 for (int16_t j = 0; j < w1 / 8; j++)
123 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;
126#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
127 data = pgm_read_byte(&bitmap[idx]);
136 if (invert) data = ~data;
145void GxEPD2_750::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)
149 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
153void GxEPD2_750::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,
154 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
158 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
162void GxEPD2_750::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)
168 uint16_t wb = (w + 1) / 2;
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);
185 for (int16_t i = 0; i < h1; i++)
187 for (int16_t j = 0; j < w1 / 2; j++)
191 uint16_t idx = mirror_y ? j + dx / 2 + uint16_t((h - 1 - (i + dy))) * wb : j + dx / 2 + uint16_t(i + dy) * wb;
194#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
195 data = pgm_read_byte(&data1[idx]);
204 if (invert) data = ~data;
214void GxEPD2_750::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
216 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
221 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
223 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
227void GxEPD2_750::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)
229 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
233void GxEPD2_750::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,
234 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
236 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
240void GxEPD2_750::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)
242 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
259 int16_t w1 = x < 0 ? w + x : w;
260 int16_t h1 = y < 0 ? h + y : h;
261 int16_t x1 = x < 0 ? 0 : x;
262 int16_t y1 = y < 0 ? 0 : y;
263 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
264 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
265 if ((w1 <= 0) || (h1 <= 0))
return;
268 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
272 _setPartialRamArea(x1, y1, w1, h1);
294void GxEPD2_750::_send8pixel(uint8_t data)
296 for (uint8_t j = 0; j < 8; j++)
298 uint8_t t = data & 0x80 ? 0x00 : 0x03;
302 t |= data & 0x80 ? 0x00 : 0x03;
308void GxEPD2_750::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
310 uint16_t xe = (x + w - 1) | 0x0007;
311 uint16_t ye = y + h - 1;
326void GxEPD2_750::_PowerOn()
336void GxEPD2_750::_PowerOff()
344void GxEPD2_750::_InitDisplay()
385void GxEPD2_750::_Init_Full()
392void GxEPD2_750::_Init_Part()
399void GxEPD2_750::_Update_Full()
405void GxEPD2_750::_Update_Part()
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 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 power_on_time
static const uint16_t partial_refresh_time
void clearScreen(uint8_t value=0x33)
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 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)
GxEPD2_750(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
void writeScreenBuffer(uint8_t value=0x33)
static const uint16_t WIDTH
static const uint16_t HEIGHT
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)
void _transfer(uint8_t value)