Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_565c Class Reference

#include <GxEPD2_565c.h>

Inheritance diagram for GxEPD2_565c:
GxEPD2_EPD

Public Member Functions

 GxEPD2_565c (int16_t cs, int16_t dc, int16_t rst, int16_t busy)
 
void clearScreen (uint8_t value=0xFF)
 
void clearScreen (uint8_t black_value, uint8_t color_value)
 
void writeScreenBuffer (uint8_t value=0xFF)
 
void writeScreenBuffer (uint8_t black_value, uint8_t color_value)
 
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 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 writeImage (const uint8_t *black, const uint8_t *color, 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 *black, const uint8_t *color, 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 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 writeNativePart (const uint8_t *data1, const uint8_t *data2, 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)
 
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 drawImage (const uint8_t *black, const uint8_t *color, 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 *black, const uint8_t *color, 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 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)
 
void refresh (int16_t x, int16_t y, int16_t w, int16_t h)
 
void powerOff ()
 
void hibernate ()
 
void setPaged ()
 
- Public Member Functions inherited from GxEPD2_EPD
 GxEPD2_EPD (int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu)
 
virtual void init (uint32_t serial_diag_bitrate=0)
 
virtual void init (uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration=10, bool pulldown_rst_mode=false)
 
virtual 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)
 
virtual void writeScreenBufferAgain (uint8_t value=0xFF)
 
virtual 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)
 
virtual 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 setBusyCallback (void(*busyCallback)(const void *), const void *busy_callback_parameter=0)
 
void selectSPI (SPIClass &spi, SPISettings spi_settings)
 

Static Public Attributes

static const uint16_t WIDTH = 600
 
static const uint16_t WIDTH_VISIBLE = WIDTH
 
static const uint16_t HEIGHT = 448
 
static const GxEPD2::Panel panel = GxEPD2::ACeP565
 
static const bool hasColor = true
 
static const bool hasPartialUpdate = false
 
static const bool hasFastPartialUpdate = false
 
static const uint16_t power_on_time = 100
 
static const uint16_t power_off_time = 100
 
static const uint16_t full_refresh_time = 12000
 
static const uint16_t partial_refresh_time = 12000
 

Additional Inherited Members

- Static Public Member Functions inherited from GxEPD2_EPD
static uint16_t gx_uint16_min (uint16_t a, uint16_t b)
 
static uint16_t gx_uint16_max (uint16_t a, uint16_t b)
 
- Public Attributes inherited from GxEPD2_EPD
const uint16_t WIDTH
 
const uint16_t HEIGHT
 
const GxEPD2::Panel panel
 
const bool hasColor
 
const bool hasPartialUpdate
 
const bool hasFastPartialUpdate
 
- Protected Member Functions inherited from GxEPD2_EPD
void _reset ()
 
void _waitWhileBusy (const char *comment=0, uint16_t busy_time=5000)
 
void _writeCommand (uint8_t c)
 
void _writeData (uint8_t d)
 
void _writeData (const uint8_t *data, uint16_t n)
 
void _writeDataPGM (const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)
 
void _writeDataPGM_sCS (const uint8_t *data, uint16_t n, int16_t fill_with_zeroes=0)
 
void _writeCommandData (const uint8_t *pCommandData, uint8_t datalen)
 
void _writeCommandDataPGM (const uint8_t *pCommandData, uint8_t datalen)
 
void _startTransfer ()
 
void _transfer (uint8_t value)
 
void _endTransfer ()
 
- Protected Attributes inherited from GxEPD2_EPD
int16_t _cs
 
int16_t _dc
 
int16_t _rst
 
int16_t _busy
 
int16_t _busy_level
 
uint32_t _busy_timeout
 
bool _diag_enabled
 
bool _pulldown_rst_mode
 
SPIClass * _pSPIx
 
SPISettings _spi_settings
 
bool _initial_write
 
bool _initial_refresh
 
bool _power_is_on
 
bool _using_partial_mode
 
bool _hibernating
 
uint16_t _reset_duration
 
void(* _busy_callback )(const void *)
 
const void * _busy_callback_parameter
 

Detailed Description

