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

#include <GxEPD2_154_T8.h>

Inheritance diagram for GxEPD2_154_T8:
GxEPD2_EPD

Public Member Functions

 GxEPD2_154_T8 (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 = 152
 
static const uint16_t HEIGHT = 152
 
static const GxEPD2::Panel panel = GxEPD2::GDEW0154T8
 
static const bool hasColor = false
 
static const bool hasPartialUpdate = true
 
static const bool hasFastPartialUpdate = true
 
static const uint16_t power_on_time = 60
 
static const uint16_t power_off_time = 20
 
static const uint16_t full_refresh_time = 1600
 
static const uint16_t partial_refresh_time = 350
 

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

Constructor & Destructor Documentation

◆ GxEPD2_154_T8()

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

Definition at line 16 of file GxEPD2_154_T8.cpp.

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

Implements GxEPD2_EPD.

Definition at line 21 of file GxEPD2_154_T8.cpp.

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

◆ drawImage() [1/2]

void GxEPD2_154_T8::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 188 of file GxEPD2_154_T8.cpp.

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

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

◆ drawImagePart() [1/2]

void GxEPD2_154_T8::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 195 of file GxEPD2_154_T8.cpp.

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

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

◆ drawNative()

void GxEPD2_154_T8::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 203 of file GxEPD2_154_T8.cpp.

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

Implements GxEPD2_EPD.

Definition at line 248 of file GxEPD2_154_T8.cpp.

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

Implements GxEPD2_EPD.

Definition at line 243 of file GxEPD2_154_T8.cpp.

244{
245 _PowerOff();
246}

◆ refresh() [1/2]

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

Implements GxEPD2_EPD.

Definition at line 210 of file GxEPD2_154_T8.cpp.

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

◆ refresh() [2/2]

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

Implements GxEPD2_EPD.

Definition at line 221 of file GxEPD2_154_T8.cpp.

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

◆ writeImage() [1/2]

void GxEPD2_154_T8::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 148 of file GxEPD2_154_T8.cpp.

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

◆ writeImage() [2/2]

void GxEPD2_154_T8::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 47 of file GxEPD2_154_T8.cpp.

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

◆ writeImagePart() [1/2]

void GxEPD2_154_T8::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 156 of file GxEPD2_154_T8.cpp.

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

◆ writeImagePart() [2/2]

void GxEPD2_154_T8::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 94 of file GxEPD2_154_T8.cpp.

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

◆ writeNative()

void GxEPD2_154_T8::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 165 of file GxEPD2_154_T8.cpp.

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

◆ writeScreenBuffer()

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

Implements GxEPD2_EPD.

Definition at line 28 of file GxEPD2_154_T8.cpp.

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

Member Data Documentation

◆ full_refresh_time

const uint16_t GxEPD2_154_T8::full_refresh_time = 1600
static

Definition at line 31 of file GxEPD2_154_T8.h.

◆ hasColor

const bool GxEPD2_154_T8::hasColor = false
static

Definition at line 26 of file GxEPD2_154_T8.h.

◆ hasFastPartialUpdate

const bool GxEPD2_154_T8::hasFastPartialUpdate = true
static

Definition at line 28 of file GxEPD2_154_T8.h.

◆ hasPartialUpdate

const bool GxEPD2_154_T8::hasPartialUpdate = true
static

Definition at line 27 of file GxEPD2_154_T8.h.

◆ HEIGHT

const uint16_t GxEPD2_154_T8::HEIGHT = 152
static

Definition at line 24 of file GxEPD2_154_T8.h.

◆ panel

const GxEPD2::Panel GxEPD2_154_T8::panel = GxEPD2::GDEW0154T8
static

Definition at line 25 of file GxEPD2_154_T8.h.

◆ partial_refresh_time

const uint16_t GxEPD2_154_T8::partial_refresh_time = 350
static

Definition at line 32 of file GxEPD2_154_T8.h.

◆ power_off_time

const uint16_t GxEPD2_154_T8::power_off_time = 20
static

Definition at line 30 of file GxEPD2_154_T8.h.

◆ power_on_time

const uint16_t GxEPD2_154_T8::power_on_time = 60
static

Definition at line 29 of file GxEPD2_154_T8.h.

◆ WIDTH

const uint16_t GxEPD2_154_T8::WIDTH = 152
static

Definition at line 23 of file GxEPD2_154_T8.h.


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