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

#include <GxEPD2_it78_1872x1404.h>

Inheritance diagram for GxEPD2_it78_1872x1404:
GxEPD2_EPD

Public Member Functions

 GxEPD2_it78_1872x1404 (int16_t cs, int16_t dc, int16_t rst, int16_t busy)
 
void init (uint32_t serial_diag_bitrate=0)
 
void init (uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration=20, bool pulldown_rst_mode=false)
 
void clearScreen (uint8_t value=0x33)
 
void writeScreenBuffer (uint8_t value=0x33)
 
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 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 = 1872
 
static const uint16_t HEIGHT = 1404
 
static const GxEPD2::Panel panel = GxEPD2::ED078KC2
 
static const bool hasColor = false
 
static const bool hasPartialUpdate = true
 
static const bool hasFastPartialUpdate = true
 
static const uint16_t reset_to_ready_time = 1800
 
static const uint16_t power_on_time = 10
 
static const uint16_t power_off_time = 250
 
static const uint16_t full_refresh_time = 650
 
static const uint16_t partial_refresh_time = 300
 
static const uint16_t refresh_cmd_time = 10
 
static const uint16_t refresh_par_time = 2
 
static const uint16_t default_wait_time = 1
 
static const uint16_t diag_min_time = 3
 
static const uint16_t set_vcom_time = 500
 

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 22 of file GxEPD2_it78_1872x1404.h.

Constructor & Destructor Documentation

◆ GxEPD2_it78_1872x1404()

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

Definition at line 58 of file GxEPD2_it78_1872x1404.cpp.

58 :
59 GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate),
60 _spi_settings(24000000, MSBFIRST, SPI_MODE0),
61 _spi_settings_for_read(1000000, MSBFIRST, SPI_MODE0)
62{
63}
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)
static const GxEPD2::Panel panel
static const bool hasFastPartialUpdate
static const uint16_t HEIGHT
static const uint16_t WIDTH
static const bool hasPartialUpdate

Member Function Documentation

◆ clearScreen()

void GxEPD2_it78_1872x1404::clearScreen ( uint8_t value = 0x33)
virtual

Implements GxEPD2_EPD.

Definition at line 108 of file GxEPD2_it78_1872x1404.cpp.

109{
110 _initial_write = false; // initial full screen buffer clean done
111 if (_initial_refresh) _Init_Full();
112 else _Init_Part();
113 _initial_refresh = false;
114 _setPartialRamArea(0, 0, WIDTH, HEIGHT);
115 SPI.beginTransaction(_spi_settings);
116 if (_cs >= 0) digitalWrite(_cs, LOW);
117 _transfer16(0x0000); // preamble for write data
118 _waitWhileBusy2("clearScreen preamble", default_wait_time);
119 for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT); i++)
120 {
121 SPI.transfer(value);
122#if defined(ESP8266) || defined(ESP32)
123 if (0 == i % 10000) yield();
124#endif
125 }
126 if (_cs >= 0) digitalWrite(_cs, HIGH);
127 SPI.endTransaction();
128 _writeCommand16(IT8951_TCON_LD_IMG_END);
129 _waitWhileBusy2("clearScreen load end", default_wait_time);
130 _refresh(0, 0, WIDTH, HEIGHT, false);
131}
#define IT8951_TCON_LD_IMG_END
bool _initial_refresh
Definition GxEPD2_EPD.h:117
bool _initial_write
Definition GxEPD2_EPD.h:117
int16_t _cs
Definition GxEPD2_EPD.h:112
static const uint16_t default_wait_time

◆ drawImage() [1/2]

void GxEPD2_it78_1872x1404::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 360 of file GxEPD2_it78_1872x1404.cpp.

361{
362 writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
363 _refresh(x, y, w, h, true);
364}
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_it78_1872x1404::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 347 of file GxEPD2_it78_1872x1404.cpp.

348{
349 writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
350 _refresh(x, y, w, h, true);
351}

◆ drawImagePart() [1/2]

void GxEPD2_it78_1872x1404::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 366 of file GxEPD2_it78_1872x1404.cpp.

368{
369 writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
370 _refresh(x, y, w, h, true);
371}
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_it78_1872x1404::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 353 of file GxEPD2_it78_1872x1404.cpp.

355{
356 writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
357 _refresh(x, y, w, h, true);
358}

◆ drawNative()

void GxEPD2_it78_1872x1404::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 373 of file GxEPD2_it78_1872x1404.cpp.

374{
375 writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
376 _refresh(x, y, w, h, false);
377}
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_it78_1872x1404::hibernate ( )
virtual

Implements GxEPD2_EPD.

Definition at line 420 of file GxEPD2_it78_1872x1404.cpp.