Definition at line 19 of file GxEPD2_565c.h.

Constructor & Destructor Documentation

◆ GxEPD2_565c()

GxEPD2_565c::GxEPD2_565c ( int16_t cs,
int16_t dc,
int16_t rst,
int16_t busy )

Definition at line 17 of file GxEPD2_565c.cpp.

17 :
18 GxEPD2_EPD(cs, dc, rst, busy, LOW, 25000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
19{
20 _paged = false;
21}
static const bool hasFastPartialUpdate
Definition GxEPD2_565c.h:29
static const bool hasColor
Definition GxEPD2_565c.h:27
static const uint16_t HEIGHT
Definition GxEPD2_565c.h:25
static const GxEPD2::Panel panel
Definition GxEPD2_565c.h:26
static const bool hasPartialUpdate
Definition GxEPD2_565c.h:28
static const uint16_t WIDTH
Definition GxEPD2_565c.h:23
GxEPD2_EPD(int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu)

Member Function Documentation

◆ clearScreen() [1/2]

void GxEPD2_565c::clearScreen ( uint8_t black_value,
uint8_t color_value )

Definition at line 28 of file GxEPD2_565c.cpp.

29{
30 writeScreenBuffer(black_value, color_value);
31 _Update_Full();
32}
void writeScreenBuffer(uint8_t value=0xFF)

◆ clearScreen() [2/2]

void GxEPD2_565c::clearScreen ( uint8_t value = 0xFF)
virtual

Implements GxEPD2_EPD.

Definition at line 23 of file GxEPD2_565c.cpp.

24{
25 clearScreen(value, 0xFF);
26}
void clearScreen(uint8_t value=0xFF)

◆ drawImage() [1/2]

void GxEPD2_565c::drawImage ( const uint8_t * black,
const uint8_t * color,
int16_t x,
int16_t y,
int16_t w,
int16_t h,
bool invert = false,
bool mirror_y = false,
bool pgm = false )

Definition at line 499 of file GxEPD2_565c.cpp.

500{
501 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
502 refresh(x, y, w, h);
503}
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)

◆ drawImage() [2/2]

void GxEPD2_565c::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 )

Definition at line 486 of file GxEPD2_565c.cpp.

487{
488 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
489 refresh(x, y, w, h);
490}

◆ drawImagePart() [1/2]

void GxEPD2_565c::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,
int16_t x,
int16_t y,
int16_t w,
int16_t h,
bool invert = false,
bool mirror_y = false,
bool pgm = false )

Definition at line 505 of file GxEPD2_565c.cpp.

507{
508 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
509 refresh(x, y, w, h);
510}
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)

◆ drawImagePart() [2/2]

void GxEPD2_565c::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 )

Definition at line 492 of file GxEPD2_565c.cpp.

494{
495 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
496 refresh(x, y, w, h);
497}

◆ drawNative()

void GxEPD2_565c::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 )

Definition at line 512 of file GxEPD2_565c.cpp.

513{
514 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
515 refresh(x, y, w, h);
516}
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)

◆ hibernate()

void GxEPD2_565c::hibernate ( )
virtual

Implements GxEPD2_EPD.

Definition at line 534 of file GxEPD2_565c.cpp.

535{
536 _PowerOff();
537 if (_rst >= 0)
538 {
539 _writeCommand(0x07); // deep sleep
540 _writeData(0xA5); // control code
541 _hibernating = true;
542 }
543}
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
int16_t _rst
Definition GxEPD2_EPD.h:112
bool _hibernating
Definition GxEPD2_EPD.h:118

◆ powerOff()

void GxEPD2_565c::powerOff ( void )
virtual

Implements GxEPD2_EPD.

Definition at line 529 of file GxEPD2_565c.cpp.

530{
531 _PowerOff();
532}

◆ refresh() [1/2]

void GxEPD2_565c::refresh ( bool partial_update_mode = false)
virtual

Implements GxEPD2_EPD.

Definition at line 518 of file GxEPD2_565c.cpp.

519{
520 if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
521 else _Update_Full();
522}

◆ refresh() [2/2]

