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

#include <GxEPD2_290_M06.h>

Inheritance diagram for GxEPD2_290_M06:
GxEPD2_EPD

Public Member Functions

 GxEPD2_290_M06 (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::GDEW029M06
 
static const bool hasColor = false
 
static const bool hasPartialUpdate = true
 
static const bool hasFastPartialUpdate = true
 
static const uint16_t power_on_time = 100
 
static const uint16_t power_off_time = 50
 
static const uint16_t full_refresh_time = 3600
 
static const uint16_t partial_refresh_time = 600
 

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_M06.h.

Constructor & Destructor Documentation

◆ GxEPD2_290_M06()

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

Definition at line 15 of file GxEPD2_290_M06.cpp.

15 :
16 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
17{
18}
static const GxEPD2::Panel panel
static const bool hasFastPartialUpdate
static const uint16_t WIDTH
static const bool hasColor
static const uint16_t HEIGHT
static const bool hasPartialUpdate
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_M06::clearScreen ( uint8_t value = 0xFF)
virtual

Implements GxEPD2_EPD.

Definition at line 20 of file GxEPD2_290_M06.cpp.

21{
22 writeScreenBuffer(value);
23 refresh(true);
24 writeScreenBuffer(value);
25}
void refresh(bool partial_update_mode=false)
void writeScreenBuffer(uint8_t value=0xFF)

◆ drawImage() [1/2]

void GxEPD2_290_M06::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 187 of file GxEPD2_290_M06.cpp.

188{
189 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
190 refresh(x, y, w, h);
191 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
192}
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_M06::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 172 of file GxEPD2_290_M06.cpp.

173{
174 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
175 refresh(x, y, w, h);
176 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
177}

◆ drawImagePart() [1/2]

void GxEPD2_290_M06::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 194 of file GxEPD2_290_M06.cpp.

196{
197 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
198 refresh(x, y, w, h);
199 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
200}
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_M06::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 179 of file GxEPD2_290_M06.cpp.

181{
182 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
183 refresh(x, y, w, h);
184 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
185}

◆ drawNative()

void GxEPD2_290_M06::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 202 of file GxEPD2_290_M06.cpp.

203{
204 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
205 refresh(x, y, w, h);
206 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
207}
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_M06::hibernate ( )
virtual

Implements GxEPD2_EPD.

Definition at line 247 of file GxEPD2_290_M06.cpp.

248{
249 _PowerOff();
250 if (_rst >= 0)
251 {
252 _writeCommand(0x07); // deep sleep
253 _writeData(0xA5); // check code
254 _hibernating = true;
255 }
256}
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_290_M06::powerOff ( void )
virtual

Implements GxEPD2_EPD.

Definition at line 242 of file GxEPD2_290_M06.cpp.

243{
244 _PowerOff();
245}

◆ refresh() [1/2]

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

Implements GxEPD2_EPD.

Definition at line 209 of file GxEPD2_290_M06.cpp.

210{
211 if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
212 else
213 {
214 if (_using_partial_mode) _Init_Full();
215 _Update_Full();
216 _initial_refresh = false; // initial full update done
217 }
218}
bool _using_partial_mode
Definition GxEPD2_EPD.h:118
bool _initial_refresh
Definition GxEPD2_EPD.h:117

◆ refresh() [2/2]

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

Implements GxEPD2_EPD.

Definition at line 220 of file GxEPD2_290_M06.cpp.

221{
222 if (_initial_refresh) return refresh(false); // initial update needs be full update
223 // intersection with screen
224 int16_t w1 = x < 0 ? w + x : w; // reduce
225 int16_t h1 = y < 0 ? h + y : h; // reduce
226 int16_t x1 = x < 0 ? 0 : x; // limit
227 int16_t y1 = y < 0 ? 0 : y; // limit
228 w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit
229 h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit
230 if ((w1 <= 0) || (h1 <= 0)) return;
231 // make x1, w1 multiple of 8
232 w1 += x1 % 8;
233 if (w1 % 8 > 0) w1 += 8 - w1 % 8;
234 x1 -= x1 % 8;
235 if (!_using_partial_mode) _Init_Part();
236 _writeCommand(0x91); // partial in
237 _setPartialRamArea(x1, y1, w1, h1);
238 _Update_Part();
239 _writeCommand(0x92); // partial out
240}

◆ writeImage() [1/2]

void GxEPD2_290_M06::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 147 of file GxEPD2_290_M06.cpp.

148{
149 if (black)
150 {
151 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
152 }
153}

◆ writeImage() [2/2]

void GxEPD2_290_M06::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 46 of file GxEPD2_290_M06.cpp.

47{
48 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
49 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
50 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
51 x -= x % 8; // byte boundary
52 w = wb * 8; // byte boundary
53 int16_t x1 = x < 0 ? 0 : x; // limit
54 int16_t y1 = y < 0 ? 0 : y; // limit
55 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
56 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
57 int16_t dx = x1 - x;
58 int16_t dy = y1 - y;
59 w1 -= dx;
60 h1 -= dy;
61 if ((w1 <= 0) || (h1 <= 0)) return;
62 if (!_using_partial_mode) _Init_Part();
63 _writeCommand(0x91); // partial in
64 _setPartialRamArea(x1, y1, w1, h1);
65 _writeCommand(0x13);
66 for (int16_t i = 0; i < h1; i++)
67 {
68 for (int16_t j = 0; j < w1 / 8; j++)
69 {
70 uint8_t data;
71 // use wb, h of bitmap for index!
72 int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
73 if (pgm)
74 {
75#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
76 data = pgm_read_byte(&bitmap[idx]);
77#else
78 data = bitmap[idx];
79#endif
80 }
81 else
82 {
83 data = bitmap[idx];
84 }
85 if (invert) data = ~data;
86 _writeData(data);
87 }
88 }
89 _writeCommand(0x92); // partial out
90 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
91}
bool _initial_write
Definition GxEPD2_EPD.h:117

◆ writeImagePart() [1/2]

void GxEPD2_290_M06::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 155 of file GxEPD2_290_M06.cpp.

157{
158 if (black)
159 {
160 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
161 }
162}

◆ writeImagePart() [2/2]

void GxEPD2_290_M06::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 93 of file GxEPD2_290_M06.cpp.

95{
96 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
97 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
98 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
99 if ((x_part < 0) || (x_part >= w_bitmap)) return;
100 if ((y_part < 0) || (y_part >= h_bitmap)) return;
101 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
102 x_part -= x_part % 8; // byte boundary
103 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
104 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
105 x -= x % 8; // byte boundary
106 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
107 int16_t x1 = x < 0 ? 0 : x; // limit
108 int16_t y1 = y < 0 ? 0 : y; // limit
109 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
110 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
111 int16_t dx = x1 - x;
112 int16_t dy = y1 - y;
113 w1 -= dx;
114 h1 -= dy;
115 if ((w1 <= 0) || (h1 <= 0)) return;
116 if (!_using_partial_mode) _Init_Part();
117 _writeCommand(0x91); // partial in
118 _setPartialRamArea(x1, y1, w1, h1);
119 _writeCommand(0x13);
120 for (int16_t i = 0; i < h1; i++)
121 {
122 for (int16_t j = 0; j < w1 / 8; j++)
123 {
124 uint8_t data;
125 // use wb_bitmap, h_bitmap of bitmap for index!
126 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;
127 if (pgm)
128 {
129#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
130 data = pgm_read_byte(&bitmap[idx]);
131#else
132 data = bitmap[idx];
133#endif
134 }
135 else
136 {
137 data = bitmap[idx];
138 }
139 if (invert) data = ~data;
140 _writeData(data);
141 }
142 }
143 _writeCommand(0x92); // partial out
144 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
145}

◆ writeNative()

void GxEPD2_290_M06::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 164 of file GxEPD2_290_M06.cpp.

165{
166 if (data1)
167 {
168 writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
169 }
170}

◆ writeScreenBuffer()

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

Implements GxEPD2_EPD.

Definition at line 27 of file GxEPD2_290_M06.cpp.

28{
29 _initial_write = false; // initial full screen buffer clean done
30 if (!_using_partial_mode) _Init_Part();
31 _writeCommand(0x13); // set current
32 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
33 {
34 _writeData(value);
35 }
37 {
38 _writeCommand(0x10); // preset previous
39 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
40 {
41 _writeData(0xFF); // 0xFF is white
42 }
43 }
44}

Member Data Documentation

◆ full_refresh_time

const uint16_t GxEPD2_290_M06::full_refresh_time = 3600
static

Definition at line 30 of file GxEPD2_290_M06.h.

◆ hasColor

const bool GxEPD2_290_M06::hasColor = false
static

Definition at line 25 of file GxEPD2_290_M06.h.

◆ hasFastPartialUpdate

const bool GxEPD2_290_M06::hasFastPartialUpdate = true
static

Definition at line 27 of file GxEPD2_290_M06.h.

◆ hasPartialUpdate

const bool GxEPD2_290_M06::hasPartialUpdate = true
static

Definition at line 26 of file GxEPD2_290_M06.h.

◆ HEIGHT

const uint16_t GxEPD2_290_M06::HEIGHT = 296
static

Definition at line 23 of file GxEPD2_290_M06.h.

◆ panel

const GxEPD2::Panel GxEPD2_290_M06::panel = GxEPD2::GDEW029M06
static

Definition at line 24 of file GxEPD2_290_M06.h.

◆ partial_refresh_time

const uint16_t GxEPD2_290_M06::partial_refresh_time = 600
static

Definition at line 31 of file GxEPD2_290_M06.h.

◆ power_off_time

const uint16_t GxEPD2_290_M06::power_off_time = 50
static

Definition at line 29 of file GxEPD2_290_M06.h.

◆ power_on_time

const uint16_t GxEPD2_290_M06::power_on_time = 100
static

Definition at line 28 of file GxEPD2_290_M06.h.

◆ WIDTH

const uint16_t GxEPD2_290_M06::WIDTH = 128
static

Definition at line 22 of file GxEPD2_290_M06.h.


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