16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
30 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
35 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
52 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
57 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
63void GxEPD2_270c::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
65 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
68void GxEPD2_270c::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)
72 int16_t wb = (w + 7) / 8;
75 int16_t x1 = x < 0 ? 0 : x;
76 int16_t y1 = y < 0 ? 0 : y;
77 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
78 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
83 if ((w1 <= 0) || (h1 <= 0))
return;
85 _setPartialRamArea_270c(0x14, x1, y1, w1, h1);
86 for (int16_t i = 0; i < h1; i++)
88 for (int16_t j = 0; j < w1 / 8; j++)
94 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
97#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
98 data = pgm_read_byte(&black[idx]);
107 if (invert) data = ~data;
112 _setPartialRamArea_270c(0x15, x1, y1, w1, h1);
113 for (int16_t i = 0; i < h1; i++)
115 for (int16_t j = 0; j < w1 / 8; j++)
121 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
124#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
125 data = pgm_read_byte(&color[idx]);
134 if (invert) data = ~data;
143 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
145 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
149 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
153 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
154 if ((x_part < 0) || (x_part >= w_bitmap))
return;
155 if ((y_part < 0) || (y_part >= h_bitmap))
return;
156 int16_t wb_bitmap = (w_bitmap + 7) / 8;
157 x_part -= x_part % 8;
158 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
159 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
161 w = 8 * ((w + 7) / 8);
162 int16_t x1 = x < 0 ? 0 : x;
163 int16_t y1 = y < 0 ? 0 : y;
164 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
165 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
170 if ((w1 <= 0) || (h1 <= 0))
return;
172 _setPartialRamArea_270c(0x14, x1, y1, w1, h1);
173 for (int16_t i = 0; i < h1; i++)
175 for (int16_t j = 0; j < w1 / 8; j++)
179 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;
182#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
183 data = pgm_read_byte(&black[idx]);
192 if (invert) data = ~data;
196 _setPartialRamArea_270c(0x15, x1, y1, w1, h1);
197 for (int16_t i = 0; i < h1; i++)
199 for (int16_t j = 0; j < w1 / 8; j++)
205 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;
208#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
209 data = pgm_read_byte(&color[idx]);
218 if (invert) data = ~data;
226void GxEPD2_270c::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)
230 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
234void GxEPD2_270c::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
236 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
241 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
243 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
247void GxEPD2_270c::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)
249 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
253void GxEPD2_270c::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,
254 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
256 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
260void GxEPD2_270c::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)
262 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
275 int16_t w1 = x < 0 ? w + x : w;
276 int16_t h1 = y < 0 ? h + y : h;
277 int16_t x1 = x < 0 ? 0 : x;
278 int16_t y1 = y < 0 ? 0 : y;
279 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
280 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
281 if ((w1 <= 0) || (h1 <= 0))
return;
284 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
287 w1 = (w1 + 7 + (x1 % 8)) & 0xfff8;
317void GxEPD2_270c::_setPartialRamArea_270c(uint8_t cmd, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
319 w = (w + 7 + (x % 8)) & 0xfff8;
331void GxEPD2_270c::_PowerOn()
341void GxEPD2_270c::_PowerOff()
348void GxEPD2_270c::_InitDisplay()
395const uint8_t GxEPD2_270c::lut_20_vcomDC[]
PROGMEM =
398 0x00 , 0x1A , 0x1A , 0x00 , 0x00 , 0x01,
399 0x00 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
400 0x00 , 0x0E , 0x01 , 0x0E , 0x01 , 0x10,
401 0x00 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
402 0x00 , 0x04 , 0x10 , 0x00 , 0x00 , 0x05,
403 0x00 , 0x03 , 0x0E , 0x00 , 0x00 , 0x0A,
404 0x00 , 0x23 , 0x00 , 0x00 , 0x00 , 0x01
407const uint8_t GxEPD2_270c::lut_21[]
PROGMEM = {
408 0x90 , 0x1A , 0x1A , 0x00 , 0x00 , 0x01,
409 0x40 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
410 0x84 , 0x0E , 0x01 , 0x0E , 0x01 , 0x10,
411 0x80 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
412 0x00 , 0x04 , 0x10 , 0x00 , 0x00 , 0x05,
413 0x00 , 0x03 , 0x0E , 0x00 , 0x00 , 0x0A,
414 0x00 , 0x23 , 0x00 , 0x00 , 0x00 , 0x01
417const uint8_t GxEPD2_270c::lut_22_red[]
PROGMEM = {
418 0xA0 , 0x1A , 0x1A , 0x00 , 0x00 , 0x01,
419 0x00 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
420 0x84 , 0x0E , 0x01 , 0x0E , 0x01 , 0x10,
421 0x90 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
422 0xB0 , 0x04 , 0x10 , 0x00 , 0x00 , 0x05,
423 0xB0 , 0x03 , 0x0E , 0x00 , 0x00 , 0x0A,
424 0xC0 , 0x23 , 0x00 , 0x00 , 0x00 , 0x01
427const uint8_t GxEPD2_270c::lut_23_white[]
PROGMEM = {
428 0x90 , 0x1A , 0x1A , 0x00 , 0x00 , 0x01,
429 0x40 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
430 0x84 , 0x0E , 0x01 , 0x0E , 0x01 , 0x10,
431 0x80 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
432 0x00 , 0x04 , 0x10 , 0x00 , 0x00 , 0x05,
433 0x00 , 0x03 , 0x0E , 0x00 , 0x00 , 0x0A,
434 0x00 , 0x23 , 0x00 , 0x00 , 0x00 , 0x01
437const uint8_t GxEPD2_270c::lut_24_black[]
PROGMEM = {
438 0x90 , 0x1A , 0x1A , 0x00 , 0x00 , 0x01,
439 0x20 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
440 0x84 , 0x0E , 0x01 , 0x0E , 0x01 , 0x10,
441 0x10 , 0x0A , 0x0A , 0x00 , 0x00 , 0x08,
442 0x00 , 0x04 , 0x10 , 0x00 , 0x00 , 0x05,
443 0x00 , 0x03 , 0x0E , 0x00 , 0x00 , 0x0A,
444 0x00 , 0x23 , 0x00 , 0x00 , 0x00 , 0x01
447void GxEPD2_270c::_Init_Full()
463void GxEPD2_270c::_Init_Part()
479void GxEPD2_270c::_Update_Full()
485void GxEPD2_270c::_Update_Part()
const uint8_t GxEPD2_270c::lut_20_vcomDC[] PROGMEM
void writeScreenBuffer(uint8_t value=0xFF)
static const uint16_t HEIGHT
static const uint16_t power_off_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)
static const uint16_t power_on_time
static const uint16_t full_refresh_time
void refresh(bool partial_update_mode=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)
GxEPD2_270c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t WIDTH
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)
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 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 partial_refresh_time
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 _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
void _writeDataPGM_sCS(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)
static uint16_t gx_uint16_min(uint16_t a, uint16_t b)