void GxEPD2_565c::refresh ( int16_t x,
int16_t y,
int16_t w,
int16_t h )
virtual

Implements GxEPD2_EPD.

Definition at line 524 of file GxEPD2_565c.cpp.

525{
526 _Update_Part();
527}

◆ setPaged()

void GxEPD2_565c::setPaged ( )
virtual

Reimplemented from GxEPD2_EPD.

Definition at line 545 of file GxEPD2_565c.cpp.

546{
547 _paged = true;
548 _Init_Full();
549 _writeCommand(0x10);
550}

◆ writeImage() [1/2]

void GxEPD2_565c::writeImage ( const uint8_t * black,
const uint8_t * color,
int16_t x,
int16_t y,
int16_t w,
int16_t h,
bool invert = false,
bool mirror_y = false,
bool pgm = false )

Definition at line 124 of file GxEPD2_565c.cpp.

125{
126 if (!black && !color) return;
127 if (!color) return writeImage(black, x, y, w, h, invert, mirror_y, pgm);
128 //Serial.print("writeImage("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
129 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
130 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
131 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
132 {
133 //Serial.println("paged");
135 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 8; i++)
136 {
137 uint8_t black_data = black[i];
138 uint8_t color_data = color[i];
139 for (int16_t k = 0; k < 4; k++)
140 {
141 uint8_t out_data = 0x00;
142 for (int16_t l = 0; l < 2; l++)
143 {
144 out_data <<= 4;
145 if (!(color_data & 0x80)) out_data |= 0x04;
146 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
147 black_data <<= 1;
148 color_data <<= 1;
149 }
150 _transfer(out_data);
151 }
152 }
153 _endTransfer();
154 if (y + h == HEIGHT) // last page
155 {
156 //Serial.println("paged ended");
157 _paged = false;
158 }
159 }
160 else
161 {
162 _paged = false;
163 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
164 x -= x % 8; // byte boundary
165 w = wb * 8; // byte boundary
166 if ((w <= 0) || (h <= 0)) return;
167 _Init_Full();
168 _writeCommand(0x10);
170 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
171 {
172 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
173 {
174 uint8_t black_data = 0xFF, color_data = 0xFF;
175 if ((j >= x) && (j < x + w) && (i >= y) && (i < y + h))
176 {
177 uint32_t idx = mirror_y ? (j - x) / 8 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 8 + uint32_t(i - y) * wb;
178 if (pgm)
179 {
180#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
181 black_data = pgm_read_byte(&black[idx]);
182 color_data = pgm_read_byte(&color[idx]);
183#else
184 black_data = black[idx];
185 color_data = color[idx];
186#endif
187 }
188 else
189 {
190 black_data = black[idx];
191 color_data = color[idx];
192 }
193 if (invert)
194 {
195 black_data = ~black_data;
196 color_data = ~color_data;
197 }
198 }
199 for (int16_t k = 0; k < 4; k++)
200 {
201 uint8_t out_data = 0x00;
202 for (int16_t l = 0; l < 2; l++)
203 {
204 out_data <<= 4;
205 if (!(color_data & 0x80)) out_data |= 0x04;
206 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
207 black_data <<= 1;
208 color_data <<= 1;
209 }
210 _transfer(out_data);
211 }
212 }
213 }
214 _endTransfer();
215 }
216 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
217}
void _endTransfer()
void _startTransfer()
void _transfer(uint8_t value)

◆ writeImage() [2/2]

void GxEPD2_565c::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 )
virtual

Implements GxEPD2_EPD.

Definition at line 53 of file GxEPD2_565c.cpp.