421{
422 if (_power_is_on) _PowerOff();
423 if (_rst >= 0)
424 {
425 // this does not work, does not reduce power, uses more than in stand by mode
426 //delay(1000);
427 //_IT8951Sleep();
428 //delay(1000);
429 //_hibernating = true;
430 }
431}
bool _power_is_on
Definition GxEPD2_EPD.h:118
int16_t _rst
Definition GxEPD2_EPD.h:112

◆ init() [1/2]

void GxEPD2_it78_1872x1404::init ( uint32_t serial_diag_bitrate,
bool initial,
uint16_t reset_duration = 20,
bool pulldown_rst_mode = false )
virtual

Reimplemented from GxEPD2_EPD.

Definition at line 70 of file GxEPD2_it78_1872x1404.cpp.

71{
72 GxEPD2_EPD::init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
73
74 // we need a long reset pulse
75 if (_rst >= 0)
76 {
77 digitalWrite(_rst, LOW);
78 delay(200);
79 digitalWrite(_rst, HIGH);
80 delay(200);
81 _waitWhileBusy("init reset_to_ready", reset_to_ready_time);
82 }
83
84 _writeCommand16(USDEF_I80_CMD_GET_DEV_INFO);
85 _waitWhileBusy("GetIT8951SystemInfo", power_on_time);
86 _readData16((uint16_t*)&IT8951DevInfo, sizeof(IT8951DevInfo) / 2);
87 if (_diag_enabled)
88 {
89 //Show Device information of IT8951
90 printf("Panel(W,H) = (%d,%d)\r\n",
91 IT8951DevInfo.usPanelW, IT8951DevInfo.usPanelH );
92 printf("Image Buffer Address = %lX\r\n",
93 uint32_t(IT8951DevInfo.usImgBufAddrL) | (uint32_t(IT8951DevInfo.usImgBufAddrH) << 16));
94 //Show Firmware and LUT Version
95 printf("FW Version = %s\r\n", (uint8_t*)IT8951DevInfo.usFWVersion);
96 printf("LUT Version = %s\r\n", (uint8_t*)IT8951DevInfo.usLUTVersion);
97 }
98 //Set to Enable I80 Packed mode
99 _IT8951WriteReg(I80CPCR, 0x0001);
100 if (VCOM != _IT8951GetVCOM())
101 {
102 _IT8951SetVCOM(VCOM);
103 printf("VCOM = -%.02fV\n", (double)_IT8951GetVCOM() / 1000);
104 }
105 printf("VCOM = -%.02fV\n", (double)_IT8951GetVCOM() / 1000);
106}
#define I80CPCR
#define VCOM
#define USDEF_I80_CMD_GET_DEV_INFO
bool _diag_enabled
Definition GxEPD2_EPD.h:114
virtual void init(uint32_t serial_diag_bitrate=0)
void _waitWhileBusy(const char *comment=0, uint16_t busy_time=5000)
static const uint16_t reset_to_ready_time
static const uint16_t power_on_time

◆ init() [2/2]

void GxEPD2_it78_1872x1404::init ( uint32_t serial_diag_bitrate = 0)
virtual

Reimplemented from GxEPD2_EPD.

Definition at line 65 of file GxEPD2_it78_1872x1404.cpp.

66{
67 init(serial_diag_bitrate, true, 20, false);
68}
void init(uint32_t serial_diag_bitrate=0)

◆ powerOff()

void GxEPD2_it78_1872x1404::powerOff ( void )
virtual

Implements GxEPD2_EPD.

Definition at line 415 of file GxEPD2_it78_1872x1404.cpp.

416{
417 _PowerOff();
418}

◆ refresh() [1/2]

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

Implements GxEPD2_EPD.

Definition at line 379 of file GxEPD2_it78_1872x1404.cpp.

380{
381 _refresh(0, 0, WIDTH, HEIGHT, partial_update_mode);
382}

◆ refresh() [2/2]

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

Implements GxEPD2_EPD.

Definition at line 384 of file GxEPD2_it78_1872x1404.cpp.

385{
386 _refresh(x, y, w, h, true);
387}

◆ writeImage() [1/2]

void GxEPD2_it78_1872x1404::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 275 of file GxEPD2_it78_1872x1404.cpp.

276{
277 if (black)
278 {
279 writeImage(black, x, y, w, h, invert, mirror_y, pgm);
280 }
281}

◆ writeImage() [2/2]

void GxEPD2_it78_1872x1404::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 161 of file GxEPD2_it78_1872x1404.cpp.

162{
163 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
164 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
165 int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
166 x -= x % 8; // byte boundary
167 w = wb * 8; // byte boundary
168 int16_t x1 = x < 0 ? 0 : x; // limit
169 int16_t y1 = y < 0 ? 0 : y; // limit
170 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
171 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
172 int16_t dx = x1 - x;
173 int16_t dy = y1 - y;
174 w1 -= dx;
175 h1 -= dy;
176 if ((w1 <= 0) || (h1 <= 0)) return;
177 if (!_using_partial_mode) _Init_Part();
178 _setPartialRamArea(x1, y1, w1, h1);
179 SPI.beginTransaction(_spi_settings);
180 if (_cs >= 0) digitalWrite(_cs, LOW);
181 _transfer16(0x0000); // preamble for write data
182 _waitWhileBusy2("writeImage preamble", default_wait_time);
183 for (int16_t i = 0; i < h1; i++)
184 {
185 for (int16_t j = 0; j < w1 / 8; j++)
186 {
187 uint8_t data;
188 // use wb, h of bitmap for index!
189 uint32_t idx = mirror_y ? uint32_t(j + dx / 8) + uint32_t((h - 1 - (i + dy))) * uint32_t(wb) : uint32_t(j + dx / 8) + uint32_t(i + dy) * uint32_t(wb);
190 if (pgm)
191 {
192#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
193 data = pgm_read_byte(&bitmap[idx]);
194#else
195 data = bitmap[idx];
196#endif
197 }
198 else
199 {
200 data = bitmap[idx];
201 }
202 if (invert) data = ~data;
203 _send8pixel(~data);
204 }
205#if defined(ESP8266) || defined(ESP32)
206 yield();
207#endif
208 }
209 if (_cs >= 0) digitalWrite(_cs, HIGH);
210 SPI.endTransaction();
211 _writeCommand16(IT8951_TCON_LD_IMG_END);
212 _waitWhileBusy2("writeImage load end", default_wait_time);
213 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
214}
bool _using_partial_mode
Definition GxEPD2_EPD.h:118
void writeScreenBuffer(uint8_t value=0x33)

◆ writeImagePart() [1/2]

void GxEPD2_it78_1872x1404::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 283 of file GxEPD2_it78_1872x1404.cpp.

285{
286 if (black)
287 {
288 writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
289 }
290}

◆ writeImagePart() [2/2]

void GxEPD2_it78_1872x1404::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 216 of file GxEPD2_it78_1872x1404.cpp.

218{
219 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
220 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
221 if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
222 if ((x_part < 0) || (x_part >= w_bitmap)) return;
223 if ((y_part < 0) || (y_part >= h_bitmap)) return;
224 int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
225 x_part -= x_part % 8; // byte boundary
226 w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
227 h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
228 x -= x % 8; // byte boundary
229 w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
230 int16_t x1 = x < 0 ? 0 : x; // limit
231 int16_t y1 = y < 0 ? 0 : y; // limit
232 int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
233 int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
234 int16_t dx = x1 - x;
235 int16_t dy = y1 - y;
236 w1 -= dx;
237 h1 -= dy;
238 if ((w1 <= 0) || (h1 <= 0)) return;
239 if (!_using_partial_mode) _Init_Part();
240 _setPartialRamArea(x1, y1, w1, h1);
241 SPI.beginTransaction(_spi_settings);
242 if (_cs >= 0) digitalWrite(_cs, LOW);
243 _transfer16(0x0000); // preamble for write data
244 _waitWhileBusy2("writeImage preamble", default_wait_time);
245 for (int16_t i = 0; i < h1; i++)
246 {
247 for (int16_t j = 0; j < w1 / 8; j++)
248 {
249 uint8_t data;
250 // use wb_bitmap, h_bitmap of bitmap for index!
251 uint32_t idx = mirror_y ? x_part / 8 + (j + dx / 8) + uint32_t((h_bitmap - 1 - (y_part + i + dy))) * uint32_t(wb_bitmap) : x_part / 8 + j + dx / 8 + uint32_t(y_part + i + dy) * uint32_t(wb_bitmap);
252 if (pgm)
253 {
254#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
255 data = pgm_read_byte(&bitmap[idx]);
256#else
257 data = bitmap[idx];
258#endif
259 }
260 else
261 {
262 data = bitmap[idx];
263 }
264 if (invert) data = ~data;
265 _send8pixel(~data);
266 }
267 }
268 if (_cs >= 0) digitalWrite(_cs, HIGH);
269 SPI.endTransaction();
270 _writeCommand16(IT8951_TCON_LD_IMG_END);
271 _waitWhileBusy2("writeImage load end", default_wait_time);
272 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
273}

◆ writeNative()

void GxEPD2_it78_1872x1404::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 292 of file GxEPD2_it78_1872x1404.cpp.

293{
294 if (data1)
295 {
296 if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
297 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
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 if (!_using_partial_mode) _Init_Part();
308 _setPartialRamArea(x1, y1, w1, h1);
309 SPI.beginTransaction(_spi_settings);
310 if (_cs >= 0) digitalWrite(_cs, LOW);
311 _transfer16(0x0000); // preamble for write data
312 _waitWhileBusy2("writeNative preamble", default_wait_time);
313 for (int16_t i = 0; i < h1; i++)
314 {
315 for (int16_t j = 0; j < w1; j++)
316 {
317 uint8_t data;
318 // use w, h of bitmap for index!
319 uint32_t idx = mirror_y ? uint32_t(j + dx) + uint32_t((h - 1 - (i + dy))) * uint32_t(w) : uint32_t(j + dx) + uint32_t(i + dy) * uint32_t(w);
320 if (pgm)
321 {
322#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
323 data = pgm_read_byte(&data1[idx]);
324#else
325 data = data1[idx];
326#endif
327 }
328 else
329 {
330 data = data1[idx];
331 }
332 if (invert) data = ~data;
333 SPI.transfer(data);
334 }
335#if defined(ESP8266) || defined(ESP32)
336 yield();
337#endif
338 }
339 if (_cs >= 0) digitalWrite(_cs, HIGH);
340 SPI.endTransaction();
341 _writeCommand16(IT8951_TCON_LD_IMG_END);
342 _waitWhileBusy2("writeNative load end", default_wait_time);
343 delay(1); // yield() to avoid WDT on ESP8266 and ESP32
344 }
345}

◆ writeScreenBuffer()

void GxEPD2_it78_1872x1404::writeScreenBuffer ( uint8_t value = 0x33)
virtual

Implements GxEPD2_EPD.

Definition at line 133 of file GxEPD2_it78_1872x1404.cpp.

134{
135 if (_initial_refresh) clearScreen(value);
136 else _writeScreenBuffer(value);
137}
void clearScreen(uint8_t value=0x33)

Member Data Documentation

◆ default_wait_time

const uint16_t GxEPD2_it78_1872x1404::default_wait_time = 1
static

Definition at line 39 of file GxEPD2_it78_1872x1404.h.

◆ diag_min_time

const uint16_t GxEPD2_it78_1872x1404::diag_min_time = 3
static

Definition at line 40 of file GxEPD2_it78_1872x1404.h.

◆ full_refresh_time

const uint16_t GxEPD2_it78_1872x1404::full_refresh_time = 650
static

Definition at line 35 of file GxEPD2_it78_1872x1404.h.

◆ hasColor

const bool GxEPD2_it78_1872x1404::hasColor = false
static

Definition at line 29 of file GxEPD2_it78_1872x1404.h.

◆ hasFastPartialUpdate

const bool GxEPD2_it78_1872x1404::hasFastPartialUpdate = true
static

Definition at line 31 of file GxEPD2_it78_1872x1404.h.

◆ hasPartialUpdate

const bool GxEPD2_it78_1872x1404::hasPartialUpdate = true
static

Definition at line 30 of file GxEPD2_it78_1872x1404.h.

◆ HEIGHT

const uint16_t GxEPD2_it78_1872x1404::HEIGHT = 1404
static

Definition at line 27 of file GxEPD2_it78_1872x1404.h.

◆ panel

const GxEPD2::Panel GxEPD2_it78_1872x1404::panel = GxEPD2::ED078KC2
static

Definition at line 28 of file GxEPD2_it78_1872x1404.h.

◆ partial_refresh_time

const uint16_t GxEPD2_it78_1872x1404::partial_refresh_time = 300
static

Definition at line 36 of file GxEPD2_it78_1872x1404.h.

◆ power_off_time

const uint16_t GxEPD2_it78_1872x1404::power_off_time = 250
static

Definition at line 34 of file GxEPD2_it78_1872x1404.h.

◆ power_on_time

const uint16_t GxEPD2_it78_1872x1404::power_on_time = 10
static

Definition at line 33 of file GxEPD2_it78_1872x1404.h.

◆ refresh_cmd_time

const uint16_t GxEPD2_it78_1872x1404::refresh_cmd_time = 10
static

Definition at line 37 of file GxEPD2_it78_1872x1404.h.

◆ refresh_par_time

const uint16_t GxEPD2_it78_1872x1404::refresh_par_time = 2
static

Definition at line 38 of file GxEPD2_it78_1872x1404.h.

◆ reset_to_ready_time

const uint16_t GxEPD2_it78_1872x1404::reset_to_ready_time = 1800
static

Definition at line 32 of file GxEPD2_it78_1872x1404.h.

◆ set_vcom_time

const uint16_t GxEPD2_it78_1872x1404::set_vcom_time = 500
static

Definition at line 41 of file GxEPD2_it78_1872x1404.h.

◆ WIDTH

const uint16_t GxEPD2_it78_1872x1404::WIDTH = 1872
static

Definition at line 26 of file GxEPD2_it78_1872x1404.h.


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