17 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
36 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
44 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
55 int16_t wb = (w + 7) / 8;
58 int16_t x1 = x < 0 ? 0 : x;
59 int16_t y1 = y < 0 ? 0 : y;
60 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
61 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
66 if ((w1 <= 0) || (h1 <= 0))
return;
70 _setPartialRamArea(x1, y1, w1, h1);
73 for (int16_t i = 0; i < h1; i++)
75 for (int16_t j = 0; j < w1 / 8; j++)
79 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
82#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
83 data = pgm_read_byte(&bitmap[idx]);
92 if (invert) data = ~data;
103 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
107 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
108 if ((x_part < 0) || (x_part >= w_bitmap))
return;
109 if ((y_part < 0) || (y_part >= h_bitmap))
return;
110 int16_t wb_bitmap = (w_bitmap + 7) / 8;
111 x_part -= x_part % 8;
112 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
113 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
115 w = 8 * ((w + 7) / 8);
116 int16_t x1 = x < 0 ? 0 : x;
117 int16_t y1 = y < 0 ? 0 : y;
118 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
119 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
124 if ((w1 <= 0) || (h1 <= 0))
return;
127 _setPartialRamArea(x1, y1, w1, h1);
130 for (int16_t i = 0; i < h1; i++)
132 for (int16_t j = 0; j < w1 / 8; j++)
136 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;
139#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
140 data = pgm_read_byte(&bitmap[idx]);
149 if (invert) data = ~data;
158void GxEPD2_420_M01::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)
162 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
167 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
171 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
175void GxEPD2_420_M01::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)
179 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
185 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
187 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
191 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
193 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
195 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
198void GxEPD2_420_M01::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)
200 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
202 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
206 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
208 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
210 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
213void GxEPD2_420_M01::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)
215 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
217 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
235 int16_t w1 = x < 0 ? w + x : w;
236 int16_t h1 = y < 0 ? h + y : h;
237 int16_t x1 = x < 0 ? 0 : x;
238 int16_t y1 = y < 0 ? 0 : y;
239 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
240 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
241 if ((w1 <= 0) || (h1 <= 0))
return;
244 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
248 _setPartialRamArea(x1, y1, w1, h1);
269void GxEPD2_420_M01::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
271 uint16_t xe = (x + w - 1) | 0x0007;
272 uint16_t ye = y + h - 1;
287void GxEPD2_420_M01::_PowerOn()
297void GxEPD2_420_M01::_PowerOff()
305void GxEPD2_420_M01::_InitDisplay()
325const unsigned char GxEPD2_420_M01::lut_20_vcom0_partial[]
PROGMEM =
330const unsigned char GxEPD2_420_M01::lut_21_ww_partial[]
PROGMEM =
335const unsigned char GxEPD2_420_M01::lut_22_bw_partial[]
PROGMEM =
341const unsigned char GxEPD2_420_M01::lut_23_wb_partial[]
PROGMEM =
347const unsigned char GxEPD2_420_M01::lut_24_bb_partial[]
PROGMEM =
352void GxEPD2_420_M01::_Init_Full()
359void GxEPD2_420_M01::_Init_Part()
388 _writeDataPGM(lut_20_vcom0_partial,
sizeof(lut_20_vcom0_partial), 44 -
sizeof(lut_20_vcom0_partial));
390 _writeDataPGM(lut_21_ww_partial,
sizeof(lut_21_ww_partial), 42 -
sizeof(lut_21_ww_partial));
392 _writeDataPGM(lut_22_bw_partial,
sizeof(lut_22_bw_partial), 42 -
sizeof(lut_22_bw_partial));
394 _writeDataPGM(lut_23_wb_partial,
sizeof(lut_23_wb_partial), 42 -
sizeof(lut_23_wb_partial));
396 _writeDataPGM(lut_24_bb_partial,
sizeof(lut_24_bb_partial), 42 -
sizeof(lut_24_bb_partial));
402void GxEPD2_420_M01::_Update_Full()
408void GxEPD2_420_M01::_Update_Part()
const unsigned char GxEPD2_420_M01::lut_20_vcom0_partial[] PROGMEM
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
GxEPD2_420_M01(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t HEIGHT
void clearScreen(uint8_t value=0xFF)
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 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
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 bool hasPartialUpdate
void writeScreenBuffer(uint8_t value=0xFF)
void refresh(bool partial_update_mode=false)
static const uint16_t full_refresh_time
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 partial_refresh_time
static const uint16_t WIDTH
static const bool usePartialUpdateWindow
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)
void _writeDataPGM(const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)