54{
55 //Serial.print("writeImage("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
56 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
57 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
58 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
59 {
60 //Serial.println("paged");
62 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 8; i++)
63 {
64 uint8_t data = bitmap[i];
65 for (int16_t k = 0; k < 4; k++)
66 {
67 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
68 data <<= 2;
69 _transfer(data2);
70 }
71 }
73 if (y + h == HEIGHT) // last page
74 {
75 //Serial.println("paged ended");
76 _paged = false;
77 }
78 }
79 else
80 {
81 _paged = false;
82 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
83 x -= x % 8; // byte boundary
84 w = wb * 8; // byte boundary
85 if ((w <= 0) || (h <= 0)) return;
86 _Init_Full();
87 _writeCommand(0x10);
89 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
90 {
91 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
92 {
93 uint8_t data = 0xFF;
94 if ((j >= x) && (j <= x + w) && (i >= y) && (i < y + h))
95 {
96 uint32_t idx = mirror_y ? (j - x) / 8 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 8 + uint32_t(i - y) * wb;
97 if (pgm)
98 {
99#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
100 data = pgm_read_byte(&bitmap[idx]);
101#else
102 data = bitmap[idx];
103#endif
104 }
105 else
106 {
107 data = bitmap[idx];
108 }
109 if (invert) data = ~data;
110 }
111 for (int16_t k = 0; k < 4; k++)
112 {
113 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
114 data <<= 2;
115 _transfer(data2);
116 }
117 }
118 }
119 _endTransfer();
120 }
121 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
122}

◆ writeImagePart() [1/2]

void GxEPD2_565c::writeImagePart ( const uint8_t * black,
const uint8_t * color,
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 )

Definition at line 279 of file GxEPD2_565c.cpp.

281{
282 //Serial.print("writeImagePart("); Serial.print(x_part); Serial.print(", "); Serial.print(y_part); Serial.print(", ");
283 //Serial.print(w_bitmap); Serial.print(", "); Serial.print(h_bitmap); Serial.print(", ");
284 //Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
285 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
286 if (!black && !color) return;
287 if (!color) return writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
288 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
289 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
290 if ((x_part < 0) || (x_part >= w_bitmap)) return;
291 if ((y_part < 0) || (y_part >= h_bitmap)) return;
292 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
293 x_part -= x_part % 8; // byte boundary
294 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
295 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
296 x -= x % 8; // byte boundary
297 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
298 int16_t x1 = x < 0 ? 0 : x; // limit
299 int16_t y1 = y < 0 ? 0 : y; // limit
300 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
301 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
302 int16_t dx = x1 - x;
303 int16_t dy = y1 - y;
304 w1 -= dx;
305 h1 -= dy;
306 if ((w1 <= 0) || (h1 <= 0)) return;
307 _Init_Full();
308 _writeCommand(0x10);
310 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
311 {
312 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
313 {
314 uint8_t black_data = 0xFF, color_data = 0xFF;
315 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
316 {
317 // use wb_bitmap, h_bitmap of bitmap for index!
318 uint32_t idx = mirror_y ? (x_part + j - x1) / 8 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + uint32_t(y_part + i - y1) * wb_bitmap;
319 if (pgm)
320 {
321#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
322 black_data = pgm_read_byte(&black[idx]);
323 color_data = pgm_read_byte(&color[idx]);
324#else
325 black_data = black[idx];
326 color_data = color[idx];
327#endif
328 }
329 else
330 {
331 black_data = black[idx];
332 color_data = color[idx];
333 }
334 if (invert)
335 {
336 black_data = ~black_data;
337 color_data = ~color_data;
338 }
339 }
340 for (int16_t k = 0; k < 4; k++)
341 {
342 uint8_t out_data = 0x00;
343 for (int16_t l = 0; l < 2; l++)
344 {
345 out_data <<= 4;
346 if (!(color_data & 0x80)) out_data |= 0x04;
347 else out_data |= black_data & 0x80 ? 0x01 : 0x00;
348 black_data <<= 1;
349 color_data <<= 1;
350 }
351 _transfer(out_data);
352 }
353 }
354 }
355 _endTransfer();
356 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
357}

◆ writeImagePart() [2/2]

void GxEPD2_565c::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 )
virtual

Implements GxEPD2_EPD.

Definition at line 219 of file GxEPD2_565c.cpp.

