Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_270.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: IL91874 : http://www.e-paper-display.com/download_detail/downloadsId=539.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_270_H_
14#define _GxEPD2_270_H_
15
16#include "../GxEPD2_EPD.h"
17
18class GxEPD2_270 : public GxEPD2_EPD
19{
20 public:
21 // attributes
22 static const uint16_t WIDTH = 176;
23 static const uint16_t HEIGHT = 264;
25 static const bool hasColor = false;
26 static const bool hasPartialUpdate = true;
27 static const bool hasFastPartialUpdate = true;
28 static const uint16_t power_on_time = 100; // ms, e.g. 98877us
29 static const uint16_t power_off_time = 30; // ms, e.g. 28405us
30 static const uint16_t full_refresh_time = 2000; // ms, e.g. 1979027us
31 static const uint16_t partial_refresh_time = 400; // ms, e.g. 363637us
32 // constructor
33 GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
34 // methods (virtual)
35 // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
36 void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
37 void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
38 void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white)
39 // write to controller memory, without screen refresh; x and w should be multiple of 8
40 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);
41 void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
42 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(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);
44 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,
45 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
46 // for differential update: set current and previous buffers equal (for fast partial update to work correctly)
47 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);
48 void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
49 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
50 // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
51 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);
52 // write to controller memory, with screen refresh; x and w should be multiple of 8
53 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);
54 void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
55 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
56 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);
57 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,
58 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
59 // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
60 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);
61 void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
62 void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
63 void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
64 void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
65 private:
66 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);
67 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,
68 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
69 void _setPartialRamArea(uint8_t command, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
70 void _refreshWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
71 void _PowerOn();
72 void _PowerOff();
73 void _InitDisplay();
74 void _Init_Full();
75 void _Init_Part();
76 void _Update_Full();
77 void _Update_Part();
78 private:
79 static const unsigned char lut_20_vcomDC[];
80 static const unsigned char lut_21_ww[];
81 static const unsigned char lut_22_bw[];
82 static const unsigned char lut_23_wb[];
83 static const unsigned char lut_24_bb[];
84 static const unsigned char lut_20_vcomDC_partial[];
85 static const unsigned char lut_21_ww_partial[];
86 static const unsigned char lut_22_bw_partial[];
87 static const unsigned char lut_23_wb_partial[];
88 static const unsigned char lut_24_bb_partial[];
89};
90
91#endif
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 power_on_time
Definition GxEPD2_270.h:28
static const GxEPD2::Panel panel
Definition GxEPD2_270.h:24
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)
void writeScreenBufferAgain(uint8_t value=0xFF)
static const uint16_t partial_refresh_time
Definition GxEPD2_270.h:31
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 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)
static const bool hasColor
Definition GxEPD2_270.h:25
void writeScreenBuffer(uint8_t value=0xFF)
void hibernate()
GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy)
static const uint16_t HEIGHT
Definition GxEPD2_270.h:23
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 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)
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
Definition GxEPD2_270.h:22
static const bool hasFastPartialUpdate
Definition GxEPD2_270.h:27
static const uint16_t power_off_time
Definition GxEPD2_270.h:29
void powerOff()
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 full_refresh_time
Definition GxEPD2_270.h:30
void clearScreen(uint8_t value=0xFF)
static const bool hasPartialUpdate
Definition GxEPD2_270.h:26
Panel
Definition GxEPD2.h:37
@ GDEW027W3
Definition GxEPD2.h:63