├── README.md ├── 4.2-inch E-Paper - monocolor 400x300 └── example │ ├── fonts.h │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── GUI_Paint.h │ └── example.ino ├── 7.5-inch E-Paper - monocolor 800x480 └── example │ ├── fonts.h │ ├── font12CN.c │ ├── font24CN.c │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── GUI_Paint.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 5.65-inch E-paper - sevencolor 600x480 ├── export_image.jpg └── example │ └── example.ino ├── .gitignore ├── 1.54-inch E-paper - dotmatix 200x200 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 2.13-inch E-paper - monocolor 122x250 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 2.9 inch E-paper - monocolor 128x296 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 4.26-inch E-Paper - monocolor 480x280 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 5.83-inch E-paper - monocolor 648x480 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── 7.5-inch E-Paper - tri-color 800x480 └── example │ ├── Display_EPD_W21_spi.cpp │ ├── Display_EPD_W21_spi.h │ ├── Display_EPD_W21.h │ ├── example.ino │ └── Display_EPD_W21.cpp ├── LICENSE ├── 2.13-inch E-Paper -Flexible Monochrome 212x104 └── example │ ├── example.ino │ └── demo.h └── 2.9-inch e-paper - quadruple color 128x296 └── example └── example.ino /README.md: -------------------------------------------------------------------------------- 1 | # Seeed_ePaper_driver_board_for_XIAO_V2 -------------------------------------------------------------------------------- /4.2-inch E-Paper - monocolor 400x300/example/fonts.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/Seeed_ePaper-Driver-Board/main/4.2-inch E-Paper - monocolor 400x300/example/fonts.h -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/fonts.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/Seeed_ePaper-Driver-Board/main/7.5-inch E-Paper - monocolor 800x480/example/fonts.h -------------------------------------------------------------------------------- /5.65-inch E-paper - sevencolor 600x480/export_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/Seeed_ePaper-Driver-Board/main/5.65-inch E-paper - sevencolor 600x480/export_image.jpg -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/font12CN.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/Seeed_ePaper-Driver-Board/main/7.5-inch E-Paper - monocolor 800x480/example/font12CN.c -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/font24CN.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Projects/Seeed_ePaper-Driver-Board/main/7.5-inch E-Paper - monocolor 800x480/example/font24CN.c -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | 3 | build 4 | 5 | *.old 6 | *.o 7 | *.s 8 | 9 | .DS_Store 10 | 11 | *.orig 12 | 13 | *.swp 14 | 15 | docs/def/** 16 | docs/html/** 17 | docs/man/man3/_**_.3 18 | 19 | CMakeLists.txt 20 | Makefile 21 | *.mk -------------------------------------------------------------------------------- /1.54-inch E-paper - dotmatix 200x200/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /2.13-inch E-paper - monocolor 122x250/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /2.9 inch E-paper - monocolor 128x296/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /4.2-inch E-Paper - monocolor 400x300/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /4.26-inch E-Paper - monocolor 480x280/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /5.83-inch E-paper - monocolor 648x480/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - tri-color 800x480/example/Display_EPD_W21_spi.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include 3 | 4 | //SPI write byte 5 | void SPI_Write(unsigned char value) 6 | { 7 | SPI.transfer(value); 8 | } 9 | 10 | //SPI write command 11 | void EPD_W21_WriteCMD(unsigned char command) 12 | { 13 | EPD_W21_CS_0; 14 | EPD_W21_DC_0; // D/C# 0:command 1:data 15 | SPI_Write(command); 16 | EPD_W21_CS_1; 17 | } 18 | //SPI write data 19 | void EPD_W21_WriteDATA(unsigned char datas) 20 | { 21 | EPD_W21_CS_0; 22 | EPD_W21_DC_1; // D/C# 0:command 1:data 23 | SPI_Write(datas); 24 | EPD_W21_CS_1; 25 | } 26 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /1.54-inch E-paper - dotmatix 200x200/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /2.13-inch E-paper - monocolor 122x250/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /2.9 inch E-paper - monocolor 128x296/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /4.2-inch E-Paper - monocolor 400x300/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /4.26-inch E-Paper - monocolor 480x280/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /5.83-inch E-paper - monocolor 648x480/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - tri-color 800x480/example/Display_EPD_W21_spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_SPI_ 2 | #define _DISPLAY_EPD_W21_SPI_ 3 | #include "Arduino.h" 4 | 5 | //IO settings 6 | //SCK--GPIO23(SCLK) 7 | //SDIN---GPIO18(MOSI) 8 | #define isEPD_W21_BUSY digitalRead(D2) //BUSY 9 | #define EPD_W21_RST_0 digitalWrite(D0,LOW) //RES 10 | #define EPD_W21_RST_1 digitalWrite(D0,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(D3,LOW) //DC 12 | #define EPD_W21_DC_1 digitalWrite(D3,HIGH) 13 | #define EPD_W21_CS_0 digitalWrite(D1,LOW) //CS 14 | #define EPD_W21_CS_1 digitalWrite(D1,HIGH) 15 | 16 | 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char datas); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Seeed-Projects 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /5.83-inch E-paper - monocolor 648x480/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | 5 | #define EPD_WIDTH 648 6 | #define EPD_HEIGHT 480 7 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 8 | 9 | 10 | //Full screen refresh display 11 | void EPD_Init(void); 12 | void EPD_Init_180(void); 13 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 14 | void EPD_WhiteScreen_White(void); 15 | void EPD_WhiteScreen_Black(void); 16 | void EPD_DeepSleep(void); 17 | //Partial refresh display 18 | void EPD_Init_Part(void); 19 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 20 | void EPD_Dis_PartAll(const unsigned char * datas); 21 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 22 | void EPD_Dis_Part_Time(unsigned int x_start,unsigned int y_start, 23 | const unsigned char * datas_A,const unsigned char * datas_B, 24 | const unsigned char * datas_C,const unsigned char * datas_D,const unsigned char * datas_E, 25 | unsigned char num,unsigned int PART_COLUMN,unsigned int PART_LINE); 26 | //Fast refresh display 27 | void EPD_Init_Fast(void); 28 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - tri-color 800x480/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | 5 | #define EPD_WIDTH 800 6 | #define EPD_HEIGHT 480 7 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 8 | 9 | 10 | //Full screen refresh display 11 | void EPD_Init(void); 12 | void EPD_Init_180(void); 13 | void EPD_WhiteScreen_ALL(const unsigned char* datasBW,const unsigned char* datasRW); 14 | void EPD_WhiteScreen_White(void); 15 | void EPD_WhiteScreen_Black(void); 16 | void EPD_DeepSleep(void); 17 | //Partial refresh display 18 | void EPD_Init_Part(void); 19 | void EPD_SetRAMValue_BaseMap(const unsigned char* datasBW,const unsigned char* datasRW); 20 | void EPD_Dis_PartAll(const unsigned char * datas); 21 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 22 | void EPD_Dis_Part_Time(unsigned int x_start,unsigned int y_start, 23 | const unsigned char * datas_A,const unsigned char * datas_B, 24 | const unsigned char * datas_C,const unsigned char * datas_D,const unsigned char * datas_E, 25 | unsigned char num,unsigned int PART_COLUMN,unsigned int PART_LINE); 26 | //Fast refresh display 27 | void EPD_Init_Fast(void); 28 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 29 | 30 | 31 | #endif 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | #define EPD_WIDTH 800 5 | #define EPD_HEIGHT 480 6 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 7 | 8 | //Full screen refresh display 9 | void EPD_Init(void); 10 | void EPD_Init_180(void); 11 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 12 | void EPD_WhiteScreen_White(void); 13 | void EPD_WhiteScreen_Black(void); 14 | void EPD_DeepSleep(void); 15 | //Partial refresh display 16 | void EPD_Init_Part(void); 17 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 18 | void EPD_WhiteScreen_White_Basemap(void); 19 | void EPD_Dis_PartAll(const unsigned char * datas); 20 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 21 | void EPD_Dis_Part_Time(unsigned int x_start,unsigned int y_start, 22 | const unsigned char * datas_A,const unsigned char * datas_B, 23 | const unsigned char * datas_C,const unsigned char * datas_D,const unsigned char * datas_E, 24 | unsigned char num,unsigned int PART_COLUMN,unsigned int PART_LINE); 25 | //Fast refresh display 26 | void EPD_Init_Fast(void); 27 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 28 | void EPD_Display(unsigned char *Image); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /4.26-inch E-Paper - monocolor 480x280/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | #define EPD_WIDTH 480 5 | #define EPD_HEIGHT 800 6 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 7 | 8 | //Full screen refresh display 9 | void EPD_HW_Init(void); 10 | void EPD_HW_Init_180(void); 11 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 12 | void EPD_WhiteScreen_White(void); 13 | void EPD_WhiteScreen_Black(void); 14 | void EPD_DeepSleep(void); 15 | //Partial refresh display 16 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 17 | void EPD_Dis_PartAll(const unsigned char * datas); 18 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 19 | void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA, 20 | unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB, 21 | unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC, 22 | unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD, 23 | unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE, 24 | unsigned int PART_COLUMN,unsigned int PART_LINE 25 | ); 26 | //Fast refresh display 27 | void EPD_HW_Init_Fast(void); 28 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /1.54-inch E-paper - dotmatix 200x200/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | 5 | #define EPD_WIDTH 200 6 | #define EPD_HEIGHT 200 7 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 8 | 9 | 10 | //Full screen refresh display 11 | void EPD_HW_Init(void); 12 | void EPD_HW_Init_180(void); 13 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 14 | void EPD_WhiteScreen_White(void); 15 | void EPD_WhiteScreen_Black(void); 16 | void EPD_DeepSleep(void); 17 | //Partial refresh display 18 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 19 | void EPD_Dis_PartAll(const unsigned char * datas); 20 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 21 | void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA, 22 | unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB, 23 | unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC, 24 | unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD, 25 | unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE, 26 | unsigned int PART_COLUMN,unsigned int PART_LINE 27 | ); 28 | //Fast refresh display 29 | void EPD_HW_Init_Fast(void); 30 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 31 | void EPD_HW_Init_Fast2(void); 32 | void EPD_WhiteScreen_ALL_Fast2(const unsigned char *datas); 33 | 34 | 35 | #endif 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /4.2-inch E-Paper - monocolor 400x300/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | #define EPD_WIDTH 400 5 | #define EPD_HEIGHT 300 6 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 7 | 8 | //Full screen refresh display 9 | void EPD_HW_Init(void); 10 | void EPD_HW_Init_180(void); 11 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 12 | void EPD_WhiteScreen_White(void); 13 | void EPD_WhiteScreen_Black(void); 14 | void EPD_DeepSleep(void); 15 | //Partial refresh display 16 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 17 | void EPD_Dis_PartAll(const unsigned char * datas); 18 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 19 | void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA, 20 | unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB, 21 | unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC, 22 | unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD, 23 | unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE, 24 | unsigned int PART_COLUMN,unsigned int PART_LINE 25 | ); 26 | //Fast refresh display 27 | void EPD_HW_Init_Fast(void); 28 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 29 | void EPD_HW_Init_Fast2(void); 30 | void EPD_HW_Init_GUI(void); 31 | void EPD_Display(unsigned char *Image); 32 | #endif 33 | -------------------------------------------------------------------------------- /2.13-inch E-paper - monocolor 122x250/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | 5 | #define EPD_WIDTH 128 6 | #define EPD_HEIGHT 250 7 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 8 | 9 | 10 | //Full screen refresh display 11 | void EPD_HW_Init(void); 12 | void EPD_HW_Init_180(void); 13 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 14 | void EPD_WhiteScreen_White(void); 15 | void EPD_WhiteScreen_Black(void); 16 | void EPD_DeepSleep(void); 17 | //Partial refresh display 18 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 19 | void EPD_Dis_PartAll(const unsigned char * datas); 20 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 21 | void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA, 22 | unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB, 23 | unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC, 24 | unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD, 25 | unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE, 26 | unsigned int PART_COLUMN,unsigned int PART_LINE 27 | ); 28 | //Fast refresh display 29 | void EPD_HW_Init_Fast(void); 30 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 31 | void EPD_HW_Init_Fast2(void); 32 | void EPD_WhiteScreen_ALL_Fast2(const unsigned char *datas); 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /2.9 inch E-paper - monocolor 128x296/example/Display_EPD_W21.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_EPD_W21_H_ 2 | #define _DISPLAY_EPD_W21_H_ 3 | 4 | 5 | #define EPD_WIDTH 128 6 | #define EPD_HEIGHT 296 7 | #define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8 8 | 9 | 10 | //Full screen refresh display 11 | void EPD_HW_Init(void); 12 | void EPD_HW_Init_180(void); 13 | void EPD_WhiteScreen_ALL(const unsigned char *datas); 14 | void EPD_WhiteScreen_White(void); 15 | void EPD_WhiteScreen_Black(void); 16 | void EPD_DeepSleep(void); 17 | //Partial refresh display 18 | void EPD_SetRAMValue_BaseMap(const unsigned char * datas); 19 | void EPD_Dis_PartAll(const unsigned char * datas); 20 | void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE); 21 | void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA, 22 | unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB, 23 | unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC, 24 | unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD, 25 | unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE, 26 | unsigned int PART_COLUMN,unsigned int PART_LINE 27 | ); 28 | //Fast refresh display 29 | void EPD_HW_Init_Fast(void); 30 | void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas); 31 | void EPD_HW_Init_Fast2(void); 32 | void EPD_WhiteScreen_ALL_Fast2(const unsigned char *datas); 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /1.54-inch E-paper - dotmatix 200x200/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "154test.h" 6 | #include "Ap_29demo.h" 7 | 8 | void setup() { 9 | pinMode(D2, INPUT); //BUSY 10 | pinMode(D0, OUTPUT); //RES 11 | pinMode(D3, OUTPUT); //DC 12 | pinMode(D1, OUTPUT); //CS 13 | //SPI 14 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 15 | SPI.begin (); 16 | } 17 | 18 | //Tips// 19 | /* 20 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 21 | 2.There will be no flicker when EPD performs a partial refresh. 22 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 23 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 24 | 5.Re-initialization is required for every full screen update. 25 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 26 | */ 27 | void loop() { 28 | 29 | EPD_HW_Init(); //Full screen refresh initialization. 30 | EPD_WhiteScreen_White(); //Clear screen function. 31 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 32 | delay(2000); //Delay for 2s. 33 | /************Full display(2s)*******************/ 34 | EPD_HW_Init(); //Full screen refresh initialization. 35 | EPD_WhiteScreen_ALL(gImage_154test); //To Display one image using full screen refresh. 36 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 37 | delay(2000); //Delay for 2s. 38 | } 39 | 40 | 41 | 42 | 43 | //////////////////////////////////END////////////////////////////////////////////////// 44 | -------------------------------------------------------------------------------- /2.13-inch E-paper - monocolor 122x250/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "demo.h" 6 | 7 | void setup() { 8 | pinMode(D2, INPUT); //BUSY 9 | pinMode(D0, OUTPUT); //RES 10 | pinMode(D3, OUTPUT); //DC 11 | pinMode(D1, OUTPUT); //CS 12 | //SPI 13 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 14 | SPI.begin(); 15 | } 16 | 17 | //Tips// 18 | /* 19 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 20 | 2.There will be no flicker when EPD performs a partial refresh. 21 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 22 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 23 | 5.Re-initialization is required for every full screen update. 24 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 25 | */ 26 | void loop() { 27 | 28 | EPD_HW_Init(); //Full screen refresh initialization. 29 | EPD_WhiteScreen_White(); //Clear screen function. 30 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 31 | delay(2000); //Delay for 2s. 32 | /************Full display(2s)*******************/ 33 | EPD_HW_Init(); //Full screen refresh initialization. 34 | EPD_WhiteScreen_ALL(gImage_demo); //To Display one image using full screen refresh. 35 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 36 | delay(2000); 37 | ; //Delay for 2s. 38 | 39 | delay(300000); // The program stops here 40 | } 41 | 42 | 43 | 44 | 45 | //////////////////////////////////END////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - tri-color 800x480/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "Ap_29demo.h" 6 | 7 | void setup() { 8 | pinMode(D2, INPUT); //BUSY 9 | pinMode(D0, OUTPUT); //RES 10 | pinMode(D3, OUTPUT); //DC 11 | pinMode(D1, OUTPUT); //CS 12 | //SPI 13 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 14 | SPI.begin (); 15 | } 16 | 17 | //Tips// 18 | /* 19 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 20 | 2.There will be no flicker when EPD performs a partial refresh. 21 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 22 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 23 | 5.Re-initialization is required for every full screen update. 24 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 25 | */ 26 | void loop() { 27 | unsigned char i; 28 | #if 1 //Full screen refresh, fast refresh, and partial refresh demostration. 29 | EPD_Init(); //Full screen refresh initialization. 30 | EPD_WhiteScreen_ALL(gImage_BW1,gImage_RW1); //To Display one image using full screen refresh. 31 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 32 | delay(3000); //Delay for 3s. 33 | 34 | /************Fast refresh mode(16s)*******************/ 35 | #if 1 //Fast refresh demostration. 36 | EPD_Init_Fast(); //Fast refresh initialization. 37 | EPD_WhiteScreen_ALL(gImage_BW1,gImage_RW1); //To Display one image using full screen refresh. 38 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 39 | delay(3000); //Delay for 3s. 40 | #endif 41 | #if 1 //Partial refresh demostration. 42 | //Partial refresh demo support displaying a clock at 5 locations with 00:00. 43 | //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 44 | //////////////////////Partial refresh time demo///////////////////////////////////// 45 | EPD_Init(); //Electronic paper initialization. 46 | EPD_SetRAMValue_BaseMap(gImage_BW1,gImage_RW1); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 47 | EPD_Init_Part(); //Pa refresh initialization. 48 | for(i=0;i<6;i++) 49 | { 50 | EPD_Dis_Part_Time(376,24,Num[1],Num[0],gImage_numdot,Num[0],Num[i],5,104,48); //x,y,DATA-A~E,Resolution 48*104 51 | } 52 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 53 | delay(2000); //Delay for 2s. 54 | EPD_Init(); //Full screen refresh initialization. 55 | EPD_WhiteScreen_White(); //Clear screen function. 56 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 57 | delay(2000); //Delay for 2s. 58 | #endif 59 | 60 | #if 0 //Demonstration of full screen refresh with 180-degree rotation, to enable this feature, please change 0 to 1. 61 | /************Full display(2s)*******************/ 62 | EPD_Init_180(); //Full screen refresh initialization. 63 | EPD_WhiteScreen_ALL(gImage_BW1,gImage_RW1); //To Display one image using full screen refresh. 64 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 65 | delay(3000); //Delay for 3s. 66 | #endif 67 | 68 | #endif 69 | while(1); // The program stops here 70 | } 71 | 72 | 73 | 74 | 75 | //////////////////////////////////END////////////////////////////////////////////////// 76 | -------------------------------------------------------------------------------- /4.2-inch E-Paper - monocolor 400x300/example/GUI_Paint.h: -------------------------------------------------------------------------------- 1 | #ifndef __GUI_PAINT_H 2 | #define __GUI_PAINT_H 3 | 4 | #include "fonts.h" 5 | #include 6 | /** 7 | * Image attributes 8 | **/ 9 | 10 | #ifdef __cplusplus 11 | 12 | extern "C" { 13 | 14 | #endif 15 | 16 | #define UBYTE uint8_t 17 | #define UWORD uint16_t 18 | #define UDOUBLE uint32_t 19 | 20 | typedef struct { 21 | UBYTE *Image; 22 | UWORD Width; 23 | UWORD Height; 24 | UWORD WidthMemory; 25 | UWORD HeightMemory; 26 | UWORD Color; 27 | UWORD Rotate; 28 | UWORD Mirror; 29 | UWORD WidthByte; 30 | UWORD HeightByte; 31 | } PAINT; 32 | extern PAINT Paint; 33 | 34 | /** 35 | * Display rotate 36 | **/ 37 | #define ROTATE_0 0 38 | #define ROTATE_90 90 39 | #define ROTATE_180 180 40 | #define ROTATE_270 270 41 | 42 | /** 43 | * Display Flip 44 | **/ 45 | typedef enum { 46 | MIRROR_NONE = 0x00, 47 | MIRROR_HORIZONTAL = 0x01, 48 | MIRROR_VERTICAL = 0x02, 49 | MIRROR_ORIGIN = 0x03, 50 | } MIRROR_IMAGE; 51 | #define MIRROR_IMAGE_DFT MIRROR_NONE 52 | 53 | /** 54 | * image color 55 | **/ 56 | #define WHITE 0xFF 57 | #define BLACK 0x00 58 | #define RED BLACK 59 | 60 | #define IMAGE_BACKGROUND WHITE 61 | #define FONT_FOREGROUND BLACK 62 | #define FONT_BACKGROUND WHITE 63 | 64 | /** 65 | * The size of the point 66 | **/ 67 | typedef enum { 68 | DOT_PIXEL_1X1 = 1, // 1 x 1 69 | DOT_PIXEL_2X2 , // 2 X 2 70 | DOT_PIXEL_3X3 , // 3 X 3 71 | DOT_PIXEL_4X4 , // 4 X 4 72 | DOT_PIXEL_5X5 , // 5 X 5 73 | DOT_PIXEL_6X6 , // 6 X 6 74 | DOT_PIXEL_7X7 , // 7 X 7 75 | DOT_PIXEL_8X8 , // 8 X 8 76 | } DOT_PIXEL; 77 | #define DOT_PIXEL_DFT DOT_PIXEL_1X1 //Default dot pilex 78 | 79 | /** 80 | * Point size fill style 81 | **/ 82 | typedef enum { 83 | DOT_FILL_AROUND = 1, // dot pixel 1 x 1 84 | DOT_FILL_RIGHTUP , // dot pixel 2 X 2 85 | } DOT_STYLE; 86 | #define DOT_STYLE_DFT DOT_FILL_AROUND //Default dot pilex 87 | 88 | /** 89 | * Line style, solid or dashed 90 | **/ 91 | typedef enum { 92 | LINE_STYLE_SOLID = 0, 93 | LINE_STYLE_DOTTED, 94 | } LINE_STYLE; 95 | 96 | /** 97 | * Whether the graphic is filled 98 | **/ 99 | typedef enum { 100 | DRAW_FILL_EMPTY = 0, 101 | DRAW_FILL_FULL, 102 | } DRAW_FILL; 103 | 104 | /** 105 | * Custom structure of a time attribute 106 | **/ 107 | typedef struct { 108 | UWORD Year; //0000 109 | UBYTE Month; //1 - 12 110 | UBYTE Day; //1 - 30 111 | UBYTE Hour; //0 - 23 112 | UBYTE Min; //0 - 59 113 | UBYTE Sec; //0 - 59 114 | } PAINT_TIME; 115 | extern PAINT_TIME sPaint_time; 116 | 117 | //init and Clear 118 | void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color); 119 | void Paint_SelectImage(UBYTE *image); 120 | void Paint_SetRotate(UWORD Rotate); 121 | void Paint_SetMirroring(UBYTE mirror); 122 | void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color); 123 | 124 | void Paint_Clear(UWORD Color); 125 | void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color); 126 | 127 | //Drawing 128 | void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay); 129 | void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel); 130 | void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DRAW_FILL Filled , DOT_PIXEL Dot_Pixel); 131 | void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DRAW_FILL Draw_Fill , DOT_PIXEL Dot_Pixel); 132 | 133 | //Display string 134 | void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 135 | void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 136 | void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Background, UWORD Color_Foreground); 137 | void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 138 | void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 139 | 140 | //pic 141 | void Paint_DrawBitMap(const unsigned char* image_buffer); 142 | 143 | #ifdef __cplusplus 144 | 145 | } 146 | 147 | #endif 148 | #endif 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/GUI_Paint.h: -------------------------------------------------------------------------------- 1 | #ifndef __GUI_PAINT_H 2 | #define __GUI_PAINT_H 3 | 4 | #include "fonts.h" 5 | #include 6 | /** 7 | * Image attributes 8 | **/ 9 | #ifdef __cplusplus 10 | 11 | extern "C" { 12 | 13 | #endif 14 | 15 | 16 | #define UBYTE uint8_t 17 | #define UWORD uint16_t 18 | #define UDOUBLE uint32_t 19 | 20 | typedef struct { 21 | UBYTE *Image; 22 | UWORD Width; 23 | UWORD Height; 24 | UWORD WidthMemory; 25 | UWORD HeightMemory; 26 | UWORD Color; 27 | UWORD Rotate; 28 | UWORD Mirror; 29 | UWORD WidthByte; 30 | UWORD HeightByte; 31 | } PAINT; 32 | extern PAINT Paint; 33 | 34 | /** 35 | * Display rotate 36 | **/ 37 | #define ROTATE_0 0 38 | #define ROTATE_90 90 39 | #define ROTATE_180 180 40 | #define ROTATE_270 270 41 | 42 | /** 43 | * Display Flip 44 | **/ 45 | typedef enum { 46 | MIRROR_NONE = 0x00, 47 | MIRROR_HORIZONTAL = 0x01, 48 | MIRROR_VERTICAL = 0x02, 49 | MIRROR_ORIGIN = 0x03, 50 | } MIRROR_IMAGE; 51 | #define MIRROR_IMAGE_DFT MIRROR_NONE 52 | 53 | /** 54 | * image color 55 | **/ 56 | #define WHITE 0xFF 57 | #define BLACK 0x00 58 | #define RED BLACK 59 | 60 | #define IMAGE_BACKGROUND WHITE 61 | #define FONT_FOREGROUND BLACK 62 | #define FONT_BACKGROUND WHITE 63 | 64 | /** 65 | * The size of the point 66 | **/ 67 | typedef enum { 68 | DOT_PIXEL_1X1 = 1, // 1 x 1 69 | DOT_PIXEL_2X2 , // 2 X 2 70 | DOT_PIXEL_3X3 , // 3 X 3 71 | DOT_PIXEL_4X4 , // 4 X 4 72 | DOT_PIXEL_5X5 , // 5 X 5 73 | DOT_PIXEL_6X6 , // 6 X 6 74 | DOT_PIXEL_7X7 , // 7 X 7 75 | DOT_PIXEL_8X8 , // 8 X 8 76 | } DOT_PIXEL; 77 | #define DOT_PIXEL_DFT DOT_PIXEL_1X1 //Default dot pilex 78 | 79 | /** 80 | * Point size fill style 81 | **/ 82 | typedef enum { 83 | DOT_FILL_AROUND = 1, // dot pixel 1 x 1 84 | DOT_FILL_RIGHTUP , // dot pixel 2 X 2 85 | } DOT_STYLE; 86 | #define DOT_STYLE_DFT DOT_FILL_AROUND //Default dot pilex 87 | 88 | /** 89 | * Line style, solid or dashed 90 | **/ 91 | typedef enum { 92 | LINE_STYLE_SOLID = 0, 93 | LINE_STYLE_DOTTED, 94 | } LINE_STYLE; 95 | 96 | /** 97 | * Whether the graphic is filled 98 | **/ 99 | typedef enum { 100 | DRAW_FILL_EMPTY = 0, 101 | DRAW_FILL_FULL, 102 | } DRAW_FILL; 103 | 104 | /** 105 | * Custom structure of a time attribute 106 | **/ 107 | typedef struct { 108 | UWORD Year; //0000 109 | UBYTE Month; //1 - 12 110 | UBYTE Day; //1 - 30 111 | UBYTE Hour; //0 - 23 112 | UBYTE Min; //0 - 59 113 | UBYTE Sec; //0 - 59 114 | } PAINT_TIME; 115 | extern PAINT_TIME sPaint_time; 116 | 117 | //init and Clear 118 | void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color); 119 | void Paint_SelectImage(UBYTE *image); 120 | void Paint_SetRotate(UWORD Rotate); 121 | void Paint_SetMirroring(UBYTE mirror); 122 | void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color); 123 | 124 | void Paint_Clear(UWORD Color); 125 | void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color); 126 | 127 | //Drawing 128 | void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay); 129 | void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel); 130 | void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DRAW_FILL Filled , DOT_PIXEL Dot_Pixel); 131 | void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DRAW_FILL Draw_Fill , DOT_PIXEL Dot_Pixel); 132 | 133 | //Display string 134 | void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 135 | void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 136 | void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Background, UWORD Color_Foreground); 137 | void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 138 | void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground); 139 | 140 | //print chinese 141 | // void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Background, UWORD Color_Foreground); 142 | 143 | //pic 144 | void Paint_DrawBitMap(const unsigned char* image_buffer); 145 | #ifdef __cplusplus 146 | 147 | } 148 | 149 | #endif 150 | 151 | #endif 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /4.26-inch E-Paper - monocolor 480x280/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "Ap_29demo.h" 6 | 7 | void setup() { 8 | pinMode(D2, INPUT); //BUSY 9 | pinMode(D0, OUTPUT); //RES 10 | pinMode(D3, OUTPUT); //DC 11 | pinMode(D1, OUTPUT); //CS 12 | //SPI 13 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 14 | SPI.begin (); 15 | } 16 | 17 | //Tips// 18 | /* 19 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 20 | 2.There will be no flicker when EPD performs a partial refresh. 21 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 22 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 23 | 5.Re-initialization is required for every full screen update. 24 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 25 | */ 26 | void loop() { 27 | unsigned char i; 28 | 29 | #if 1 //Full screen refresh, fast refresh, and partial refresh demostration. 30 | EPD_HW_Init(); //Full screen refresh initialization. 31 | EPD_WhiteScreen_White(); //Clear screen function. 32 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 33 | delay(2000); //Delay for 2s. 34 | /************Full display(2s)*******************/ 35 | EPD_HW_Init(); //Full screen refresh initialization. 36 | EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen refresh. 37 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 38 | delay(2000); //Delay for 2s. 39 | 40 | /************Fast refresh mode(1.5s)*******************/ 41 | EPD_HW_Init_Fast(); //Fast refresh initialization. 42 | EPD_WhiteScreen_ALL_Fast(gImage_2); //To display one image using fast refresh. 43 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 44 | delay(2000); //Delay for 2s. 45 | 46 | #if 1 //Partial refresh demostration. 47 | //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. 48 | //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 49 | //////////////////////Partial refresh time demo///////////////////////////////////// 50 | EPD_HW_Init(); //Electronic paper initialization. 51 | EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 52 | for(i=0;i<6;i++) 53 | EPD_Dis_Part_Time(320,124+48*0, Num[1], //x-A,y-A,DATA-A 54 | 320,124+48*1, Num[0], //x-B,y-B,DATA-B 55 | 320,124+48*2, gImage_numdot, //x-C,y-C,DATA-C 56 | 320,124+48*3, Num[0], //x-D,y-D,DATA-D 57 | 320,124+48*4,Num[i],48,104); //x-E,y-E,DATA-E,Resolution 32*64 58 | 59 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 60 | delay(2000); //Delay for 2s. 61 | EPD_HW_Init(); //Full screen refresh initialization. 62 | EPD_WhiteScreen_White(); //Clear screen function. 63 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 64 | delay(2000); //Delay for 2s. 65 | #endif 66 | 67 | #if 0 //Demo of using partial refresh to update the full screen, to enable this feature, please change 0 to 1. 68 | //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 69 | //////////////////////Partial refresh time demo///////////////////////////////////// 70 | EPD_HW_Init(); //E-paper initialization 71 | EPD_SetRAMValue_BaseMap(gImage_p1); //Please do not delete the background color function, otherwise it will cause an unstable display during partial refresh. 72 | EPD_Dis_PartAll(gImage_p1); //Image 1 73 | EPD_Dis_PartAll(gImage_p2); //Image 2 74 | EPD_Dis_PartAll(gImage_p3); //Image 3 75 | EPD_DeepSleep();//Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 76 | delay(2000); //Delay for 2s. 77 | EPD_HW_Init(); //Full screen refresh initialization. 78 | EPD_WhiteScreen_White(); //Clear screen function. 79 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 80 | delay(2000); //Delay for 2s. 81 | #endif 82 | 83 | 84 | #if 0 //Demonstration of full screen refresh with 180-degree rotation, to enable this feature, please change 0 to 1. 85 | /************Full display(2s)*******************/ 86 | EPD_HW_Init_180(); //Full screen refresh initialization. 87 | EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen refresh. 88 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 89 | delay(2000); //Delay for 2s. 90 | #endif 91 | 92 | #endif 93 | while(1); // The program stops here 94 | } 95 | 96 | 97 | 98 | 99 | //////////////////////////////////END////////////////////////////////////////////////// 100 | -------------------------------------------------------------------------------- /5.83-inch E-paper - monocolor 648x480/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "demo.h" 6 | 7 | void setup() { 8 | pinMode(D2, INPUT); //BUSY 9 | pinMode(D0, OUTPUT); //RES 10 | pinMode(D3, OUTPUT); //DC 11 | pinMode(D1, OUTPUT); //CS 12 | //SPI 13 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 14 | SPI.begin (); 15 | } 16 | 17 | //Tips// 18 | /* 19 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 20 | 2.There will be no flicker when EPD performs a partial refresh. 21 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 22 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 23 | 5.Re-initialization is required for every full screen update. 24 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 25 | */ 26 | void loop() { 27 | // unsigned char i; 28 | // #if 1 //Full screen refresh, fast refresh, and partial refresh demostration. 29 | 30 | EPD_Init(); //Full screen refresh initialization. 31 | EPD_WhiteScreen_White(); //Clear screen function. 32 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 33 | delay(2000); //Delay for 2s. 34 | // // /************Full display(2s)*******************/ 35 | // EPD_Init(); //Full screen refresh initialization. 36 | // EPD_WhiteScreen_ALL(gImage_demo); //To Display one image using full screen refresh. 37 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 38 | // delay(2000); //Delay for 2s. 39 | 40 | // // /************Fast refresh mode(1.5s)*******************/ 41 | // EPD_Init_Fast(); //Fast refresh initialization. 42 | // EPD_WhiteScreen_ALL_Fast(gImage_demo); //To display one image using fast refresh. 43 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 44 | // delay(2000); //Delay for 2s. 45 | 46 | // #if 1 //Partial refresh demostration. 47 | // //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. 48 | // //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 49 | // //////////////////////Partial refresh time demo///////////////////////////////////// 50 | // EPD_Init(); //Electronic paper initialization. 51 | // EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 52 | // EPD_Init_Part(); //Pa refresh initialization. 53 | // for(i=0;i<6;i++) 54 | // { 55 | // EPD_Dis_Part_Time(200,180,Num[1],Num[0],gImage_numdot,Num[0],Num[i],5,104,48); //x,y,DATA-A~E,Resolution 48*104 56 | // } 57 | 58 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 59 | // delay(2000); //Delay for 2s. 60 | // EPD_Init(); //Full screen refresh initialization. 61 | // EPD_WhiteScreen_White(); //Clear screen function. 62 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 63 | // delay(2000); //Delay for 2s. 64 | // #endif 65 | 66 | // #if 0 //Demo of using partial refresh to update the full screen, to enable this feature, please change 0 to 1. 67 | // //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 68 | // //////////////////////Partial refresh time demo///////////////////////////////////// 69 | // EPD_Init(); //Full screen refresh initialization. 70 | // EPD_WhiteScreen_White(); //Clear screen function. 71 | // EPD_Init_Part(); 72 | // EPD_Dis_PartAll(gImage_demo); 73 | // EPD_Dis_PartAll(gImage_demo); 74 | 75 | // EPD_DeepSleep();//Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 76 | // delay(2000); //Delay for 2s. 77 | 78 | // EPD_Init(); //Full screen refresh initialization. 79 | // EPD_WhiteScreen_White(); //Clear screen function. 80 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 81 | // delay(2000); //Delay for 2s. 82 | // #endif 83 | 84 | // #if 0 //Demonstration of full screen refresh with 180-degree rotation, to enable this feature, please change 0 to 1. 85 | /************Full display(2s)*******************/ 86 | EPD_Init(); //Full screen refresh initialization. 87 | EPD_WhiteScreen_ALL(gImage_demo); //To Display one image using full screen refresh. 88 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 89 | delay(2000); //Delay for 2s. 90 | // #endif 91 | 92 | // #endif 93 | 94 | delay(300000); // The program stops here 95 | } 96 | 97 | 98 | 99 | 100 | //////////////////////////////////END////////////////////////////////////////////////// 101 | -------------------------------------------------------------------------------- /2.13-inch E-Paper -Flexible Monochrome 212x104/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include"demo.h" 3 | //IO settings 4 | int BUSY_Pin = D2; 5 | int RES_Pin = D0; 6 | int DC_Pin = D3; 7 | int CS_Pin = D1; 8 | 9 | #define EPD_W21_CS_0 digitalWrite(CS_Pin,LOW) 10 | #define EPD_W21_CS_1 digitalWrite(CS_Pin,HIGH) 11 | #define EPD_W21_DC_0 digitalWrite(DC_Pin,LOW) 12 | #define EPD_W21_DC_1 digitalWrite(DC_Pin,HIGH) 13 | #define EPD_W21_RST_0 digitalWrite(RES_Pin,LOW) 14 | #define EPD_W21_RST_1 digitalWrite(RES_Pin,HIGH) 15 | #define isEPD_W21_BUSY digitalRead(BUSY_Pin) 16 | ////////FUNCTION////// 17 | void SPI_Write(unsigned char value); 18 | void EPD_W21_WriteDATA(unsigned char command); 19 | void EPD_W21_WriteCMD(unsigned char command); 20 | //EPD 21 | void EPD_W21_Init(void); 22 | void EPD_init(void); 23 | void EPD_sleep(void); 24 | void EPD_refresh(void); 25 | void lcd_chkstatus(void); 26 | void PIC_display_Clean(void); 27 | void PIC_display(const unsigned char* picData); 28 | void setup() { 29 | pinMode(BUSY_Pin, INPUT); 30 | pinMode(RES_Pin, OUTPUT); 31 | pinMode(DC_Pin, OUTPUT); 32 | pinMode(CS_Pin, OUTPUT); 33 | //SPI 34 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 35 | SPI.begin (); 36 | } 37 | //Tips// 38 | /*When the electronic paper is refreshed in full screen, the picture flicker is a normal phenomenon, and the main function is to clear the display afterimage in the previous picture. 39 | When the local refresh is performed, the screen does not flash.*/ 40 | /*When you need to transplant the driver, you only need to change the corresponding IO. The BUSY pin is the input mode and the others are the output mode. */ 41 | 42 | void loop() { 43 | EPD_init(); //EPD init 44 | PIC_display(gImage_1);//EPD_picture1 45 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 46 | delay(2000); //2s 47 | 48 | // //PICTURE2 49 | // EPD_init(); //EPD init 50 | // PIC_display(gImage_2);//EPD_picture1 51 | // EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 52 | // delay(1000); //2s 53 | 54 | // //PICTURE Clean 55 | // EPD_init(); //EPD init 56 | // PIC_display_Clean(); 57 | // EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 58 | 59 | delay(300000); // The program stops here 60 | 61 | 62 | 63 | 64 | } 65 | 66 | //////////////////////SPI/////////////////////////////////// 67 | 68 | void SPI_Write(unsigned char value) 69 | { 70 | SPI.transfer(value); 71 | 72 | } 73 | 74 | void EPD_W21_WriteCMD(unsigned char command) 75 | { 76 | EPD_W21_CS_0; 77 | EPD_W21_DC_0; // command write 78 | SPI_Write(command); 79 | EPD_W21_CS_1; 80 | } 81 | void EPD_W21_WriteDATA(unsigned char command) 82 | { 83 | EPD_W21_CS_0; 84 | EPD_W21_DC_1; // command write 85 | SPI_Write(command); 86 | EPD_W21_CS_1; 87 | } 88 | 89 | 90 | /////////////////EPD settings Functions///////////////////// 91 | void EPD_W21_Init(void) 92 | { 93 | unsigned char i; 94 | for(i=0;i<3;i++) //Reset, three times to prevent the secondary electricity cannot be started 95 | { 96 | EPD_W21_RST_0; // Module reset 97 | delay(10);//At least 10ms delay 98 | EPD_W21_RST_1; 99 | delay(10);//At least 10ms delay 100 | } 101 | } 102 | void EPD_init(void) 103 | { 104 | EPD_W21_Init(); //Electronic paper IC reset 105 | 106 | EPD_W21_WriteCMD(0x04); 107 | lcd_chkstatus();//waiting for the electronic paper IC to release the idle signal 108 | 109 | EPD_W21_WriteCMD(0x00); //panel setting 110 | EPD_W21_WriteDATA(0x1f); //LUT from OTP£¬KW-BF KWR-AF BWROTP 0f BWOTP 1f 111 | 112 | EPD_W21_WriteCMD(0x61); //resolution setting 113 | EPD_W21_WriteDATA (0x68); //104 114 | EPD_W21_WriteDATA (0x00); //212 115 | EPD_W21_WriteDATA (0xd4); 116 | 117 | EPD_W21_WriteCMD(0X50); //VCOM AND DATA INTERVAL SETTING 118 | EPD_W21_WriteDATA(0x97); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7 119 | } 120 | void EPD_refresh(void) 121 | { 122 | EPD_W21_WriteCMD(0x12); //DISPLAY REFRESH 123 | delay(10); //!!!The delay here is necessary, 200uS at least!!! 124 | lcd_chkstatus(); 125 | } 126 | void EPD_sleep(void) 127 | { 128 | EPD_W21_WriteCMD(0X02); //power off 129 | lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal 130 | //Part2 Increase the time delay 131 | delay(1000); //Power off time delay, this is necessary!!! 132 | EPD_W21_WriteCMD(0X07); //deep sleep 133 | EPD_W21_WriteDATA(0xA5); 134 | } 135 | 136 | void PIC_display(const unsigned char* picData) 137 | { 138 | unsigned int i; 139 | EPD_W21_WriteCMD(0x10); //Transfer old data 140 | for(i=0;i<2756;i++) 141 | EPD_W21_WriteDATA(0xff); 142 | 143 | EPD_W21_WriteCMD(0x13); //Transfer new data 144 | for(i=0;i<2756;i++) 145 | EPD_W21_WriteDATA(pgm_read_byte(&picData[i])); 146 | 147 | //Refresh 148 | EPD_W21_WriteCMD(0x12); //DISPLAY REFRESH 149 | delay(10); //!!!The delay here is necessary, 200uS at least!!! 150 | lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal 151 | 152 | } 153 | 154 | void PIC_display_Clean(void) 155 | { 156 | unsigned int i; 157 | EPD_W21_WriteCMD(0x10); //Transfer old data 158 | for(i=0;i<2756;i++) 159 | { 160 | EPD_W21_WriteDATA(0xff); 161 | } 162 | 163 | EPD_W21_WriteCMD(0x13); //Transfer new data 164 | for(i=0;i<2756;i++) 165 | { 166 | EPD_W21_WriteDATA(0xff); 167 | } 168 | //Refresh 169 | EPD_W21_WriteCMD(0x12); //DISPLAY REFRESH 170 | delay(10); //!!!The delay here is necessary, 200uS at least!!! 171 | lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal 172 | 173 | } 174 | void lcd_chkstatus(void) 175 | { 176 | while(1) 177 | { //=0 BUSY 178 | if(isEPD_W21_BUSY==1) break; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /2.9 inch E-paper - monocolor 128x296/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "demo.h" 6 | 7 | void setup() { 8 | pinMode(D2, INPUT); //BUSY 9 | pinMode(D0, OUTPUT); //RES 10 | pinMode(D3, OUTPUT); //DC 11 | pinMode(D1, OUTPUT); //CS 12 | //SPI 13 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 14 | SPI.begin (); 15 | } 16 | 17 | //Tips// 18 | /* 19 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 20 | 2.There will be no flicker when EPD performs a partial refresh. 21 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 22 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 23 | 5.Re-initialization is required for every full screen update. 24 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 25 | */ 26 | void loop() { 27 | // unsigned char i; 28 | // #if 1 //Full screen refresh, fast refresh, and partial refresh demostration. 29 | 30 | // EPD_HW_Init(); //Full screen refresh initialization. 31 | // EPD_WhiteScreen_White(); //Clear screen function. 32 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 33 | // delay(2000); //Delay for 2s. 34 | // /************Full display(2s)*******************/ 35 | // EPD_HW_Init(); //Full screen refresh initialization. 36 | // EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen refresh. 37 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 38 | // delay(2000); //Delay for 2s. 39 | // /************Fast refresh mode(1.5s)*******************/ 40 | // EPD_HW_Init_Fast(); //Fast refresh initialization. 41 | // EPD_WhiteScreen_ALL_Fast(gImage_1); //To display one image using fast refresh. 42 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 43 | // delay(2000); //Delay for 2s. 44 | // EPD_HW_Init_Fast(); //Fast refresh initialization. 45 | // EPD_WhiteScreen_ALL_Fast(gImage_2); //To display the second image using fast refresh. 46 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 47 | // delay(2000); //Delay for 2s. 48 | 49 | // /************Fast refresh mode(1s)*******************/ 50 | // #if 1 //To enable this feature, please change 0 to 1 51 | // /************Onder versions do not support this feature*******************/ 52 | // EPD_HW_Init_Fast2(); //Fast refresh initialization. 53 | // EPD_WhiteScreen_ALL_Fast2(gImage_1); //To display one image using fast refresh. 54 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 55 | // delay(1000); //Delay for 1s. 56 | // EPD_HW_Init_Fast2(); //EPD init Fast 57 | // EPD_WhiteScreen_ALL_Fast2(gImage_2); //To display the second image using fast refresh. 58 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 59 | // delay(1000); //Delay for 1s. 60 | // #endif 61 | 62 | // #if 1 //Partial refresh demostration. 63 | // //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. 64 | // //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 65 | // //////////////////////Partial refresh time demo///////////////////////////////////// 66 | // EPD_HW_Init(); //Electronic paper initialization. 67 | // EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 68 | // for(i=0;i<6;i++) 69 | // EPD_Dis_Part_Time(32,92+32*0,Num[i], //x-A,y-A,DATA-A 70 | // 32,92+32*1,Num[0], //x-B,y-B,DATA-B 71 | // 32,92+32*2,gImage_numdot, //x-C,y-C,DATA-C 72 | // 32,92+32*3,Num[0], //x-D,y-D,DATA-D 73 | // 32,92+32*4,Num[1],32,64); //x-E,y-E,DATA-E,Resolution 32*64 74 | 75 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 76 | // delay(2000); //Delay for 2s. 77 | // EPD_HW_Init(); //Full screen refresh initialization. 78 | // EPD_WhiteScreen_White(); //Clear screen function. 79 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 80 | // delay(2000); //Delay for 2s. 81 | // #endif 82 | 83 | // #if 0 //Demo of using partial refresh to update the full screen, to enable this feature, please change 0 to 1. 84 | // //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 85 | // //////////////////////Partial refresh time demo///////////////////////////////////// 86 | // EPD_HW_Init(); //E-paper initialization 87 | // EPD_SetRAMValue_BaseMap(gImage_p1); //Please do not delete the background color function, otherwise it will cause an unstable display during partial refresh. 88 | // EPD_Dis_PartAll(gImage_p1); //Image 1 89 | // EPD_Dis_PartAll(gImage_p2); //Image 2 90 | // EPD_Dis_PartAll(gImage_p3); //Image 3 91 | // EPD_Dis_PartAll(gImage_p4); //Image 4 92 | // EPD_Dis_PartAll(gImage_p5); //Image 5 93 | // EPD_DeepSleep();//Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 94 | // delay(2000); //Delay for 2s. 95 | // EPD_HW_Init(); //Full screen refresh initialization. 96 | // EPD_WhiteScreen_White(); //Clear screen function. 97 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 98 | // delay(2000); //Delay for 2s. 99 | // #endif 100 | 101 | // #if 0 //Demonstration of full screen refresh with 180-degree rotation, to enable this feature, please change 0 to 1. 102 | /************Full display(2s)*******************/ 103 | EPD_HW_Init(); //Full screen refresh initialization. 104 | EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen refresh. 105 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 106 | delay(2000); //Delay for 2s. 107 | // #endif 108 | // #endif 109 | delay(300000); // The program stops here 110 | } 111 | 112 | 113 | 114 | 115 | //////////////////////////////////END////////////////////////////////////////////////// 116 | -------------------------------------------------------------------------------- /7.5-inch E-Paper - monocolor 800x480/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "Ap_29demo.h" 6 | //GUI 7 | #include "GUI_Paint.h" 8 | #include "fonts.h" 9 | 10 | #if 1 11 | unsigned char BlackImage[EPD_ARRAY];//Define canvas space 12 | #endif 13 | 14 | void setup() { 15 | pinMode(D2, INPUT); //BUSY 16 | pinMode(D0, OUTPUT); //RES 17 | pinMode(D3, OUTPUT); //DC 18 | pinMode(D1, OUTPUT); //CS 19 | 20 | //SPI 21 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 22 | SPI.begin (); 23 | } 24 | 25 | //Tips// 26 | /* 27 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 28 | 2.There will be no flicker when EPD performs a partial refresh. 29 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 30 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 31 | 5.Re-initialization is required for every full screen update. 32 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 33 | */ 34 | void loop() { 35 | //This part is about how to display GUI. If you want to see the effect of image, please jump to line 94. 36 | #if 1 37 | Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 0, WHITE); //Set canvas parameters, GUI image rotation, please change 0 to 0/90/180/270. 38 | Paint_SelectImage(BlackImage); //Select current settings. 39 | 40 | /**************Drawing demonstration**********************/ 41 | EPD_Init(); //Full screen refresh initialization. 42 | Paint_Clear(WHITE); //Clear canvas. 43 | //Point. 44 | Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); //point 1x1. 45 | Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); //point 2x2. 46 | Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); //point 3x3. 47 | Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT); //point 4x4. 48 | //Line. 49 | Paint_DrawLine(20, 10, 70, 60, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 1. 50 | Paint_DrawLine(70, 10, 20, 60, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 2. 51 | //Rectangle. 52 | Paint_DrawRectangle(20, 10, 70, 60, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow rectangle 1. 53 | Paint_DrawRectangle(85, 10, 130, 60, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //Hollow rectangle 2. 54 | //Circle. 55 | Paint_DrawCircle(150, 90, 30, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow circle. 56 | Paint_DrawCircle(200, 90, 30, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //solid circle. 57 | EPD_Display(BlackImage); //Display GUI image. 58 | EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 59 | delay(2000); //Delay for 2s. 60 | 61 | /***********Letter demo***************************/ 62 | EPD_Init(); //Full screen refresh initialization. 63 | Paint_Clear(WHITE); //Clear canvas. 64 | Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK); //5*8. 65 | Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //7*12. 66 | Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //11*16. 67 | Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //14*20. 68 | Paint_DrawString_EN(0, 80, "Good Display", &Font24, WHITE, BLACK); //17*24 69 | EPD_Display(BlackImage);//Display GUI image. 70 | EPD_DeepSleep(); //EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 71 | delay(2000); //Delay for 2s. 72 | 73 | /*************Numbers demo************************/ 74 | EPD_Init(); //Full screen refresh initialization. 75 | Paint_Clear(WHITE); //Clear canvas. 76 | Paint_DrawNum(0, 0, 123456789, &Font8, WHITE, BLACK); //5*8. 77 | Paint_DrawNum(0, 10, 123456789, &Font12, WHITE, BLACK); //7*12. 78 | Paint_DrawNum(0, 25, 123456789, &Font16, WHITE, BLACK); //11*16. 79 | Paint_DrawNum(0, 45, 123456789, &Font20, WHITE, BLACK); //14*20. 80 | Paint_DrawNum(0, 70, 123456789, &Font24, WHITE, BLACK); //17*24. 81 | EPD_Display(BlackImage); //Display GUI image. 82 | EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 83 | delay(2000); //Delay for 2s. 84 | 85 | //Full screen update clear the screen. 86 | // EPD_Init(); //Full screen refresh initialization. 87 | // EPD_WhiteScreen_White(); //Clear screen function. 88 | // EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 89 | // delay(2000); //Delay for 2s. 90 | 91 | #endif 92 | 93 | //Full screen refresh, fast refresh, and partial refresh demostration. If you want to see the effect, please change the next line 0 to 1. 94 | #if 0 95 | unsigned char i; 96 | 97 | EPD_Init(); //Full screen refresh initialization. 98 | EPD_WhiteScreen_White(); //Clear screen function. 99 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 100 | delay(2000); //Delay for 2s. 101 | 102 | /************Full display(2s)*******************/ 103 | EPD_Init(); //Full screen refresh initialization. 104 | EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen refresh. 105 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 106 | delay(2000); //Delay for 2s. 107 | 108 | /************Fast refresh mode(1.5s)*******************/ 109 | EPD_Init_Fast(); //Fast refresh initialization. 110 | EPD_WhiteScreen_ALL_Fast(gImage_1); //To display one image using fast refresh. 111 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 112 | delay(2000); //Delay for 2s. 113 | 114 | //Partial refresh demostration. 115 | //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. 116 | //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 117 | 118 | //////////////////////Partial refresh time demo///////////////////////////////////// 119 | EPD_Init(); //Electronic paper initialization. 120 | EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 121 | EPD_Init_Part(); //Pa refresh initialization. 122 | for(i=0;i<6;i++) 123 | { 124 | EPD_Dis_Part_Time(200,180,Num[1],Num[0],gImage_numdot,Num[0],Num[i],5,104,48); //x,y,DATA-A~E,Resolution 48*104 125 | } 126 | 127 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 128 | delay(2000); //Delay for 2s. 129 | EPD_Init(); //Full screen refresh initialization. 130 | EPD_WhiteScreen_White(); //Clear screen function. 131 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 132 | delay(2000); //Delay for 2s. 133 | #endif 134 | 135 | while(1); // The program stops here 136 | } 137 | 138 | //////////////////////////////////END////////////////////////////////////////////////// 139 | -------------------------------------------------------------------------------- /2.9-inch e-paper - quadruple color 128x296/example/example.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include"demo.h" 3 | //IO settings 4 | int BUSY_Pin = D2; 5 | int RES_Pin = D0; 6 | int DC_Pin = D3; 7 | int CS_Pin = D1; 8 | //SCLK--GPIO23 9 | //MOSI---GPIO18 10 | 11 | #define EPD_W21_CS_0 digitalWrite(CS_Pin,LOW) 12 | #define EPD_W21_CS_1 digitalWrite(CS_Pin,HIGH) 13 | #define EPD_W21_DC_0 digitalWrite(DC_Pin,LOW) 14 | #define EPD_W21_DC_1 digitalWrite(DC_Pin,HIGH) 15 | #define EPD_W21_RST_0 digitalWrite(RES_Pin,LOW) 16 | #define EPD_W21_RST_1 digitalWrite(RES_Pin,HIGH) 17 | #define isEPD_W21_BUSY digitalRead(BUSY_Pin) 18 | 19 | //2bit 20 | #define black 0x00 /// 00 21 | #define white 0x01 /// 01 22 | #define yellow 0x02 /// 10 23 | #define red 0x03 /// 11 24 | 25 | 26 | #define Source_BITS 128 27 | #define Gate_BITS 296 28 | #define ALLSCREEN_BYTES Source_BITS*Gate_BITS/4 29 | 30 | ////////FUNCTION////// 31 | void SPI_Write(unsigned char value); 32 | void EPD_W21_WriteCMD(unsigned char command); 33 | void EPD_W21_WriteDATA(unsigned char datas); 34 | //EPD 35 | //EPD 36 | void EPD_init(void); 37 | void Acep_color(unsigned char color); 38 | void PIC_display (const unsigned char* picData); 39 | void Display_All_White(void); 40 | void EPD_sleep(void); 41 | void EPD_refresh(void); 42 | void lcd_chkstatus(void); 43 | 44 | 45 | void setup() { 46 | pinMode(BUSY_Pin, INPUT); 47 | pinMode(RES_Pin, OUTPUT); 48 | pinMode(DC_Pin, OUTPUT); 49 | pinMode(CS_Pin, OUTPUT); 50 | //SPI 51 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 52 | SPI.begin (); 53 | } 54 | 55 | //Tips// 56 | /*When the electronic paper is refreshed in full screen, the picture flicker is a normal phenomenon, and the main function is to clear the display afterimage in the previous picture. 57 | When the local refresh is performed, the screen does not flash.*/ 58 | /*When you need to transplant the driver, you only need to change the corresponding IO. The BUSY pin is the input mode and the others are the output mode. */ 59 | 60 | void loop() { 61 | 62 | ///////////////////////////Normal picture display///////////////////////////////////////////////////////////////// 63 | /************Normal picture display*******************/ 64 | EPD_init(); //EPD init 65 | PIC_display(gImage_demo);//EPD_picture1 66 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 67 | delay(5000); //5s 68 | 69 | EPD_init(); //EPD init 70 | Display_All_White(); 71 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 72 | 73 | delay(300000); // The program stops here 74 | 75 | } 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | ///////////////////EXTERNAL FUNCTION//////////////////////////////////////////////////////////////////////// 89 | /////////////////////delay////////////////////////////////////// 90 | 91 | //////////////////////SPI/////////////////////////////////// 92 | 93 | void SPI_Write(unsigned char value) 94 | { 95 | SPI.transfer(value); 96 | } 97 | 98 | void EPD_W21_WriteCMD(unsigned char command) 99 | { 100 | EPD_W21_CS_0; 101 | EPD_W21_DC_0; // command write 102 | SPI_Write(command); 103 | EPD_W21_CS_1; 104 | } 105 | void EPD_W21_WriteDATA(unsigned char datas) 106 | { 107 | EPD_W21_CS_0; 108 | EPD_W21_DC_1; // command write 109 | SPI_Write(datas); 110 | EPD_W21_CS_1; 111 | } 112 | 113 | /////////////////EPD settings Functions///////////////////// 114 | 115 | ////////////////////////////////////////////////////////////////////////////////////////////////// 116 | //JD 117 | void EPD_init(void) 118 | { 119 | delay(20);//At least 20ms delay 120 | EPD_W21_RST_0; // Module reset 121 | delay(40);//At least 40ms delay 122 | EPD_W21_RST_1; 123 | delay(50);//At least 50ms delay 124 | 125 | lcd_chkstatus(); 126 | EPD_W21_WriteCMD(0x4D); 127 | EPD_W21_WriteDATA(0x78); 128 | 129 | EPD_W21_WriteCMD(0x00); //PSR 130 | EPD_W21_WriteDATA(0x0F); 131 | EPD_W21_WriteDATA(0x29); 132 | 133 | EPD_W21_WriteCMD(0x01); //PWRR 134 | EPD_W21_WriteDATA(0x07); 135 | EPD_W21_WriteDATA(0x00); 136 | 137 | EPD_W21_WriteCMD(0x03); //POFS 138 | EPD_W21_WriteDATA(0x10); 139 | EPD_W21_WriteDATA(0x54); 140 | EPD_W21_WriteDATA(0x44); 141 | 142 | EPD_W21_WriteCMD(0x06); //BTST_P 143 | EPD_W21_WriteDATA(0x05); 144 | EPD_W21_WriteDATA(0x00); 145 | EPD_W21_WriteDATA(0x3F); 146 | EPD_W21_WriteDATA(0x0A); 147 | EPD_W21_WriteDATA(0x25); 148 | EPD_W21_WriteDATA(0x12); 149 | EPD_W21_WriteDATA(0x1A); 150 | 151 | EPD_W21_WriteCMD(0x50); //CDI 152 | EPD_W21_WriteDATA(0x37); 153 | 154 | EPD_W21_WriteCMD(0x60); //TCON 155 | EPD_W21_WriteDATA(0x02); 156 | EPD_W21_WriteDATA(0x02); 157 | 158 | EPD_W21_WriteCMD(0x61); //TRES 159 | EPD_W21_WriteDATA(Source_BITS/256); // Source_BITS_H 160 | EPD_W21_WriteDATA(Source_BITS%256); // Source_BITS_L 161 | EPD_W21_WriteDATA(Gate_BITS/256); // Gate_BITS_H 162 | EPD_W21_WriteDATA(Gate_BITS%256); // Gate_BITS_L 163 | 164 | EPD_W21_WriteCMD(0xE7); 165 | EPD_W21_WriteDATA(0x1C); 166 | 167 | EPD_W21_WriteCMD(0xE3); 168 | EPD_W21_WriteDATA(0x22); 169 | 170 | EPD_W21_WriteCMD(0xB4); 171 | EPD_W21_WriteDATA(0xD0); 172 | EPD_W21_WriteCMD(0xB5); 173 | EPD_W21_WriteDATA(0x03); 174 | 175 | EPD_W21_WriteCMD(0xE9); 176 | EPD_W21_WriteDATA(0x01); 177 | 178 | EPD_W21_WriteCMD(0x30); 179 | EPD_W21_WriteDATA(0x08); 180 | 181 | EPD_W21_WriteCMD(0x04); 182 | lcd_chkstatus(); 183 | 184 | } 185 | //////////////////////////////All screen update//////////////////////////////////////////// 186 | 187 | 188 | 189 | ///////////////////////////////////////////////////////////////////////////////////////// 190 | void EPD_refresh(void) 191 | { 192 | EPD_W21_WriteCMD(0x12); //Display Update Control 193 | EPD_W21_WriteDATA(0x00); 194 | lcd_chkstatus(); 195 | } 196 | 197 | void EPD_sleep(void) 198 | { 199 | EPD_W21_WriteCMD(0X02); //power off 200 | EPD_W21_WriteDATA(0x00); 201 | lcd_chkstatus(); //waiting for the electronic paper IC to release the idle sign 202 | 203 | EPD_W21_WriteCMD(0X07); //deep sleep 204 | EPD_W21_WriteDATA(0xA5); 205 | } 206 | void lcd_chkstatus(void) 207 | { 208 | while(1) 209 | { //=0 BUSY 210 | if(isEPD_W21_BUSY==1) break; 211 | } 212 | } 213 | 214 | 215 | unsigned char Color_get(unsigned char color) 216 | { 217 | unsigned datas; 218 | switch(color) 219 | { 220 | case 0x00: 221 | datas=white; 222 | break; 223 | case 0x01: 224 | datas=yellow; 225 | break; 226 | case 0x02: 227 | datas=red; 228 | break; 229 | case 0x03: 230 | datas=black; 231 | break; 232 | default: 233 | break; 234 | } 235 | return datas; 236 | } 237 | 238 | 239 | 240 | void PIC_display(const unsigned char* picData) 241 | { 242 | unsigned int i,j; 243 | unsigned char temp1; 244 | unsigned char data_H1,data_H2,data_L1,data_L2,datas; 245 | 246 | EPD_W21_WriteCMD(0x10); 247 | for(i=0;i>6&0x03)<<6; 254 | data_H2=Color_get(temp1>>4&0x03)<<4; 255 | data_L1=Color_get(temp1>>2&0x03)<<2; 256 | data_L2=Color_get(temp1&0x03); 257 | 258 | datas=data_H1|data_H2|data_L1|data_L2; 259 | EPD_W21_WriteDATA(datas); 260 | } 261 | } 262 | 263 | //Refresh 264 | EPD_refresh(); 265 | } 266 | void Display_All_White(void) 267 | { 268 | unsigned long i; 269 | 270 | EPD_W21_WriteCMD(0x10); 271 | { 272 | for(i=0;i 2 | //EPD 3 | #include "Display_EPD_W21_spi.h" 4 | #include "Display_EPD_W21.h" 5 | #include "Ap_29demo.h" 6 | //GUI 7 | #include "GUI_Paint.h" 8 | #include "fonts.h" 9 | 10 | #if 1 11 | unsigned char BlackImage[EPD_ARRAY];//Define canvas space 12 | #endif 13 | void setup() { 14 | pinMode(D2, INPUT); //BUSY 15 | pinMode(D0, OUTPUT); //RES 16 | pinMode(D3, OUTPUT); //DC 17 | pinMode(D1, OUTPUT); //CS 18 | 19 | //SPI 20 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 21 | SPI.begin (); 22 | } 23 | 24 | //Tips// 25 | /* 26 | 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 27 | 2.There will be no flicker when EPD performs a partial refresh. 28 | 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 29 | 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 30 | 5.Re-initialization is required for every full screen update. 31 | 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. 32 | */ 33 | void loop() { 34 | 35 | //This part is about how to display GUI. If you want to see the effect of image, please jump to line 98. 36 | #if 1 37 | Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 180, WHITE); //Set canvas parameters, GUI image rotation, please change 270 to 0/90/180/270. 38 | Paint_SelectImage(BlackImage); //Select current settings. 39 | /**************Drawing demonstration**********************/ 40 | 41 | EPD_HW_Init_GUI(); //GUI initialization. 42 | Paint_Clear(WHITE); //Clear canvas. 43 | //Point. 44 | Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); //point 1x1. 45 | Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); //point 2x2. 46 | Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); //point 3x3. 47 | Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT); //point 4x4. 48 | //Line. 49 | Paint_DrawLine(20, 10, 70, 60, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 1. 50 | Paint_DrawLine(70, 10, 20, 60, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 2. 51 | //Rectangle. 52 | Paint_DrawRectangle(20, 10, 70, 60, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow rectangle 1. 53 | Paint_DrawRectangle(85, 10, 130, 60, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //Hollow rectangle 2. 54 | //Circle. 55 | Paint_DrawCircle(150, 90, 30, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow circle. 56 | Paint_DrawCircle(200, 90, 30, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //solid circle. 57 | EPD_Display(BlackImage); //Display GUI image. 58 | EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 59 | delay(2000); //Delay for 2s. 60 | 61 | /***********Letter demo***************************/ 62 | EPD_HW_Init_GUI(); //GUI initialization. 63 | Paint_Clear(WHITE); //Clear canvas. 64 | Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK); //5*8. 65 | Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //7*12. 66 | Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //11*16. 67 | Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //14*20. 68 | Paint_DrawString_EN(0, 80, "Good Display", &Font24, WHITE, BLACK); //17*24. 69 | EPD_Display(BlackImage);//Display GUI image. 70 | EPD_DeepSleep(); //EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 71 | delay(5000); //Delay for 2s. 72 | 73 | EPD_HW_Init(); //Full screen refresh initialization. 74 | EPD_WhiteScreen_White(); //Clear screen function. 75 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 76 | delay(2000); //Delay for 2s. 77 | 78 | /*************Numbers demo************************/ 79 | 80 | EPD_HW_Init_GUI(); //GUI initialization. 81 | Paint_Clear(WHITE); //Clear canvas. 82 | Paint_DrawNum(0, 0, 123456789, &Font8, WHITE, BLACK); //5*8. 83 | Paint_DrawNum(0, 10, 123456789, &Font12, WHITE, BLACK); //7*12. 84 | Paint_DrawNum(0, 25, 123456789, &Font16, WHITE, BLACK); //11*16. 85 | Paint_DrawNum(0, 45, 123456789, &Font20, WHITE, BLACK); //14*20. 86 | Paint_DrawNum(0, 70, 123456789, &Font24, WHITE, BLACK); //17*24. 87 | EPD_Display(BlackImage); //Display GUI image. 88 | EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! 89 | delay(2000); //Delay for 2s. 90 | 91 | //Full screen update clear the screen. 92 | EPD_HW_Init(); //Full screen refresh initialization. 93 | EPD_WhiteScreen_White(); //Clear screen function. 94 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 95 | delay(2000); //Delay for 2s. 96 | #endif 97 | 98 | //This part is about how to display image. If you want to see the effect, please change the next line 0 to 1. 99 | #if 0 100 | unsigned char i; 101 | EPD_HW_Init(); //Full screen refresh initialization. 102 | EPD_WhiteScreen_White(); //Clear screen function. 103 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 104 | delay(2000); //Delay for 2s. 105 | 106 | /************Full display(2s)*******************/ 107 | EPD_HW_Init(); //Full screen refresh initialization. 108 | EPD_WhiteScreen_ALL(gImage_2); //To Display one image using full screen refresh. 109 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 110 | delay(2000);; //Delay for 2s. 111 | 112 | // /************Fast refresh mode(1.5s)*******************/ 113 | EPD_HW_Init_Fast(); //Fast refresh initialization. 114 | EPD_WhiteScreen_ALL_Fast(gImage_1); //To display one image using fast refresh. 115 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 116 | delay(2000); //Delay for 2s. 117 | EPD_HW_Init_Fast(); //Fast refresh initialization. 118 | EPD_WhiteScreen_ALL_Fast(gImage_2); //To display the second image using fast refresh. 119 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 120 | delay(2000); //Delay for 2s. 121 | 122 | // /************Fast refresh mode(1s)*******************/ 123 | // /************Onder versions do not support this feature*******************/ 124 | EPD_HW_Init_Fast2(); //Fast refresh initialization. 125 | EPD_WhiteScreen_ALL_Fast(gImage_1); //To display one image using fast refresh. 126 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 127 | delay(1000); //Delay for 1s. 128 | EPD_HW_Init_Fast2(); //EPD init Fast 129 | EPD_WhiteScreen_ALL_Fast(gImage_2); //To display the second image using fast refresh. 130 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 131 | delay(1000); //Delay for 1s. 132 | 133 | 134 | //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. 135 | //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. 136 | //////////////////////Partial refresh time demo///////////////////////////////////// 137 | EPD_HW_Init(); //Electronic paper initialization. 138 | EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial refresh. 139 | for(i=0;i<6;i++) 140 | EPD_Dis_Part_Time(152,92+32*0,Num[i], //x-A,y-A,DATA-A 141 | 152,92+32*1,Num[0], //x-B,y-B,DATA-B 142 | 152,92+32*2,gImage_numdot, //x-C,y-C,DATA-C 143 | 152,92+32*3,Num[0], //x-D,y-D,DATA-D 144 | 152,92+32*4,Num[1],32,64); //x-E,y-E,DATA-E,Resolution 32*64 145 | 146 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 147 | delay(2000); //Delay for 2s. 148 | 149 | EPD_HW_Init(); //Full screen refresh initialization. 150 | EPD_WhiteScreen_White(); //Clear screen function. 151 | EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. 152 | delay(2000); //Delay for 2s. 153 | #endif 154 | 155 | while(1); // The program stops here 156 | } 157 | 158 | ////////////////////END//////////////////////// 159 | -------------------------------------------------------------------------------- /5.83-inch E-paper - monocolor 648x480/example/Display_EPD_W21.cpp: -------------------------------------------------------------------------------- 1 | #include "Display_EPD_W21_spi.h" 2 | #include "Display_EPD_W21.h" 3 | 4 | 5 | unsigned char PartImage[1000];//Define Partial canvas space 6 | 7 | ////////////////////////////////////E-paper demo////////////////////////////////////////////////////////// 8 | //Busy function 9 | void lcd_chkstatus(void) 10 | { 11 | while(1) 12 | { //=0 BUSY 13 | if(isEPD_W21_BUSY==1) break; 14 | } 15 | } 16 | //Full screen refresh initialization 17 | void EPD_Init(void) 18 | { 19 | EPD_W21_RST_0; // Module reset 20 | delay(10);//At least 10ms delay 21 | EPD_W21_RST_1; 22 | delay(10); //At least 10ms delay 23 | 24 | EPD_W21_WriteCMD(0x00); 25 | EPD_W21_WriteDATA(0x1F); 26 | 27 | EPD_W21_WriteCMD(0x04); //POWER ON 28 | delay(300); 29 | lcd_chkstatus(); 30 | EPD_W21_WriteCMD(0X50); //VCOM AND DATA INTERVAL SETTING 31 | EPD_W21_WriteDATA(0x21); 32 | EPD_W21_WriteDATA(0x07); 33 | 34 | } 35 | //Fast refresh 1 initialization 36 | void EPD_Init_Fast(void) 37 | { 38 | EPD_W21_RST_0; // Module reset 39 | delay(10);//At least 10ms delay 40 | EPD_W21_RST_1; 41 | delay(10); //At least 10ms delay 42 | 43 | EPD_W21_WriteCMD(0x00); 44 | EPD_W21_WriteDATA(0x1F); 45 | 46 | EPD_W21_WriteCMD(0x04); //POWER ON 47 | delay(300); 48 | lcd_chkstatus(); 49 | EPD_W21_WriteCMD(0X50); //VCOM AND DATA INTERVAL SETTING 50 | EPD_W21_WriteDATA(0x29); 51 | EPD_W21_WriteDATA(0x07); 52 | 53 | EPD_W21_WriteCMD(0xE0); 54 | EPD_W21_WriteDATA(0x02); 55 | EPD_W21_WriteCMD(0xE5); 56 | EPD_W21_WriteDATA(0x5A); 57 | } 58 | //Partial refresh initialization 59 | void EPD_Init_Part(void) 60 | { 61 | EPD_W21_RST_0; // Module reset 62 | delay(10);//At least 10ms delay 63 | EPD_W21_RST_1; 64 | delay(10); //At least 10ms delay 65 | 66 | EPD_W21_WriteCMD(0x00); 67 | EPD_W21_WriteDATA(0x1F); 68 | 69 | EPD_W21_WriteCMD(0x04); //POWER ON 70 | delay(300); 71 | lcd_chkstatus(); 72 | 73 | EPD_W21_WriteCMD(0xE0); 74 | EPD_W21_WriteDATA(0x02); 75 | EPD_W21_WriteCMD(0xE5); 76 | EPD_W21_WriteDATA(0x6E); 77 | 78 | } 79 | 80 | //////////////////////////////Display Update Function/////////////////////////////////////////////////////// 81 | //Full screen refresh update function 82 | void EPD_Update(void) 83 | { 84 | //Refresh 85 | EPD_W21_WriteCMD(0x12); //DISPLAY REFRESH 86 | delay(1); //!!!The delay here is necessary, 200uS at least!!! 87 | lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal 88 | } 89 | 90 | //////////////////////////////Display Data Transfer Function//////////////////////////////////////////// 91 | //Full screen refresh display function 92 | void EPD_WhiteScreen_ALL(const unsigned char *datas) 93 | { 94 | unsigned int i; 95 | EPD_W21_WriteCMD(0x10); //write old data 96 | for(i=0;i 2 | #include"demo.h" 3 | //IO settings 4 | int BUSY_Pin = D2; 5 | int RES_Pin = D0; 6 | int DC_Pin = D3; 7 | int CS_Pin = D1; 8 | //SCLK--GPIO23 9 | //MOSI---GPIO18 10 | 11 | #define EPD_W21_CS_0 digitalWrite(CS_Pin,LOW) 12 | #define EPD_W21_CS_1 digitalWrite(CS_Pin,HIGH) 13 | #define EPD_W21_DC_0 digitalWrite(DC_Pin,LOW) 14 | #define EPD_W21_DC_1 digitalWrite(DC_Pin,HIGH) 15 | #define EPD_W21_RST_0 digitalWrite(RES_Pin,LOW) 16 | #define EPD_W21_RST_1 digitalWrite(RES_Pin,HIGH) 17 | #define isEPD_W21_BUSY digitalRead(BUSY_Pin) 18 | 19 | //8bit 20 | #define Black 0x00 /// 000 21 | #define White 0x11 /// 001 22 | #define Green 0x22 /// 010 23 | #define Blue 0x33 /// 011 24 | #define Red 0x44 /// 100 25 | #define Yellow 0x55 /// 101 26 | #define Orange 0x66 /// 110 27 | #define Clean 0x77 /// 111 28 | 29 | //4bit 30 | #define black 0x00 /// 000 31 | #define white 0x01 /// 001 32 | #define green 0x02 /// 010 33 | #define blue 0x03 /// 011 34 | #define red 0x04 /// 100 35 | #define yellow 0x05 /// 101 36 | #define orange 0x06 /// 110 37 | #define clean 0x07 /// 111 38 | ////////FUNCTION////// 39 | void driver_delay_us(unsigned int xus); 40 | void driver_delay(unsigned long xms); 41 | void DELAY_S(unsigned int delaytime); 42 | void SPI_Delay(unsigned char xrate); 43 | void SPI_Write(unsigned char value); 44 | void EPD_W21_WriteDATA(unsigned char command); 45 | void EPD_W21_WriteCMD(unsigned char command); 46 | //EPD 47 | void EPD_W21_Init(void); 48 | void EPD_init(void); 49 | void PIC_display(const unsigned char* picData); 50 | void EPD_sleep(void); 51 | void EPD_refresh(void); 52 | void lcd_chkstatus(void); 53 | void PIC_display_Clear(void); 54 | void EPD_horizontal(void); 55 | void EPD_vertical(void); 56 | void Acep_color(unsigned char color); 57 | 58 | void setup() { 59 | pinMode(BUSY_Pin, INPUT); 60 | pinMode(RES_Pin, OUTPUT); 61 | pinMode(DC_Pin, OUTPUT); 62 | pinMode(CS_Pin, OUTPUT); 63 | //SPI 64 | SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 65 | SPI.begin (); 66 | } 67 | 68 | 69 | //Tips// 70 | /*When the electronic paper is refreshed in full screen, the picture flicker is a normal phenomenon, and the main function is to clear the display afterimage in the previous picture. 71 | When the local refresh is performed, the screen does not flash.*/ 72 | /*When you need to transplant the driver, you only need to change the corresponding IO. The BUSY pin is the input mode and the others are the output mode. */ 73 | 74 | 75 | void loop() { 76 | 77 | EPD_init(); //EPD init 78 | PIC_display(gImage_demo);//EPD_picture1 79 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 80 | delay(5000); //5s 81 | //EPD_horizontal 82 | EPD_init(); //EPD init 83 | EPD_horizontal();//EPD horizontal 7 color 84 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 85 | delay(5000); //5s 86 | 87 | EPD_init(); //EPD init 88 | EPD_vertical();//EPD vertical 7 color 89 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 90 | delay(5000); //5s 91 | 92 | //Clear 93 | EPD_init(); //EPD init 94 | PIC_display_Clear();//EPD Clear 95 | EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!! 96 | delay(5000); //5s 97 | 98 | delay(300000); // The program stops here 99 | } 100 | 101 | 102 | 103 | 104 | ///////////////////EXTERNAL FUNCTION//////////////////////////////////////////////////////////////////////// 105 | /////////////////////delay////////////////////////////////////// 106 | void driver_delay_us(unsigned int xus) //1us 107 | { 108 | for(;xus>1;xus--); 109 | } 110 | void driver_delay(unsigned long xms) //1ms 111 | { 112 | unsigned long i = 0 , j=0; 113 | 114 | for(j=0;j