Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_1248c.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: the e-paper panels require 3.3V supply AND data lines!
3//
4// based on Demo Example from Good Display:
5// Panel: GDEY1248Z51 : https://www.good-display.com/product/422.html
6// Controller: UC8179 : https://v4.cecdn.yun300.cn/100001_1909185148/UC8179.pdf
7// Connection Module : e.g. DESPI-C1248 : https://buyepaper.com/products/connection-board-for-1248-inch-large-eaper-e-ink-display-demo-despi-c1248
8// Demo Kit : e.g. DESPI-1248 : https://buy-lcd.com/products/demo-kit-driver-development-board-for-1248-inch-large-eaper-e-ink-display
9// Waveshare Kit : https://www.waveshare.com/product/displays/e-paper/epaper-1/12.48inch-e-paper-module-b.htm
10//
11// Author: Jean-Marc Zingg
12//
13// Version: see library.properties
14//
15// Library: https://github.com/ZinggJM/GxEPD2
16
17#ifndef _GxEPD2_1248c_H_
18#define _GxEPD2_1248c_H_
19
20#include "../GxEPD2_EPD.h"
21
23{
24 public:
25 // attributes
26 static const uint16_t WIDTH = 1304;
27 static const uint16_t WIDTH_VISIBLE = WIDTH;
28 static const uint16_t HEIGHT = 984;
30 static const bool hasColor = true;
31 static const bool hasPartialUpdate = true;
32 static const bool hasFastPartialUpdate = false;
33 static const uint16_t power_on_time = 200; // ms, e.g. 155001us
34 static const uint16_t power_off_time = 50; // ms, e.g. 41001us
35 static const uint16_t full_refresh_time = 18000; // ms, e.g. 17469001us
36 static const uint16_t partial_refresh_time = 18000; // ms, e.g. 17469001us
37 // constructors
38#if defined(ESP32)
39 // general constructor for use with all parameters on ESP32, e.g. for Waveshare ESP32 driver board mounted on connection board
40 GxEPD2_1248c(int16_t sck, int16_t miso, int16_t mosi,
41 int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2,
42 int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2,
43 int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2);
44#endif
45 // general constructor for use with standard SPI pins, default SCK, MISO and MOSI
46 GxEPD2_1248c(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2,
47 int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2,
48 int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2);
49 // constructor with minimal parameter set, standard SPI, dc1 and dc2, rst1 and rst2 to one pin, one busy used (can be -1)
50 GxEPD2_1248c(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, int16_t dc, int16_t rst, int16_t busy);
51 // methods (virtual)
52 void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled
53 void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false);
54 // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
55 void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
56 void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
57 void writeScreenBuffer(uint8_t black_value, uint8_t color_value); // init controller memory
58 // write to controller memory, without screen refresh; x and w should be multiple of 8
59 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);
60 void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
61 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
62 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);
63 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,
64 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
65 // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
66 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);
67 // write to controller memory, with screen refresh; x and w should be multiple of 8
68 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);
69 void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
70 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
71 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);
72 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,
73 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
74 // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
75 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);
76 void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
77 void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
78 void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
79 void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
80 private:
81 void _writeScreenBuffer(uint8_t command, uint8_t value);
82 void _writeImage(uint8_t command, 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);
83 void _writeImagePart(uint8_t command, const uint8_t* bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
84 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
85 void _reset();
86 void _initSPI();
87 void _PowerOn();
88 void _PowerOff();
89 void _InitDisplay();
90 void _Init_Full();
91 void _Init_Part();
92 void _Update_Full();
93 void _Update_Part();
94 void _writeCommandMaster(uint8_t c);
95 void _writeDataMaster(uint8_t d);
96 void _writeCommandAll(uint8_t c);
97 void _writeDataAll(uint8_t d);
98 void _writeDataPGM_All(const uint8_t* data, uint16_t n, int16_t fill_with_zeroes = 0);
99 void _waitWhileAnyBusy(const char* comment = 0, uint16_t busy_time = 5000);
100 void _getMasterTemperature();
101 private:
102 friend class GDEW1248T3_OTP;
103 void _readController(uint8_t cmd, uint8_t* data, uint16_t n, int8_t cs = -1, int8_t dc = -1);
104 private:
105 int16_t _sck, _miso, _mosi, _dc1, _dc2, _rst1, _rst2;
106 int16_t _cs_m1, _cs_s1, _cs_m2, _cs_s2;
107 int16_t _busy_m1, _busy_s1, _busy_m2, _busy_s2;
108 int8_t _temperature;
109 private:
110 class ScreenPart
111 {
112 public:
113 ScreenPart(uint16_t width, uint16_t height, bool rev_scan, int16_t cs, int16_t dc);
114 void writeScreenBuffer(uint8_t command, uint8_t value = 0xFF); // init controller memory current (default white)
115 void writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
116 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
117 void writeCommand(uint8_t c);
118 void writeData(uint8_t d);
119 private:
120 void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
121 void _startTransfer();
122 void _transfer(uint8_t value);
123 void _endTransfer();
124 public:
125 const uint16_t WIDTH, HEIGHT;
126 private:
127 bool _rev_scan;
128 int16_t _cs, _dc;
129 const SPISettings _spi_settings;
130 };
131 ScreenPart M1, S1, M2, S2;
132};
133
134#endif
void refresh(bool partial_update_mode=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 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 power_on_time
static const GxEPD2::Panel panel
static const uint16_t WIDTH_VISIBLE
static const uint16_t full_refresh_time
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 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)
friend class GDEW1248T3_OTP
static const uint16_t power_off_time
GxEPD2_1248c(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2, int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2)
static const bool hasFastPartialUpdate
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)
static const uint16_t partial_refresh_time
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 clearScreen(uint8_t value=0xFF)
static const uint16_t WIDTH
void init(uint32_t serial_diag_bitrate=0)
static const bool hasPartialUpdate
static const uint16_t HEIGHT
void writeScreenBuffer(uint8_t value=0xFF)
static const bool hasColor
Panel
Definition GxEPD2.h:37
@ GDEY1248Z51
Definition GxEPD2.h:98