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

#include <GxEPD2_290.h>

Inheritance diagram for GxEPD2_290:
GxEPD2_EPD

Public Member Functions

 GxEPD2_290 (int16_t cs, int16_t dc, int16_t rst, int16_t busy)
 
void clearScreen (uint8_t value=0xFF)
 
void writeScreenBuffer (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)
 
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 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 ()
 
- 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)
 
virtual void setPaged ()
 
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 = 128
 
static const uint16_t HEIGHT = 296
 
static const GxEPD2::Panel panel = GxEPD2::GDEH029A1
 
static const bool hasColor = false
 
static const bool hasPartialUpdate = true
 
static const bool hasFastPartialUpdate = true
 
static const uint16_t power_on_time = 80
 
static const uint16_t power_off_time = 100
 
static const uint16_t full_refresh_time = 1600
 
static const uint16_t partial_refresh_time = 420
 

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 18 of file GxEPD2_290.h.

Constructor & Destructor Documentation

◆ GxEPD2_290()

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

Definition at line 15 of file GxEPD2_290.cpp.

15 :
16 GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
17{
18}
static const bool hasFastPartialUpdate
Definition GxEPD2_290.h:27
static const uint16_t WIDTH
Definition GxEPD2_290.h:22
static const bool hasColor
Definition GxEPD2_290.h:25
static const uint16_t HEIGHT
Definition GxEPD2_290.h:23
static const GxEPD2::Panel panel
Definition GxEPD2_290.h:24
static const bool hasPartialUpdate
Definition GxEPD2_290.h:26
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()

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

Implements GxEPD2_EPD.

Definition at line 20 of file GxEPD2_290.cpp.

21{
22 _initial_write = false; // initial full screen buffer clean done
24 {
25 _Init_Full();
26 _setPartialRamArea(0, 0, WIDTH, HEIGHT);
27 _writeCommand(0x24);
28 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
29 {
30 _writeData(value);
31 }
32 _Update_Full();
33 _initial_refresh = false; // initial full update done
34 }
35 else
36 {
37 if (!_using_partial_mode) _Init_Part();
38 _setPartialRamArea(0, 0, WIDTH, HEIGHT);
39 _writeCommand(0x24);
40 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
41 {
42 _writeData(value);
43 }
44 _Update_Part();
45 }
46 if (!_using_partial_mode) _Init_Part();
47 _setPartialRamArea(0, 0, WIDTH, HEIGHT);
48 _writeCommand(0x24);
49 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
50 {
51 _writeData(value);
52 }
53 _Update_Part();
54}
void _writeCommand(uint8_t c)
void _writeData(uint8_t d)
bool _using_partial_mode
Definition GxEPD2_EPD.h:118
bool _initial_refresh
Definition GxEPD2_EPD.h:117
bool _initial_write
Definition GxEPD2_EPD.h:117

◆ drawImage() [1/2]

void GxEPD2_290::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 212 of file GxEPD2_290.cpp.

213{
214 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
215 refresh(x, y, w, h);
216 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
217}
void refresh(bool partial_update_mode=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)

◆ drawImage() [2/2]

void GxEPD2_290::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 197 of file GxEPD2_290.cpp.

198{
199 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
200 refresh(x, y, w, h);
201 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
202}

◆ drawImagePart() [1/2]

void GxEPD2_290::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 226 of file GxEPD2_290.cpp.

228{
229 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
230 refresh(x, y, w, h);
231 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
232}
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_290::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 204 of file GxEPD2_290.cpp.

206{
207 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
208 refresh(x, y, w, h);
209 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
210}

◆ drawNative()

void GxEPD2_290::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 219 of file GxEPD2_290.cpp.

220{
221 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
222 refresh(x, y, w, h);
223 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
224}
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_290::hibernate ( )
virtual

Implements GxEPD2_EPD.

Definition at line 270 of file GxEPD2_290.cpp.

271{
272 _PowerOff();
273 if (_rst >= 0)
274 {
275 _writeCommand(0x10); // deep sleep mode
276 _writeData(0x1); // enter deep sleep
277 _hibernating = true;
278 }
279}
int16_t _rst
Definition GxEPD2_EPD.h:112
bool _hibernating
Definition GxEPD2_EPD.h:118

◆ powerOff()

void GxEPD2_290::powerOff ( void )
virtual

Implements GxEPD2_EPD.

Definition at line 265 of file GxEPD2_290.cpp.

266{
267 _PowerOff();
268}

◆ refresh() [1/2]

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

Implements GxEPD2_EPD.

Definition at line 234 of file GxEPD2_290.cpp.

235{
236 if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
237 else
238 {
239 if (_using_partial_mode) _Init_Full();
240 _Update_Full();
241 _initial_refresh = false; // initial full update done
242 }
243}

◆ refresh() [2/2]

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

Implements GxEPD2_EPD.

Definition at line 245 of file GxEPD2_290.cpp.

246{
247 if (_initial_refresh) return refresh(false); // initial update needs be full update
248 // intersection with screen
249 int16_t w1 = x < 0 ? w + x : w; // reduce
250 int16_t h1 = y < 0 ? h + y : h; // reduce
251 int16_t x1 = x < 0 ? 0 : x; // limit
252 int16_t y1 = y < 0 ? 0 : y; // limit
253 w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit
254 h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit
255 if ((w1 <= 0) || (h1 <= 0)) return;
256 // make x1, w1 multiple of 8
257 w1 += x1 % 8;
258 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
259 x1 -= x1 % 8;
260 if (!_using_partial_mode) _Init_Part();
261 _setPartialRamArea(x1, y1, w1, h1);
262 _Update_Part();
263}