221{
222 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
223 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
224 if ((x_part < 0) || (x_part >= w_bitmap)) return;
225 if ((y_part < 0) || (y_part >= h_bitmap)) return;
226 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
227 x_part -= x_part % 8; // byte boundary
228 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
229 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
230 x -= x % 8; // byte boundary
231 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
232 int16_t x1 = x < 0 ? 0 : x; // limit
233 int16_t y1 = y < 0 ? 0 : y; // limit
234 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
235 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
236 int16_t dx = x1 - x;
237 int16_t dy = y1 - y;
238 w1 -= dx;
239 h1 -= dy;
240 if ((w1 <= 0) || (h1 <= 0)) return;
241 _Init_Full();
242 _writeCommand(0x10);
244 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
245 {
246 for (int16_t j = 0; j < int16_t(WIDTH); j += 8)
247 {
248 uint8_t data = 0xFF;
249 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
250 {
251 // use wb_bitmap, h_bitmap of bitmap for index!
252 uint32_t idx = mirror_y ? (x_part + j - x1) / 8 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 8 + uint32_t(y_part + i - y1) * wb_bitmap;
253 if (pgm)
254 {
255#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
256 data = pgm_read_byte(&bitmap[idx]);
257#else
258 data = bitmap[idx];
259#endif
260 }
261 else
262 {
263 data = bitmap[idx];
264 }
265 if (invert) data = ~data;
266 }
267 for (int16_t k = 0; k < 4; k++)
268 {
269 uint8_t data2 = (data & 0x80 ? 0x10 : 0x00) | (data & 0x40 ? 0x01 : 0x00);
270 data <<= 2;
271 _transfer(data2);
272 }
273 }
274 }
275 _endTransfer();
276 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
277}

◆ writeNative()

void GxEPD2_565c::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 )

Definition at line 359 of file GxEPD2_565c.cpp.

360{
361 if (data1)
362 {
363 //Serial.print("writeNative("); Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
364 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
365 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
366 if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
367 {
368 //Serial.println("paged");
370 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(h) / 2; i++)
371 {
372 uint8_t data = data1[i];
373 _transfer(data);
374 }
375 _endTransfer();
376 if (y + h == HEIGHT) // last page
377 {
378 //Serial.println("paged ended");
379 _paged = false;
380 }
381 }
382 else
383 {
384 _paged = false;
385 int16_t wb = (w + 1) / 2; // width bytes, bitmaps are padded
386 x -= x % 2; // byte boundary
387 w = wb * 2; // byte boundary
388 if ((w <= 0) || (h <= 0)) return;
389 _Init_Full();
390 _writeCommand(0x10);
392 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
393 {
394 for (int16_t j = 0; j < int16_t(WIDTH); j += 2)
395 {
396 uint8_t data = 0x11;
397 if (data1)
398 {
399 if ((j >= x) && (j < x + w) && (i >= y) && (i < y + h))
400 {
401 uint32_t idx = mirror_y ? (j - x) / 2 + uint32_t((h - 1 - (i - y))) * wb : (j - x) / 2 + uint32_t(i - y) * wb;
402 if (pgm)
403 {
404#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
405 data = pgm_read_byte(&data1[idx]);
406#else
407 data = data1[idx];
408#endif
409 }
410 else
411 {
412 data = data1[idx];
413 }
414 if (invert) data = ~data;
415 }
416 }
417 _transfer(data);
418 }
419 }
420 _endTransfer();
421 }
422 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
423 }
424}

◆ writeNativePart()

void GxEPD2_565c::writeNativePart ( const uint8_t * data1,
const uint8_t * data2,
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 )

Definition at line 426 of file GxEPD2_565c.cpp.

