17 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
32 _writeScreenBuffer(0x24, value);
39 _writeScreenBuffer(0x24, value);
42void GxEPD2_270_T91::_writeScreenBuffer(uint8_t command, uint8_t value)
45 for (uint32_t i = 0; i < uint32_t(
WIDTH) * uint32_t(
HEIGHT) / 8; i++)
53 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
58 _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
59 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
65 _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
68void GxEPD2_270_T91::_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)
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(x1, y1, w1, h1);
87 for (int16_t i = 0; i < h1; i++)
89 for (int16_t j = 0; j < w1 / 8; j++)
93 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
96#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
97 data = pgm_read_byte(&bitmap[idx]);
106 if (invert) data = ~data;
114 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
116 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
120 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
122 _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
125void GxEPD2_270_T91::_writeImagePart(uint8_t command,
const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
126 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
130 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0))
return;
131 if ((x_part < 0) || (x_part >= w_bitmap))
return;
132 if ((y_part < 0) || (y_part >= h_bitmap))
return;
133 int16_t wb_bitmap = (w_bitmap + 7) / 8;
134 x_part -= x_part % 8;
135 w = w_bitmap - x_part < w ? w_bitmap - x_part : w;
136 h = h_bitmap - y_part < h ? h_bitmap - y_part : h;
138 w = 8 * ((w + 7) / 8);
139 int16_t x1 = x < 0 ? 0 : x;
140 int16_t y1 = y < 0 ? 0 : y;
141 int16_t w1 = x + w < int16_t(
WIDTH) ? w : int16_t(
WIDTH) - x;
142 int16_t h1 = y + h < int16_t(
HEIGHT) ? h : int16_t(
HEIGHT) - y;
147 if ((w1 <= 0) || (h1 <= 0))
return;
149 _setPartialRamArea(x1, y1, w1, h1);
151 for (int16_t i = 0; i < h1; i++)
153 for (int16_t j = 0; j < w1 / 8; j++)
157 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;
160#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
161 data = pgm_read_byte(&bitmap[idx]);
170 if (invert) data = ~data;
177void GxEPD2_270_T91::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)
181 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
186 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
190 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
194void GxEPD2_270_T91::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)
198 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
204 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
210 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
212 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
214 writeImagePartAgain(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
217void GxEPD2_270_T91::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)
221 drawImage(black, x, y, w, h, invert, mirror_y, pgm);
226 int16_t x, int16_t y, int16_t w, int16_t h,
bool invert,
bool mirror_y,
bool pgm)
230 drawImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
234void GxEPD2_270_T91::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)
238 drawImage(data1, x, y, w, h, invert, mirror_y, pgm);
257 int16_t w1 = x < 0 ? w + x : w;
258 int16_t h1 = y < 0 ? h + y : h;
259 int16_t x1 = x < 0 ? 0 : x;
260 int16_t y1 = y < 0 ? 0 : y;
261 w1 = x1 + w1 < int16_t(
WIDTH) ? w1 : int16_t(
WIDTH) - x1;
262 h1 = y1 + h1 < int16_t(
HEIGHT) ? h1 : int16_t(
HEIGHT) - y1;
263 if ((w1 <= 0) || (h1 <= 0))
return;
266 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
269 _setPartialRamArea(x1, y1, w1, h1);
289void GxEPD2_270_T91::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
308void GxEPD2_270_T91::_PowerOn()
320void GxEPD2_270_T91::_PowerOff()
333void GxEPD2_270_T91::_InitDisplay()
348void GxEPD2_270_T91::_Init_Full()
355void GxEPD2_270_T91::_Init_Part()
362void GxEPD2_270_T91::_Update_Full()
370void GxEPD2_270_T91::_Update_Part()
void writeScreenBuffer(uint8_t value=0xFF)
void refresh(bool partial_update_mode=false)
GxEPD2_270_T91(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
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 full_refresh_time
void writeScreenBufferAgain(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 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 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 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 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 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)
static const uint16_t WIDTH
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 partial_refresh_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)
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)