15const uint8_t GxEPD2_154c::bw2grey[] =
17 0b00000000, 0b00000011, 0b00001100, 0b00001111,
18 0b00110000, 0b00110011, 0b00111100, 0b00111111,
19 0b11000000, 0b11000011, 0b11001100, 0b11001111,
20 0b11110000, 0b11110011, 0b11111100, 0b11111111,
24 GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
27 _second_phase =
false;
34 _second_phase =
false;
37void GxEPD2_154c::init(uint32_t serial_diag_bitrate,
bool initial, uint16_t reset_duration,
bool pulldown_rst_mode)
39 GxEPD2_EPD::init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
41 _second_phase =
false;
53 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
55 _writeData(bw2grey[(black_value & 0xF0) >> 4]);
59 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
75 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
77 _writeData(bw2grey[(black_value & 0xF0) >> 4]);
81 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
87void GxEPD2_154c::writeImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
89 writeImage(bitmap, NULL, x, y, w, h, invert, mirror_y, pgm);
92void GxEPD2_154c::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)
97 if (_paged && (x == 0) && (w == int16_t(
WIDTH)) && (h < int16_t(
HEIGHT)))
102 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(h) / 8; i++)
110 _second_phase =
true;
116 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(h) / 8; i++)
123 _second_phase =
false;
131 uint16_t wb = (w + 7) / 8;
134 if ((w <= 0) || (h <= 0))
return;
137 for (int16_t i = 0; i < int16_t(
HEIGHT); i++)
139 for (int16_t j = 0; j < int16_t(
WIDTH); j += 8)
144 if ((j >= x) && (j <= x + w) && (i >= y) && (i < y + h))
146 uint16_t idx = mirror_y ? (j - x) / 8 + ((h - 1 - (i - y))) * wb : (j - x) / 8 + (i - y) * wb;
149#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
150 data = pgm_read_byte(&black[idx]);
159 if (invert) data = ~data;
168 for (int16_t i = 0; i < int16_t(
HEIGHT); i++)
170 for (int16_t j = 0; j < int16_t(
WIDTH); j += 8)
175 if ((j >= x) && (j <= x + w) && (i >= y) && (i < y + h))
177 uint16_t idx = mirror_y ? (j - x) / 8 + ((h - 1 - (i - y))) * wb : (j - x) / 8 + (i - y) * wb;
180#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
181 data = pgm_read_byte(&color[idx]);
190 if (invert) data = ~data;
201 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
203 writeImagePart(bitmap, NULL, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
207 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
210 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
211 if ((x_part < 0) || (x_part >= w_bitmap))
return;
212 if ((y_part < 0) || (y_part >= h_bitmap))
return;
213 int16_t wb_bitmap = (w_bitmap + 7) / 8;
214 x_part -= x_part % 8;
215 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
216 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
218 w = 8 * ((w + 7) / 8);
219 int16_t x1 = x < 0 ? 0 : x;
220 int16_t y1 = y < 0 ? 0 : y;
221 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
222 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
227 if ((w1 <= 0) || (h1 <= 0))
return;
230 for (int16_t i = 0; i < int16_t(
HEIGHT); i++)
232 for (int16_t j = 0; j < int16_t(
WIDTH); j += 8)
237 if ((j >= x1) && (j <= x1 + w) && (i >= y1) && (i < y1 + h))
241 uint16_t idx = mirror_y ? (x_part + j - x1) / 8 + ((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + (y_part + i - y1) * wb_bitmap;
244#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
245 data = pgm_read_byte(&black[idx]);
254 if (invert) data = ~data;
263 for (int16_t i = 0; i < int16_t(
HEIGHT); i++)
265 for (int16_t j = 0; j < int16_t(
WIDTH); j += 8)
270 if ((j >= x1) && (j <= x1 + w) && (i >= y1) && (i < y1 + h))
273 uint16_t idx = mirror_y ? (x_part + j - x1) / 8 + ((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + (y_part + i - y1) * wb_bitmap;
276#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
277 data = pgm_read_byte(&color[idx]);
286 if (invert) data = ~data;
295void GxEPD2_154c::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)
299 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
303void GxEPD2_154c::drawImage(
const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
305 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
310 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
312 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
316void GxEPD2_154c::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)
318 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
322void GxEPD2_154c::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,
323 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
325 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
329void GxEPD2_154c::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)
331 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
363void GxEPD2_154c::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
367void GxEPD2_154c::_PowerOn()
377void GxEPD2_154c::_PowerOff()
397 _second_phase =
false;
402void GxEPD2_154c::_InitDisplay()
429const uint8_t GxEPD2_154c::lut_20_vcom0[]
PROGMEM = { 0x0E , 0x14 , 0x01 , 0x0A , 0x06 , 0x04 , 0x0A , 0x0A , 0x0F , 0x03 , 0x03 , 0x0C , 0x06 , 0x0A , 0x00 };
430const uint8_t GxEPD2_154c::lut_21_w[]
PROGMEM = { 0x0E , 0x14 , 0x01 , 0x0A , 0x46 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x86 , 0x0A , 0x04 };
431const uint8_t GxEPD2_154c::lut_22_b[]
PROGMEM = { 0x0E , 0x14 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x4A , 0x04 };
432const uint8_t GxEPD2_154c::lut_23_g1[]
PROGMEM = { 0x8E , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
433const uint8_t GxEPD2_154c::lut_24_g2[]
PROGMEM = { 0x8E , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
434const uint8_t GxEPD2_154c::lut_25_vcom1[]
PROGMEM = { 0x03 , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
435const uint8_t GxEPD2_154c::lut_26_red0[]
PROGMEM = { 0x83 , 0x5D , 0x01 , 0x81 , 0x48 , 0x23 , 0x77 , 0x77 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
436const uint8_t GxEPD2_154c::lut_27_red1[]
PROGMEM = { 0x03 , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
438void GxEPD2_154c::_Init_Full()
460void GxEPD2_154c::_Init_Part()
466void GxEPD2_154c::_Update_Full()
472void GxEPD2_154c::_Update_Part()
const uint8_t GxEPD2_154c::lut_20_vcom0[] PROGMEM
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 power_on_time
void writeScreenBuffer(uint8_t value=0xFF)
void init(uint32_t serial_diag_bitrate=0)
static const uint16_t full_refresh_time
static const uint16_t HEIGHT
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 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)
GxEPD2_154c(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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)
void refresh(bool partial_update_mode=false)
static const uint16_t WIDTH
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 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 clearScreen(uint8_t value=0xFF)
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
virtual void init(uint32_t serial_diag_bitrate=0)
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)