20 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
35 _writeScreenBuffer(0x24, value);
42 _writeScreenBuffer(0x26, value);
43 _writeScreenBuffer(0x24, value);
46void GxEPD2_290_BS::_writeScreenBuffer(uint8_t command, uint8_t value)
49 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
55void GxEPD2_290_BS::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
57 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
62 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
63 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
69 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
70 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
73void GxEPD2_290_BS::_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)
77 int16_t wb = (w + 7) / 8;
80 int16_t x1 = x < 0 ? 0 : x;
81 int16_t y1 = y < 0 ? 0 : y;
82 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
83 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
88 if ((w1 <= 0) || (h1 <= 0))
return;
90 _setPartialRamArea(x1, y1, w1, h1);
92 for (int16_t i = 0; i < h1; i++)
94 for (int16_t j = 0; j < w1 / 8; j++)
98 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
101#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
102 data = pgm_read_byte(&bitmap[idx]);
111 if (invert) data = ~data;
119 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
121 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
125 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
127 _writeImagePart(0x26, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
128 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
131void GxEPD2_290_BS::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
132 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
136 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
137 if ((x_part < 0) || (x_part >= w_bitmap))
return;
138 if ((y_part < 0) || (y_part >= h_bitmap))
return;
139 int16_t wb_bitmap = (w_bitmap + 7) / 8;
140 x_part -= x_part % 8;
141 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
142 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
144 w = 8 * ((w + 7) / 8);
145 int16_t x1 = x < 0 ? 0 : x;
146 int16_t y1 = y < 0 ? 0 : y;
147 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
148 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
153 if ((w1 <= 0) || (h1 <= 0))
return;
155 _setPartialRamArea(x1, y1, w1, h1);
157 for (int16_t i = 0; i < h1; i++)
159 for (int16_t j = 0; j < w1 / 8; j++)
163 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;
166#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
167 data = pgm_read_byte(&bitmap[idx]);
176 if (invert) data = ~data;
183void GxEPD2_290_BS::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)
187 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
192 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
196 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
200void GxEPD2_290_BS::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)
204 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
208void GxEPD2_290_BS::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
210 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
216 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
218 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
220 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
223void GxEPD2_290_BS::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)
227 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
232 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
236 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
240void GxEPD2_290_BS::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)
244 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
263 int16_t w1 = x < 0 ? w + x : w;
264 int16_t h1 = y < 0 ? h + y : h;
265 int16_t x1 = x < 0 ? 0 : x;
266 int16_t y1 = y < 0 ? 0 : y;
267 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
268 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
269 if ((w1 <= 0) || (h1 <= 0))
return;
272 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
275 _setPartialRamArea(x1, y1, w1, h1);
295void GxEPD2_290_BS::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
314void GxEPD2_290_BS::_PowerOn()
326void GxEPD2_290_BS::_PowerOff()
339void GxEPD2_290_BS::_InitDisplay()
361const unsigned char GxEPD2_290_BS::lut_partial[]
PROGMEM =
363 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
364 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
365 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
366 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
367 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
368 0x0A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2,
369 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
370 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
371 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
372 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
373 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
374 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
375 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
376 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
377 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
378 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
379 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
380 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
383void GxEPD2_290_BS::_Init_Full()
390void GxEPD2_290_BS::_Init_Part()
399void GxEPD2_290_BS::_Update_Full()
407void GxEPD2_290_BS::_Update_Part()
const unsigned char GxEPD2_290_BS::lut_partial[] PROGMEM
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)
void writeScreenBuffer(uint8_t value=0xFF)
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)
GxEPD2_290_BS(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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 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 refresh(bool partial_update_mode=false)
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 full_refresh_time
static const uint16_t HEIGHT
void writeScreenBufferAgain(uint8_t value=0xFF)
static const uint16_t power_on_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 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
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 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 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)
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)