Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_420.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// based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
5// Controller: IL0398 : http://www.e-paper-display.com/download_detail/downloadsId=537.html
6//
7// Author: Jean-Marc Zingg
8//
9// Version: see library.properties
10//
11// Library: https://github.com/ZinggJM/GxEPD2
12
13#ifndef _GxEPD2_420_H_
14#define _GxEPD2_420_H_
15
16#include "../GxEPD2_EPD.h"
17
18#define GxEPD_BPP 2
19
20class GxEPD2_420 : public GxEPD2_EPD
21{
22 public:
23 // attributes
24 static const uint16_t WIDTH = 400;
25 static const uint16_t HEIGHT = 300;
27 static const bool hasColor = false;
28 static const bool hasPartialUpdate = true;
29 static const bool usePartialUpdateWindow = false; // set false for better image
30 static const bool hasFastPartialUpdate = true;
31 static const uint16_t power_on_time = 40; // ms, e.g. 36996us
32 static const uint16_t power_off_time = 20; // ms, e.g. 19285us
33 static const uint16_t full_refresh_time = 1600; // ms, e.g. 1545659us
34 static const uint16_t partial_refresh_time = 600; // ms, e.g. 563754us
35 // constructor
36 GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
37 // methods (virtual)
38 // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
39 void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
40 void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
41 // write to controller memory, without screen refresh; x and w should be multiple of 8
42 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);
43 void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
44 void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
45 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
46 void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
47 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
48 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);
49 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,
50 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
51 // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
52 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);
53 // write to controller memory, with screen refresh; x and w should be multiple of 8
54 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);
55 void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
56 void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
57 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
58 void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
59 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
60 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);
61 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,
62 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
63 // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
64 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);
65 void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
66 void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
67 void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
68 void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
69 private:
70 void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
71 void _PowerOn();
72 void _PowerOff();
73 void _InitDisplay();
74 void _Force_Init_Full();
75 void _Init_Full();
76 void _Init_4G();
77 void _Init_Part();
78 void _Update_Full();
79 void _Update_4G();
80 void _Update_Part();
81 private:
82 enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode;
83 static const unsigned char lut_20_vcom0_full[];
84 static const unsigned char lut_21_ww_full[];
85 static const unsigned char lut_22_bw_full[];
86 static const unsigned char lut_23_wb_full[];
87 static const unsigned char lut_24_bb_full[];
88 static const unsigned char lut_20_vcom0_4G[];
89 static const unsigned char lut_21_ww_4G[];
90 static const unsigned char lut_22_bw_4G[];
91 static const unsigned char lut_23_wb_4G[];
92 static const unsigned char lut_24_bb_4G[];
93 static const unsigned char lut_20_vcom0_partial[];
94 static const unsigned char lut_21_ww_partial[];
95 static const unsigned char lut_22_bw_partial[];
96 static const unsigned char lut_23_wb_partial[];
97 static const unsigned char lut_24_bb_partial[];
98};
99
100#endif
static const bool usePartialUpdateWindow
Definition GxEPD2_420.h:29
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)
GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, 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 bool hasColor
Definition GxEPD2_420.h:27
static const GxEPD2::Panel panel
Definition GxEPD2_420.h:26
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 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 writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, 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 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 writeScreenBuffer(uint8_t value=0xFF)
void powerOff()
static const bool hasPartialUpdate
Definition GxEPD2_420.h:28
void clearScreen(uint8_t value=0xFF)
static const uint16_t WIDTH
Definition GxEPD2_420.h:24
static const uint16_t partial_refresh_time
Definition GxEPD2_420.h:34
void refresh(bool partial_update_mode=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)
static const bool hasFastPartialUpdate
Definition GxEPD2_420.h:30
static const uint16_t full_refresh_time
Definition GxEPD2_420.h:33
void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, 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 bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert=false, bool mirror_y=false, bool pgm=false)
void hibernate()
static const uint16_t power_on_time
Definition GxEPD2_420.h:31
void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, 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_off_time
Definition GxEPD2_420.h:32
static const uint16_t HEIGHT
Definition GxEPD2_420.h:25
Panel
Definition GxEPD2.h:37
@ GDEW042T2
Definition GxEPD2.h:67