Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
GxEPD2_GFX.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//
6// Author: Jean-Marc Zingg
7//
8// Version: see library.properties
9//
10// Library: https://github.com/ZinggJM/GxEPD2
11
12#ifndef _GxEPD2_GFX_H_
13#define _GxEPD2_GFX_H_
14
15// uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
16//#include <GFX.h>
17
18#if defined(_GFX_H_)
19#define GxEPD2_GFX_ROOT_CLASS GFX
20#else
21#include <Adafruit_GFX.h>
22#define GxEPD2_GFX_ROOT_CLASS Adafruit_GFX
23#endif
24
25#include "GxEPD2_EPD.h"
26
27class GxEPD2_GFX : public GxEPD2_GFX_ROOT_CLASS
28{
29 public:
30 GxEPD2_GFX(GxEPD2_EPD& _epd2, int16_t w, int16_t h) : GxEPD2_GFX_ROOT_CLASS(w, h), epd2(_epd2) {};
31 virtual uint16_t pages() = 0;
32 virtual uint16_t pageHeight() = 0;
33 virtual bool mirror(bool m) = 0;
34 virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled
35 // init method with additional parameters:
36 // initial false for re-init after processor deep sleep wake up, if display power supply was kept
37 // this can be used to avoid the repeated initial full refresh on displays with fast partial update
38 // NOTE: garbage will result on fast partial update displays, if initial full update is omitted after power loss
39 // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin
40 virtual void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false) = 0;
41 virtual void fillScreen(uint16_t color) = 0; // 0x0 black, >0x0 white, to buffer
42 // display buffer content to screen, useful for full screen buffer
43 virtual void display(bool partial_update_mode = false) = 0;
44 // display part of buffer content to screen, useful for full screen buffer
45 // displayWindow, use parameters according to actual rotation.
46 // x and w should be multiple of 8, for rotation 0 or 2,
47 // y and h should be multiple of 8, for rotation 1 or 3,
48 // else window is increased as needed,
49 // this is an addressing limitation of the e-paper controllers
50 virtual void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
51 virtual void setFullWindow() = 0;
52 // setPartialWindow, use parameters according to actual rotation.
53 // x and w should be multiple of 8, for rotation 0 or 2,
54 // y and h should be multiple of 8, for rotation 1 or 3,
55 // else window is increased as needed,
56 // this is an addressing limitation of the e-paper controllers
57 virtual void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
58 virtual void firstPage() = 0;
59 virtual bool nextPage() = 0;
60 virtual void drawPaged(void (*drawCallback)(const void*), const void* pv) = 0;
61 virtual void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) = 0;
62 // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
63 virtual void clearScreen(uint8_t value = 0xFF) = 0; // init controller memory and screen (default white)
64 virtual void writeScreenBuffer(uint8_t value = 0xFF) = 0; // init controller memory (default white)
65 // write to controller memory, without screen refresh; x and w should be multiple of 8
66 virtual 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) = 0;
67 virtual void writeImagePart(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) = 0;
69 virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
70 virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
71 virtual 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,
72 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
73 virtual 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,
74 int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
75 // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
76 virtual 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) = 0;
77 // write to controller memory, with screen refresh; x and w should be multiple of 8
78 virtual 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) = 0;
79 virtual void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
80 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
81 virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
82 virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
83 virtual 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,
84 int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
85 virtual 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,
86 int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
87 // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
88 virtual 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) = 0;
89 virtual void refresh(bool partial_update_mode = false) = 0; // screen refresh from controller memory to full screen
90 virtual void refresh(int16_t x, int16_t y, int16_t w, int16_t h) = 0; // screen refresh from controller memory, partial screen
91 virtual void powerOff() = 0; // turns off generation of panel driving voltages, avoids screen fading over time
92 virtual void hibernate() = 0; // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
93 public:
95};
96
97#endif
virtual 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)=0
virtual void init(uint32_t serial_diag_bitrate=0)=0
virtual void drawPaged(void(*drawCallback)(const void *), const void *pv)=0
virtual void fillScreen(uint16_t color)=0
virtual 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)=0
virtual void drawImage(const uint8_t *black, const uint8_t *color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)=0
virtual void hibernate()=0
virtual void clearScreen(uint8_t value=0xFF)=0
virtual void firstPage()=0
virtual 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)=0
GxEPD2_EPD & epd2
Definition GxEPD2_GFX.h:94
virtual 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)=0
virtual 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, bool mirror_y, bool pgm)=0
virtual bool nextPage()=0
virtual uint16_t pages()=0
virtual void refresh(int16_t x, int16_t y, int16_t w, int16_t h)=0
virtual 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, bool mirror_y, bool pgm)=0
virtual 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)=0
virtual void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)=0
virtual void writeImage(const uint8_t *black, const uint8_t *color, int16_t x, int16_t y, int16_t w, int16_t h)=0
virtual 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)=0
virtual void writeScreenBuffer(uint8_t value=0xFF)=0
virtual void drawImage(const uint8_t *black, const uint8_t *color, int16_t x, int16_t y, int16_t w, int16_t h)=0
virtual void display(bool partial_update_mode=false)=0
virtual void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration=20, bool pulldown_rst_mode=false)=0
virtual 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)=0
virtual void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)=0
virtual void writeImage(const uint8_t *black, const uint8_t *color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)=0
virtual void powerOff()=0
virtual 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)=0
virtual bool mirror(bool m)=0
GxEPD2_GFX(GxEPD2_EPD &_epd2, int16_t w, int16_t h)
Definition GxEPD2_GFX.h:30
virtual void refresh(bool partial_update_mode=false)=0
virtual void setFullWindow()=0
virtual void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)=0
virtual uint16_t pageHeight()=0