◆ writeImage() [1/2]

void GxEPD2_290::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 172 of file GxEPD2_290.cpp.

173{
174 if (black)
175 {
176 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
177 }
178}

◆ writeImage() [2/2]

void GxEPD2_290::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 75 of file GxEPD2_290.cpp.

76{
77 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
78 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
79 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
80 x -= x % 8; // byte boundary
81 w = wb * 8; // byte boundary
82 int16_t x1 = x < 0 ? 0 : x; // limit
83 int16_t y1 = y < 0 ? 0 : y; // limit
84 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
85 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
86 int16_t dx = x1 - x;
87 int16_t dy = y1 - y;
88 w1 -= dx;
89 h1 -= dy;
90 if ((w1 <= 0) || (h1 <= 0)) return;
91 if (!_using_partial_mode) _Init_Part();
92 _setPartialRamArea(x1, y1, w1, h1);
93 _writeCommand(0x24);
94 for (int16_t i = 0; i < h1; i++)
95 {
96 for (int16_t j = 0; j < w1 / 8; j++)
97 {
98 uint8_t data;
99 // use wb, h of bitmap for index!
100 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
101 if (pgm)
102 {
103#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
104 data = pgm_read_byte(&bitmap[idx]);
105#else
106 data = bitmap[idx];
107#endif
108 }
109 else
110 {
111 data = bitmap[idx];
112 }
113 if (invert) data = ~data;
114 _writeData(data);
115 }
116 }
117 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
118}
void writeScreenBuffer(uint8_t value=0xFF)

◆ writeImagePart() [1/2]

void GxEPD2_290::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 180 of file GxEPD2_290.cpp.

182{
183 if (black)
184 {
185 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
186 }
187}

◆ writeImagePart() [2/2]

void GxEPD2_290::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 120 of file GxEPD2_290.cpp.

122{
123 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
124 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
125 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
126 if ((x_part < 0) || (x_part >= w_bitmap)) return;
127 if ((y_part < 0) || (y_part >= h_bitmap)) return;
128 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
129 x_part -= x_part % 8; // byte boundary
130 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
131 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
132 x -= x % 8; // byte boundary
133 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
134 int16_t x1 = x < 0 ? 0 : x; // limit
135 int16_t y1 = y < 0 ? 0 : y; // limit
136 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
137 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
138 int16_t dx = x1 - x;
139 int16_t dy = y1 - y;
140 w1 -= dx;
141 h1 -= dy;
142 if ((w1 <= 0) || (h1 <= 0)) return;
143 if (!_using_partial_mode) _Init_Part();
144 _setPartialRamArea(x1, y1, w1, h1);
145 _writeCommand(0x24);
146 for (int16_t i = 0; i < h1; i++)
147 {
148 for (int16_t j = 0; j < w1 / 8; j++)
149 {
150 uint8_t data;
151 // use wb_bitmap, h_bitmap of bitmap for index!
152 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;
153 if (pgm)
154 {
155#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
156 data = pgm_read_byte(&bitmap[idx]);
157#else
158 data = bitmap[idx];
159#endif
160 }
161 else
162 {
163 data = bitmap[idx];
164 }
165 if (invert) data = ~data;
166 _writeData(data);
167 }
168 }
169 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
170}

◆ writeNative()

void GxEPD2_290::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 189 of file GxEPD2_290.cpp.

190{
191 if (data1)
192 {
193 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
194 }
195}

◆ writeScreenBuffer()

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

Implements GxEPD2_EPD.

Definition at line 56 of file GxEPD2_290.cpp.

57{
58 _initial_write = false; // initial full screen buffer clean done
59 // this controller has no command to write "old data"
60 if (_initial_refresh) clearScreen(value);
61 else _writeScreenBuffer(value);
62}
void clearScreen(uint8_t value=0xFF)

Member Data Documentation

◆ full_refresh_time

const uint16_t GxEPD2_290::full_refresh_time = 1600
static

Definition at line 30 of file GxEPD2_290.h.

◆ hasColor

const bool GxEPD2_290::hasColor = false
static

Definition at line 25 of file GxEPD2_290.h.

◆ hasFastPartialUpdate

const bool GxEPD2_290::hasFastPartialUpdate = true
static

Definition at line 27 of file GxEPD2_290.h.

◆ hasPartialUpdate

const bool GxEPD2_290::hasPartialUpdate = true
static

Definition at line 26 of file GxEPD2_290.h.

◆ HEIGHT

const uint16_t GxEPD2_290::HEIGHT = 296
static

Definition at line 23 of file GxEPD2_290.h.

◆ panel

const GxEPD2::Panel GxEPD2_290::panel = GxEPD2::GDEH029A1
static

Definition at line 24 of file GxEPD2_290.h.

◆ partial_refresh_time

const uint16_t GxEPD2_290::partial_refresh_time = 420
static

Definition at line 31 of file GxEPD2_290.h.

◆ power_off_time

const uint16_t GxEPD2_290::power_off_time = 100
static

Definition at line 29 of file GxEPD2_290.h.

◆ power_on_time

const uint16_t GxEPD2_290::power_on_time = 80
static

Definition at line 28 of file GxEPD2_290.h.

◆ WIDTH

const uint16_t GxEPD2_290::WIDTH = 128
static

Definition at line 22 of file GxEPD2_290.h.


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