428{
429 //Serial.print("writeNativePart("); Serial.print(x_part); Serial.print(", "); Serial.print(y_part); Serial.print(", ");
430 //Serial.print(w_bitmap); Serial.print(", "); Serial.print(h_bitmap); Serial.print(", ");
431 //Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", ");
432 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
433 if (!data1) return;
434 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
435 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
436 if ((x_part < 0) || (x_part >= w_bitmap)) return;
437 if ((y_part < 0) || (y_part >= h_bitmap)) return;
438 int16_t wb_bitmap = (w_bitmap + 1) / 2; // width bytes, bitmaps are padded
439 x_part -= x_part % 2; // byte boundary
440 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
441 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
442 x -= x % 2; // byte boundary
443 w = 2 * ((w + 1) / 2); // byte boundary, bitmaps are padded
444 int16_t x1 = x < 0 ? 0 : x; // limit
445 int16_t y1 = y < 0 ? 0 : y; // limit
446 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
447 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
448 int16_t dx = x1 - x;
449 int16_t dy = y1 - y;
450 w1 -= dx;
451 h1 -= dy;
452 if ((w1 <= 0) || (h1 <= 0)) return;
453 _Init_Full();
454 _writeCommand(0x10);
456 for (int16_t i = 0; i < int16_t(HEIGHT); i++)
457 {
458 for (int16_t j = 0; j < int16_t(WIDTH); j += 2)
459 {
460 uint8_t data = 0x11;
461 if ((j >= x1) && (j < x1 + w) && (i >= y1) && (i < y1 + h))
462 {
463 // use wb_bitmap, h_bitmap of bitmap for index!
464 uint32_t idx = mirror_y ? (x_part + j - x1) / 2 + uint32_t((h_bitmap - 1 - (y_part + i - y1))) * wb_bitmap : (x_part + j - x1) / 2 + uint32_t(y_part + i - y1) * wb_bitmap;
465 if (pgm)
466 {
467#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
468 data = pgm_read_byte(&data1[idx]);
469#else
470 data = data1[idx];
471#endif
472 }
473 else
474 {
475 data = data1[idx];
476 }
477 if (invert) data = ~data;
478 }
479 _transfer(data);
480 }
481 }
482 _endTransfer();
483 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
484}

◆ writeScreenBuffer() [1/2]

void GxEPD2_565c::writeScreenBuffer ( uint8_t black_value,
uint8_t color_value )

Definition at line 39 of file GxEPD2_565c.cpp.

40{
41 _initial_write = false; // initial full screen buffer clean done
42 _Init_Full();
43 _writeCommand(0x10);
45 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 2; i++)
46 {
47 //_transfer(0x11);
48 _transfer(0xFF == black_value ? 0x11 : black_value);
49 }
51}
bool _initial_write
Definition GxEPD2_EPD.h:117

◆ writeScreenBuffer() [2/2]

void GxEPD2_565c::writeScreenBuffer ( uint8_t value = 0xFF)
virtual

Implements GxEPD2_EPD.

Definition at line 34 of file GxEPD2_565c.cpp.

35{
36 writeScreenBuffer(value, 0xFF);
37}

Member Data Documentation

◆ full_refresh_time

const uint16_t GxEPD2_565c::full_refresh_time = 12000
static

Definition at line 32 of file GxEPD2_565c.h.

◆ hasColor

const bool GxEPD2_565c::hasColor = true
static

Definition at line 27 of file GxEPD2_565c.h.

◆ hasFastPartialUpdate

const bool GxEPD2_565c::hasFastPartialUpdate = false
static

Definition at line 29 of file GxEPD2_565c.h.

◆ hasPartialUpdate

const bool GxEPD2_565c::hasPartialUpdate = false
static

Definition at line 28 of file GxEPD2_565c.h.

◆ HEIGHT

const uint16_t GxEPD2_565c::HEIGHT = 448
static

Definition at line 25 of file GxEPD2_565c.h.

◆ panel

const GxEPD2::Panel GxEPD2_565c::panel = GxEPD2::ACeP565
static

Definition at line 26 of file GxEPD2_565c.h.

◆ partial_refresh_time

const uint16_t GxEPD2_565c::partial_refresh_time = 12000
static

Definition at line 33 of file GxEPD2_565c.h.

◆ power_off_time

const uint16_t GxEPD2_565c::power_off_time = 100
static

Definition at line 31 of file GxEPD2_565c.h.

◆ power_on_time

const uint16_t GxEPD2_565c::power_on_time = 100
static

Definition at line 30 of file GxEPD2_565c.h.

◆ WIDTH

const uint16_t GxEPD2_565c::WIDTH = 600
static

Definition at line 23 of file GxEPD2_565c.h.

◆ WIDTH_VISIBLE

const uint16_t GxEPD2_565c::WIDTH_VISIBLE = WIDTH
static

Definition at line 24 of file GxEPD2_565c.h.


The documentation for this class was generated from the following files: