Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_it103_1872x1404.h
Go to the documentation of this file.
1// Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
2// Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines!
3//
4// GxEPD2_it103_1872x1404 class is based on Demo Example from Waveshare for Raspberry PI https://github.com/waveshare/IT8951/archive/master.zip
5// Controller: IT8951 : https://www.waveshare.com/w/upload/1/18/IT8951_D_V0.2.4.3_20170728.pdf
6//
7// The GxEPD2_it103_1872x1404 driver class supports the Waveshare e-Paper IT8951 Driver HAT connected with SPI for the ES103TC1 10.3" e-paper panel (parallel IF)
8// https://www.waveshare.com/product/displays/e-paper/epaper-1/10.3inch-e-paper-d.htm
9// This Driver HAT requires 5V power supply but works with 3.3V data lines; requires both MOSI and MISO SPI lines.
10//
11// Author: Jean-Marc Zingg
12//
13// Version: see library.properties
14//
15// Library: https://github.com/ZinggJM/GxEPD2
16
17#ifndef _GxEPD2_it103_1872x1404_H_
18#define _GxEPD2_it103_1872x1404_H_
19
20#include "../GxEPD2_EPD.h"
21
23{
24 public:
25 // attributes
26 static const uint16_t WIDTH = 1872;
27 static const uint16_t HEIGHT = 1404;
29 static const bool hasColor = false;
30 static const bool hasPartialUpdate = true;
31 static const bool hasFastPartialUpdate = true;
32 static const uint16_t reset_to_ready_time = 1800; // ms, e.g. 1729001us
33 static const uint16_t power_on_time = 10; // ms, e.g. 3001us
34 static const uint16_t power_off_time = 250; // ms, e.g. 214001us
35 static const uint16_t full_refresh_time = 850; // ms, e.g. 827000us
36 static const uint16_t partial_refresh_time = 300; // ms, e.g. 284000us
37 static const uint16_t refresh_cmd_time = 10; // ms, e.g. 6052us
38 static const uint16_t refresh_par_time = 2; // ms, e.g. 1921us
39 static const uint16_t default_wait_time = 1; // ms, default busy check, needed?
40 static const uint16_t diag_min_time = 3; // ms, e.g. > refresh_par_time
41 static const uint16_t set_vcom_time = 500; // ms, e.g. 454967us
42 // constructor
43 GxEPD2_it103_1872x1404(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
44 // methods (virtual)
45 void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled
46 void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false);
47 // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
48 void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white)
49 void writeScreenBuffer(uint8_t value = 0x33); // init controller memory (default white)
50 // write to controller memory, without screen refresh; x and w should be multiple of 8
51 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);
52 void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
53 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
54 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);
55 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,
56 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
57 // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
58 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);
59 // write to controller memory, with screen refresh; x and w should be multiple of 8
60 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);
61 void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
62 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
63 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);
64 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,
65 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
66 // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
67 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);
68 void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
69 void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
70 void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
71 void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
72 private:
73 struct IT8951DevInfoStruct
74 {
75 uint16_t usPanelW;
76 uint16_t usPanelH;
77 uint16_t usImgBufAddrL;
78 uint16_t usImgBufAddrH;
79 uint16_t usFWVersion[8]; //16 Bytes String
80 uint16_t usLUTVersion[8]; //16 Bytes String
81 };
82 IT8951DevInfoStruct IT8951DevInfo;
83 SPISettings _spi_settings;
84 SPISettings _spi_settings_for_read;
85 private:
86 void _writeScreenBuffer(uint8_t value);
87 void _refresh(int16_t x, int16_t y, int16_t w, int16_t h, bool partial_update_mode);
88 void _send8pixel(uint8_t data);
89 void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
90 void _PowerOn();
91 void _PowerOff();
92 void _InitDisplay();
93 void _Init_Full();
94 void _Init_Part();
95 // IT8951
96 void _waitWhileBusy2(const char* comment = 0, uint16_t busy_time = 5000);
97 uint16_t _transfer16(uint16_t value);
98 void _writeCommand16(uint16_t c);
99 void _writeData16(uint16_t d);
100 void _writeData16(const uint16_t* d, uint32_t n);
101 uint16_t _readData16();
102 void _readData16(uint16_t* d, uint32_t n);
103 void _writeCommandData16(uint16_t c, const uint16_t* d, uint16_t n);
104 void _IT8951SystemRun();
105 void _IT8951StandBy();
106 void _IT8951Sleep();
107 uint16_t _IT8951ReadReg(uint16_t usRegAddr);
108 void _IT8951WriteReg(uint16_t usRegAddr, uint16_t usValue);
109 uint16_t _IT8951GetVCOM(void);
110 void _IT8951SetVCOM(uint16_t vcom);
111};
112
113#endif
static const bool hasFastPartialUpdate
static const uint16_t refresh_par_time
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)
static const uint16_t partial_refresh_time
static const uint16_t full_refresh_time
static const uint16_t reset_to_ready_time
static const uint16_t default_wait_time
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)
static const uint16_t diag_min_time
static const GxEPD2::Panel panel
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)
static const uint16_t WIDTH
static const bool hasPartialUpdate
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 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 refresh(bool partial_update_mode=false)
static const uint16_t power_on_time
void init(uint32_t serial_diag_bitrate=0)
void clearScreen(uint8_t value=0x33)
static const uint16_t set_vcom_time
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)
static const uint16_t refresh_cmd_time
void writeScreenBuffer(uint8_t value=0x33)
static const uint16_t power_off_time
GxEPD2_it103_1872x1404(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t HEIGHT
Panel
Definition GxEPD2.h:37
@ ES103TC1
Definition GxEPD2.h:78