18 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
33 _writeScreenBuffer(0x24, value);
40 _writeScreenBuffer(0x26, value);
41 _writeScreenBuffer(0x24, value);
44void GxEPD2_370_TC1::_writeScreenBuffer(uint8_t command, uint8_t value)
47 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
55 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
60 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
61 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
67 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
68 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
71void GxEPD2_370_TC1::_writeImage(uint8_t command,
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
75 int32_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++)
96 int32_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
99#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
100 data = pgm_read_byte(&bitmap[idx]);
109 if (invert) data = ~data;
117 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
119 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
123 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
125 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
126 _writeImagePart(0x26, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
129void GxEPD2_370_TC1::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
130 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
134 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
135 if ((x_part < 0) || (x_part >= w_bitmap))
return;
136 if ((y_part < 0) || (y_part >= h_bitmap))
return;
137 int32_t wb_bitmap = (w_bitmap + 7) / 8;
138 x_part -= x_part % 8;
139 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
140 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
142 w = 8 * ((w + 7) / 8);
143 int16_t x1 = x < 0 ? 0 : x;
144 int16_t y1 = y < 0 ? 0 : y;
145 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
146 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
151 if ((w1 <= 0) || (h1 <= 0))
return;
153 _setPartialRamArea(x1, y1, w1, h1);
155 for (int16_t i = 0; i < h1; i++)
157 for (int16_t j = 0; j < w1 / 8; j++)
161 int32_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;
164#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
165 data = pgm_read_byte(&bitmap[idx]);
174 if (invert) data = ~data;
181void GxEPD2_370_TC1::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)
185 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
190 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
194 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
198void GxEPD2_370_TC1::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)
202 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
208 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
214 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
216 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
218 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
221void GxEPD2_370_TC1::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)
225 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
230 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
234 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
238void GxEPD2_370_TC1::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 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
261 int16_t w1 = x < 0 ? w + x : w;
262 int16_t h1 = y < 0 ? h + y : h;
263 int16_t x1 = x < 0 ? 0 : x;
264 int16_t y1 = y < 0 ? 0 : y;
265 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
266 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
267 if ((w1 <= 0) || (h1 <= 0))
return;
270 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
273 _setPartialRamArea(x1, y1, w1, h1);
293void GxEPD2_370_TC1::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
315void GxEPD2_370_TC1::_PowerOn()
327void GxEPD2_370_TC1::_PowerOff()
340void GxEPD2_370_TC1::_InitDisplay()
388const uint8_t GxEPD2_370_TC1::lut_full[]
PROGMEM =
390 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391 0x05, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392 0x2A, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393 0x05, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x02, 0x03, 0x0A, 0x00, 0x02, 0x06, 0x0A, 0x05, 0x00,
396 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x22, 0x22, 0x22, 0x22, 0x22
403const uint8_t GxEPD2_370_TC1::lut_partial[]
PROGMEM =
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x01, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407 0x0A, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x05, 0x05, 0x00, 0x05, 0x03, 0x05, 0x05, 0x00,
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
415 0x22, 0x22, 0x22, 0x22, 0x22
418void GxEPD2_370_TC1::_Init_Full()
429void GxEPD2_370_TC1::_Init_Part()
440void GxEPD2_370_TC1::_Update_Full()
450void GxEPD2_370_TC1::_Update_Part()
const uint8_t GxEPD2_370_TC1::lut_full[] PROGMEM
static const uint16_t full_refresh_time
void writeScreenBufferAgain(uint8_t value=0xFF)
void writeImageAgain(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 refresh(bool partial_update_mode=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)
static const uint16_t WIDTH
static const uint16_t power_on_time
void writeScreenBuffer(uint8_t value=0xFF)
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)
static const uint16_t power_off_time
void writeImagePartAgain(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)
static const uint16_t partial_refresh_time
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 writeImageForFullRefresh(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 clearScreen(uint8_t value=0xFF)
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)
GxEPD2_370_TC1(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)
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)