This commit is contained in:
gooddisplayshare
2024-12-04 10:59:56 +08:00
parent 2828e18bdb
commit 488b13fe5a
18 changed files with 53387 additions and 0 deletions

View File

@@ -0,0 +1,344 @@
#include <EPD_SPI.h>
#include "EPD.h"
//Delay Functions
void delay_xms(unsigned int xms)
{
delay(xms);
}
////////////////////////////////////E-paper demo//////////////////////////////////////////////////////////
//Busy function
void Epaper_READBUSY(void)
{
while(1)
{ //=1 BUSY
if(isEPD_W21_BUSY==0) break;
}
}
//Full screen update initialization
void EPD_HW_Init(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10);//At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x0C); // Soft start setting
EPD_W21_WriteDATA(0xAE);
EPD_W21_WriteDATA(0xC7);
EPD_W21_WriteDATA(0xC3);
EPD_W21_WriteDATA(0xC0);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x01); // Set MUX as 639
EPD_W21_WriteDATA(0x7F);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x11); // Data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44);
EPD_W21_WriteDATA(0x00); // RAM x address start at 0
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0xBF); // RAM x address end at 3BFh -> 959
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0x45);
EPD_W21_WriteDATA(0x7F); // RAM y address start at 27Fh;
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00); // RAM y address end at 00h;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // LUT1, for white
EPD_W21_WriteCMD(0x18);
EPD_W21_WriteDATA(0X80);
EPD_W21_WriteCMD(0x4E);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F);
EPD_W21_WriteDATA(0x7F);
EPD_W21_WriteDATA(0x02);
}
//////////////////////////////Display Update Function///////////////////////////////////////////////////////
//Full screen update function
void EPD_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0xF7);
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
Epaper_READBUSY();
}
//Partial update function
void EPD_Part_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0xFF);
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
Epaper_READBUSY();
}
//////////////////////////////Display Data Transfer Function////////////////////////////////////////////
//Full screen update display function
void EPD_WhiteScreen_ALL(const unsigned char *datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Update();
}
//Clear screen display
void EPD_WhiteScreen_White(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0xff);
}
EPD_Update();
}
//Display all black
void EPD_WhiteScreen_Black(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
EPD_Update();
}
//Partial update of background display, this function is necessary, please do not delete it!!!
void EPD_SetRAMValue_BaseMap( const unsigned char * datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_W21_WriteCMD(0x26); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Update();
}
//Partial update display
void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE)
{
unsigned int i;
unsigned int x_end,y_end;
x_start=x_start/8; //x address start
x_end=x_start+PART_LINE/8-1; //x address end
y_start=y_start; //Y address start
y_end=y_start+PART_COLUMN-1; //Y address end
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x44); // set RAM x address start/end
EPD_W21_WriteDATA(x_start); //x address start
EPD_W21_WriteDATA(x_end); //y address end
EPD_W21_WriteCMD(0x45); // set RAM y address start/end
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteDATA(y_end%256); //y address end2
EPD_W21_WriteDATA(y_end/256); //y address end1
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(x_start); //x start address
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X127;
EPD_W21_WriteDATA(y_start%256);//y address start2
EPD_W21_WriteDATA(y_start/256);//y address start1
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Part_Update();
}
//Full screen partial update display
void EPD_Dis_PartAll(const unsigned char * datas)
{
unsigned int i;
unsigned int PART_COLUMN, PART_LINE;
PART_COLUMN=EPD_HEIGHT,PART_LINE=EPD_WIDTH;
EPD_W21_RST_0; // Module reset
delay(10); //At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Part_Update();
}
//Deep sleep function
void EPD_DeepSleep(void)
{
EPD_W21_WriteCMD(0x10); //Enter deep sleep
EPD_W21_WriteDATA(0x01);
delay(100);
}
//Partial update write address and data
void EPD_Dis_Part_RAM(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE)
{
unsigned int i;
unsigned int x_end,y_end;
x_start=x_start/8; //x address start
x_end=x_start+PART_LINE/8-1; //x address end
y_start=y_start-1; //Y address start
y_end=y_start+PART_COLUMN-1; //Y address end
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x44); // set RAM x address start/end
EPD_W21_WriteDATA(x_start); //x address start
EPD_W21_WriteDATA(x_end); //y address end
EPD_W21_WriteCMD(0x45); // set RAM y address start/end
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteDATA(y_end%256); //y address end2
EPD_W21_WriteDATA(y_end/256); //y address end1
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(x_start); //x start address
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X127;
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
}
//Clock display
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
)
{
EPD_Dis_Part_RAM(x_startA,y_startA,datasA,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startB,y_startB,datasB,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startC,y_startC,datasC,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startD,y_startD,datasD,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startE,y_startE,datasE,PART_COLUMN,PART_LINE);
EPD_Part_Update();
}
// GUI initialization
void EPD_HW_Init_GUI(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x0C); // Soft start setting
EPD_W21_WriteDATA(0xAE);
EPD_W21_WriteDATA(0xC7);
EPD_W21_WriteDATA(0xC3);
EPD_W21_WriteDATA(0xC0);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x01); // Set MUX as 527
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x01); //mirror
EPD_W21_WriteCMD(0x11); // Data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44);
EPD_W21_WriteDATA(0x00); // RAM x address start at 0
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0xBF); // RAM x address end at 36Fh -> 879
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0x45);
EPD_W21_WriteDATA(0xA7); // RAM y address start at 20Fh;
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00); // RAM y address end at 00h;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // LUT1, for white
EPD_W21_WriteCMD(0x18);
EPD_W21_WriteDATA(0X80);
EPD_W21_WriteCMD(0x4E);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F);
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
}
//GUI display
void EPD_Display(unsigned char *Image)
{
unsigned int Width, Height,i,j;
Width = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
Height = EPD_HEIGHT;
EPD_W21_WriteCMD(0x24);
for ( j = 0; j < Height; j++) {
for ( i = 0; i < Width; i++) {
EPD_W21_WriteDATA(Image[i + j * Width]);
}
}
EPD_Update();
}
/***********************************************************
end file
***********************************************************/

View File

@@ -0,0 +1,34 @@
#ifndef _EPD_H_
#define _EPD_H_
#define EPD_WIDTH 960
#define EPD_HEIGHT 640
#define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8
//Full screen update display
void EPD_HW_Init(void);
void EPD_HW_Init_180(void);
void EPD_WhiteScreen_ALL(const unsigned char *datas);
void EPD_WhiteScreen_White(void);
void EPD_WhiteScreen_Black(void);
void EPD_DeepSleep(void);
//Partial update display
void EPD_SetRAMValue_BaseMap(const unsigned char * datas);
void EPD_Dis_PartAll(const unsigned char * datas);
void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE);
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
);
//GUI
void EPD_HW_Init_GUI(void);
void EPD_Display(unsigned char *Image);
#endif

View File

@@ -0,0 +1,115 @@
#include<ESP32epdx.h> //E-paper SPI etc
//EPD
#include"EPD.h" //E-paper driver
#include"IMAGE.h" //E-paper image data
unsigned char ImageBW[EPD_ARRAY];//Define canvas space
void setup() {
/* ESP32-WROOM-32D (Using hardware SPI)
BUSY——GPIO13 RES——GPIO12 DC——GPIO14 CS——GPIO27 SCK—GPIO18 SDIN—GPIO23 */
pinMode(13, INPUT); //BUSY
pinMode(12, OUTPUT); //RES
pinMode(14, OUTPUT); //DC
pinMode(27, OUTPUT); //CS
//SPI
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
SPI.begin ();
}
//Tips//
/*
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.
2.There will be no flicker when EPD performs a partial update.
3.Please make sue that EPD enters sleep mode when update is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD.
4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.)
5.Re-initialization is required for every full screen update.
6.When porting the program, set the BUSY pin to input mode and other pins to output mode.
*/
void loop() {
unsigned char i;
#if 1 //Full screen update, fast update, and partial update demostration.
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
/************Full display(2s)*******************/
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen update.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#if 1 //Partial update demostration.
//Partial update demo support displaying a clock at 5 locations with 00:00. If you need to perform partial update more than 5 locations, please use the feature of using partial update at the full screen demo.
//After 5 partial updatees, implement a full screen update to clear the ghosting caused by partial updatees.
//////////////////////Partial update time demo/////////////////////////////////////
EPD_HW_Init(); //Electronic paper initialization.
EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial update.
for(i=0;i<6;i++)
EPD_Dis_Part_Time( 696+32*1,272,(unsigned char *)&Num[1], //x-A,y-A,DATA-A
696+32*2,272,(unsigned char *)&Num[0], //x-B,y-B,DATA-B
696+32*3,272,(unsigned char *)gImage_numdot, //x-C,y-C,DATA-C
696+32*4,272,(unsigned char *)&Num[0], //x-D,y-D,DATA-D
696+32*5,272,(unsigned char *)&Num[i],32,64); //x-E,y-E,DATA-E,Resolution 32*64
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#endif
#endif
#if 1 //GUI demostration.
///////////////////////////GUI///////////////////////////////////////////////////////////////////////////////////
//Data initialization settings
Paint_NewImage(ImageBW, EPD_WIDTH, EPD_HEIGHT, 0, WHITE); //Set screen size and display orientation
/**************Drawing**********************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
//Point.
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); //point 1x1.
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); //point 2x2.
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); //point 3x3.
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT); //point 4x4.
//Line.
Paint_DrawLine(20, 5, 50, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 1.
Paint_DrawLine(50, 5, 20, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 2.
//Rectangle.
Paint_DrawRectangle(20, 5, 50, 35, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow rectangle 1.
Paint_DrawRectangle(70, 5, 100, 35, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //Hollow rectangle 2.
//Circle.
Paint_DrawCircle(30, 50, 10, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow circle.
Paint_DrawCircle(80, 50, 10, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //solid circle.
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW);//display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
/***********String&Number***************************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK); //Font8
Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //Font12
Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //Font16
Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //Font20
Paint_DrawNum(0, 80, 123456789, &Font8, WHITE, BLACK); //Font8
Paint_DrawNum(0, 90, 123456789, &Font12, WHITE, BLACK); //Font12
Paint_DrawNum(0, 105, 123456789, &Font16, WHITE, BLACK); //Font16
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW); //display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
#endif
//Clear
EPD_HW_Init(); //EPD init
EPD_WhiteScreen_White();//EPD Clear
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
while(1); // The program stops here
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,428 @@
#include "EPD_SPI3.h" //E-paper 3-wire SPI
#include "EPD.h"
//Delay Functions
void delay_xms(unsigned int xms)
{
delay(xms);
}
////////////////////////////////////E-paper demo//////////////////////////////////////////////////////////
unsigned char partFlag=1;
void lcd_chkstatus(void)
{
while(isEPD_W21_BUSY==0);
}
void EPD_Init(void)
{
delay(100);//At least 10ms delay
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10);//At least 10ms delay
lcd_chkstatus();
EPD_W21_WriteCMD(0x4D);
EPD_W21_WriteDATA(0x55);
EPD_W21_WriteCMD(0xA6);
EPD_W21_WriteDATA(0x38);
EPD_W21_WriteCMD(0xB4);
EPD_W21_WriteDATA(0x5D);
EPD_W21_WriteCMD(0xB6);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0xB7);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0xF7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteCMD2(0xAE);
EPD_W21_WriteDATA2(0xA0);
EPD_W21_WriteCMD(0xE0);
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x00);//Panel setting
EPD_W21_WriteDATA(0x9F);
EPD_W21_WriteDATA(0x0D);
EPD_W21_WriteCMD(0x06);//boost
EPD_W21_WriteDATA(0x57);
EPD_W21_WriteDATA(0x24);
EPD_W21_WriteDATA(0x28);
EPD_W21_WriteDATA(0x32);
EPD_W21_WriteDATA(0x08);
EPD_W21_WriteDATA(0x48);
EPD_W21_WriteCMD(0x61);//resolution setting
EPD_W21_WriteDATA(0X02);//680 1360*480
EPD_W21_WriteDATA(0XA8);
EPD_W21_WriteDATA(0X01);//480
EPD_W21_WriteDATA(0XE0);
EPD_W21_WriteCMD(0x62);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x60);
EPD_W21_WriteDATA(0x31);
EPD_W21_WriteCMD(0x50);//VCOM and DATA interval setting(CDI)
EPD_W21_WriteDATA(0x97);
EPD_W21_WriteCMD(0xE8);
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x04); //power on
delay(200);
lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal
}
void EPD_Init_Part(void)
{
delay(100);//At least 100ms delay
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10);//At least 10ms delay
lcd_chkstatus();
EPD_W21_WriteCMD(0x4D);
EPD_W21_WriteDATA(0x55);
EPD_W21_WriteCMD(0xA6);
EPD_W21_WriteDATA(0x38);
EPD_W21_WriteCMD(0xB4);
EPD_W21_WriteDATA(0x5D);
EPD_W21_WriteCMD(0xB6);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0xB7);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0xF7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteCMD2(0xAE);
EPD_W21_WriteDATA2(0xA0);
EPD_W21_WriteCMD(0xE0);
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x00);//Panel setting
EPD_W21_WriteDATA(0x9F);
EPD_W21_WriteDATA(0x0D);
EPD_W21_WriteCMD(0x06);//boost
EPD_W21_WriteDATA(0x57);
EPD_W21_WriteDATA(0x24);
EPD_W21_WriteDATA(0x28);
EPD_W21_WriteDATA(0x32);
EPD_W21_WriteDATA(0x08);
EPD_W21_WriteDATA(0x48);
EPD_W21_WriteCMD(0x61);//resolution setting
EPD_W21_WriteDATA(0X02);//680 1360*480
EPD_W21_WriteDATA(0XA8);
EPD_W21_WriteDATA(0X01);//480
EPD_W21_WriteDATA(0XE0);
EPD_W21_WriteCMD(0x62);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x82); // VCOM DC Setting
EPD_W21_WriteDATA(0x12); // 1-0=11: internal power
EPD_W21_WriteCMD(0x60);
EPD_W21_WriteDATA(0x31);
EPD_W21_WriteCMD(0x50); // VCOM and DATA interval setting
EPD_W21_WriteDATA(0x97);
EPD_W21_WriteCMD(0x50); // VCOM and DATA interval setting
EPD_W21_WriteDATA(0x97);
EPD_W21_WriteCMD(0xE0);
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0xE5); //100du
EPD_W21_WriteDATA(0x64);
EPD_W21_WriteCMD(0x04); //POWER ON
delay(100);
lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal
}
void EPD_DeepSleep(void)
{
EPD_W21_WriteCMD(0x02); //power off
delay(100);
lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0X07); //deep sleep
EPD_W21_WriteDATA(0xA5);
}
//Full screen update function
void EPD_Update(void)
{
//update
EPD_W21_WriteCMD(0x12); //DISPLAY update
delay(1); //!!!The delay here is necessary, 200uS at least!!!
lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal
}
void EPD_WhiteScreen_ALL(const unsigned char *datas)
{
unsigned int i,j;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA1(datas[170*j+i]);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA2(datas[170*j+i]);}
EPD_Update();
}
void EPD_WhiteScreen_ALL180(const unsigned char *datas)
{
unsigned int i,j;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA1(datas[170*j+i]);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA2(datas[170*j+i]);}
EPD_Update();
}
void EPD_WhiteScreen_ALL_P(const unsigned char *oldDatas,const unsigned char *newDatas)
{
unsigned int i,j;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
if(partFlag==1){
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA1(0xFF);}
}
else{
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA1(oldDatas[170*j+i]);}
}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA1(newDatas[170*j+i]);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
if(partFlag==1){
partFlag=0;
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA2(0xFF);}
}
else{
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA2(oldDatas[170*j+i]);}
}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA2(newDatas[170*j+i]);}
EPD_Update();
}
void EPD_WhiteScreen_White(void)
{
unsigned int i;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_Update();
}
void EPD_WhiteScreen_Black(void)
{
unsigned int i;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0x00);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0x00);}
EPD_Update();
}
////////////////////////////////Other newly added functions////////////////////////////////////////////
//Display rotation 180 degrees initialization
void EPD_Init_180(void)
{
delay(100);//At least 10ms delay
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10);//At least 10ms delay
lcd_chkstatus();
EPD_W21_WriteCMD(0x4D);
EPD_W21_WriteDATA(0x55);
EPD_W21_WriteCMD(0xA6);
EPD_W21_WriteDATA(0x38);
EPD_W21_WriteCMD(0xB4);
EPD_W21_WriteDATA(0x5D);
EPD_W21_WriteCMD(0xB6);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0xB7);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0xF7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteCMD2(0xAE);
EPD_W21_WriteDATA2(0xA0);
EPD_W21_WriteCMD(0xE0);
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x00);//Panel setting
EPD_W21_WriteDATA(0x93);
EPD_W21_WriteDATA(0x0D);
EPD_W21_WriteCMD(0x06);//boost
EPD_W21_WriteDATA(0x57);
EPD_W21_WriteDATA(0x24);
EPD_W21_WriteDATA(0x28);
EPD_W21_WriteDATA(0x32);
EPD_W21_WriteDATA(0x08);
EPD_W21_WriteDATA(0x48);
EPD_W21_WriteCMD(0x61);//resolution setting
EPD_W21_WriteDATA(0X02);//680 1360*480
EPD_W21_WriteDATA(0XA8);
EPD_W21_WriteDATA(0X01);//480
EPD_W21_WriteDATA(0XE0);
EPD_W21_WriteCMD(0x62);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x60);
EPD_W21_WriteDATA(0x31);
EPD_W21_WriteCMD(0x50);//VCOM and DATA interval setting(CDI)
EPD_W21_WriteDATA(0x97);
EPD_W21_WriteCMD(0xE8);
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x04); //power on
delay(200);
lcd_chkstatus(); //waiting for the electronic paper IC to release the idle signal
}
void EPD_Display(unsigned char *Image)
{
unsigned int i,j;
//Master
EPD_W21_WriteCMD1(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA1(0xFF);}
EPD_W21_WriteCMD1(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=0;i<85;i++){
EPD_W21_WriteDATA1(Image[170*j+i]);}
//Slave
EPD_W21_WriteCMD2(0x10); //Transfer old data
for(i=0;i<EPD_ARRAY;i++){
EPD_W21_WriteDATA2(0xFF);}
EPD_W21_WriteCMD2(0x13); //Transfer old data
for(j=0;j<480;j++)
for(i=85;i<85*2;i++){
EPD_W21_WriteDATA2(Image[170*j+i]);}
EPD_Update();
}
/***********************************************************
end file
***********************************************************/

View File

@@ -0,0 +1,24 @@
#ifndef _EPD_H_
#define _EPD_H_
#define EPD_WIDTH 1360/2
#define EPD_HEIGHT 480
#define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8
//Full screen update display
void EPD_Init(void);
void EPD_WhiteScreen_ALL(const unsigned char *datas);
void EPD_Init_180(void);
void EPD_WhiteScreen_ALL180(const unsigned char *datas);
void EPD_WhiteScreen_White(void);
void EPD_WhiteScreen_Black(void);
void EPD_DeepSleep(void);
//Partial update display
void EPD_Init_Part(void);
void EPD_WhiteScreen_ALL_P(const unsigned char *oldDatas,const unsigned char *newDatas);
//GUI display
void EPD_Display(unsigned char *Image);
#endif

View File

@@ -0,0 +1,108 @@
#include "EPD_SPI3.h"
//SPI write byte
void SPI_Delay(unsigned char xrate)
{
while(xrate--);
}
void SPI_Write(unsigned char value)
{
unsigned char i;
EPD_W21_CLK_1;
for(i=0; i<8; i++)
{
if(value & 0x80)
EPD_W21_MOSI_1;
else
EPD_W21_MOSI_0;
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Delay(1);
value = (value << 1);
}
}
//SPI write command
void EPD_W21_WriteCMD(unsigned char command)
{
EPD_W21_CS_1;
EPD_W21_CS2_1;
EPD_W21_CS_0;
EPD_W21_CS2_0;
//DC--0
EPD_W21_MOSI_0; // command write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(command);
EPD_W21_CS_1;
EPD_W21_CS2_1;
}
//SPI write data
void EPD_W21_WriteDATA(unsigned char datas)
{
EPD_W21_CS_1;
EPD_W21_CS2_1;
EPD_W21_CS_0;
EPD_W21_CS2_0;
//DC--1
EPD_W21_MOSI_1; // data write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(datas);
EPD_W21_CS_1;
EPD_W21_CS2_1;
}
void EPD_W21_WriteCMD1(unsigned char command)
{
EPD_W21_CS2_1;
EPD_W21_CS_0;
//DC--0
EPD_W21_MOSI_0; // command write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(command);
EPD_W21_CS_1;
}
void EPD_W21_WriteDATA1(unsigned char datas)
{
EPD_W21_CS2_1;
EPD_W21_CS_0;
//DC--1
EPD_W21_MOSI_1; // data write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(datas);
EPD_W21_CS_1;
}
void EPD_W21_WriteCMD2(unsigned char command)
{
EPD_W21_CS_1;
EPD_W21_CS2_0;
//DC--0
EPD_W21_MOSI_0; // command write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(command);
EPD_W21_CS2_1;
}
void EPD_W21_WriteDATA2(unsigned char datas)
{
EPD_W21_CS_1;
EPD_W21_CS2_0;
//DC--1
EPD_W21_MOSI_1; // data write
EPD_W21_CLK_0;
SPI_Delay(1);
EPD_W21_CLK_1;
SPI_Write(datas);
EPD_W21_CS2_1;
}

View File

@@ -0,0 +1,28 @@
#ifndef _EPD_SPI3_SPI_
#define _EPD_SPI3_SPI_
#include "Arduino.h"
//IO settings
#define isEPD_W21_BUSY digitalRead(A14) //BUSY
#define EPD_W21_RST_0 digitalWrite(A15,LOW) //RES
#define EPD_W21_RST_1 digitalWrite(A15,HIGH)
#define EPD_W21_CS2_0 digitalWrite(A16,LOW) //CS2
#define EPD_W21_CS2_1 digitalWrite(A16,HIGH)
#define EPD_W21_CS_0 digitalWrite(A17,LOW) //CS
#define EPD_W21_CS_1 digitalWrite(A17,HIGH)
#define EPD_W21_CLK_0 digitalWrite(18,LOW)
#define EPD_W21_CLK_1 digitalWrite(18,HIGH)
#define EPD_W21_MOSI_0 digitalWrite(23,LOW)
#define EPD_W21_MOSI_1 digitalWrite(23,HIGH)
void SPI_Write(unsigned char value);
void EPD_W21_WriteDATA(unsigned char datas);
void EPD_W21_WriteCMD(unsigned char command);
void EPD_W21_WriteDATA1(unsigned char datas);
void EPD_W21_WriteCMD1(unsigned char command);
void EPD_W21_WriteDATA2(unsigned char datas);
void EPD_W21_WriteCMD2(unsigned char command);
#endif

View File

@@ -0,0 +1,75 @@
//EPD
#include"EPD.h" //E-paper driver
#include"IMAGE.h" //E-paper image data
unsigned char ImageBW[EPD_ARRAY];//Define canvas space
void setup() {
/* ESP32-WROOM-32D (Using 3-wire SPI)
BUSY——GPIO13 RES——GPIO12 CS2——GPIO14 CS——GPIO27 SCK—GPIO18 SDIN—GPIO23 */
pinMode(A14, INPUT); //BUSY
pinMode(A15, OUTPUT); //RES
pinMode(A16, OUTPUT); //CS2
pinMode(A17, OUTPUT); //CS
pinMode(18, OUTPUT); //SCLK
pinMode(23, OUTPUT); //SDI
}
//Tips//
/*
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.
2.There will be no flicker when EPD performs a partial update.
3.Please make sue that EPD enters sleep mode when update is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD.
4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.)
5.Re-initialization is required for every full screen update.
6.When porting the program, set the BUSY pin to input mode and other pins to output mode.
*/
void loop() {
unsigned char i;
#if 1 //Full screen update, fast update, and partial update demostration.
EPD_Init(); //Full screen update initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
/************Full display(4s)*******************/
EPD_Init(); //Full screen update initialization.
EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen update.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#if 1 //Demo of using partial refresh to update the full screen, to enable this feature, please change 0 to 1.
//After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes.
//////////////////////Partial refresh time demo/////////////////////////////////////
EPD_Init(); //Full screen refresh initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_Init_Part();
EPD_WhiteScreen_ALL_P(gImage_p1,gImage_p1);
EPD_WhiteScreen_ALL_P(gImage_p1,gImage_p2);
EPD_WhiteScreen_ALL_P(gImage_p2,gImage_p3);
EPD_DeepSleep();//Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#endif
#if 1 //Demonstration of full screen update with 180-degree rotation, to enable this feature, please change 0 to 1.
/************Full display(4s)*******************/
EPD_Init_180(); //Full screen update initialization.
EPD_WhiteScreen_ALL180(gImage_1); //To Display one image using full screen update.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#endif
#endif
//Clear
EPD_Init(); //Full screen update initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
while(1); // The program stops here
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,186 @@
#include <EPD_SPI.h>
#include "EPD.h"
//Delay Functions
void delay_xms(unsigned int xms)
{
delay(xms);
}
////////////////////////////////////E-paper demo//////////////////////////////////////////////////////////
//Busy function
void Epaper_READBUSY(void)
{
while(1)
{ //=1 BUSY
if(isEPD_W21_BUSY==0) break;
}
}
//Full screen update initialization
void EPD_HW_Init(void)
{
EPD_W21_RST_0; // Module reset
delay_xms(10);//At least 10ms delay
EPD_W21_RST_1;
delay_xms(10);//At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // 0x00=black £» 0x01=white £» 0x80=VCOM £» 0xc0=HiZ£¨default£©
}
//////////////////////////////Display Update Function///////////////////////////////////////////////////////
//Full screen update function
void EPD_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0xF7);
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
Epaper_READBUSY();
}
//////////////////////////////Display Data Transfer Function////////////////////////////////////////////
//Full screen update display function
void EPD_WhiteScreen_ALL(const unsigned char *datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_W21_WriteCMD(0x26); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
//update
EPD_Update();
}
//Clear screen display
void EPD_WhiteScreen_White(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0xff);
}
EPD_W21_WriteCMD(0x26); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
//update
EPD_Update();
}
//Display all black
void EPD_WhiteScreen_Black(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
EPD_W21_WriteCMD(0x26); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
//update
EPD_Update();
}
//Deep sleep function
void EPD_DeepSleep(void)
{
EPD_W21_WriteCMD(0x10); //Enter deep sleep
EPD_W21_WriteDATA(0x01);
delay(100);
}
// GUI initialization
void EPD_HW_Init_GUI(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x0C); // Soft start setting
EPD_W21_WriteDATA(0xAE);
EPD_W21_WriteDATA(0xC7);
EPD_W21_WriteDATA(0xC3);
EPD_W21_WriteDATA(0xC0);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x01); // Set MUX as 527
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x01); //mirror
EPD_W21_WriteCMD(0x11); // Data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44);
EPD_W21_WriteDATA(0x00); // RAM x address start at 0
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0xBF); // RAM x address end at 36Fh -> 879
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0x45);
EPD_W21_WriteDATA(0xA7); // RAM y address start at 20Fh;
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00); // RAM y address end at 00h;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // LUT1, for white
EPD_W21_WriteCMD(0x18);
EPD_W21_WriteDATA(0X80);
EPD_W21_WriteCMD(0x4E);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F);
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
}
//GUI display
void EPD_Display(unsigned char *Image)
{
unsigned int Width, Height,i,j;
Width = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
Height = EPD_HEIGHT;
EPD_W21_WriteCMD(0x24);
for ( j = 0; j < Height; j++) {
for ( i = 0; i < Width; i++) {
EPD_W21_WriteDATA(Image[i + j * Width]);
}
}
EPD_W21_WriteCMD(0x26); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
EPD_Update();
}
/***********************************************************
end file
***********************************************************/

View File

@@ -0,0 +1,34 @@
#ifndef _EPD_H_
#define _EPD_H_
#define EPD_WIDTH 960
#define EPD_HEIGHT 640
#define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8
//Full screen update display
void EPD_HW_Init(void);
void EPD_HW_Init_180(void);
void EPD_WhiteScreen_ALL(const unsigned char *datas);
void EPD_WhiteScreen_White(void);
void EPD_WhiteScreen_Black(void);
void EPD_DeepSleep(void);
//Partial update display
void EPD_SetRAMValue_BaseMap(const unsigned char * datas);
void EPD_Dis_PartAll(const unsigned char * datas);
void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE);
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
);
//GUI
void EPD_HW_Init_GUI(void);
void EPD_Display(unsigned char *Image);
#endif

View File

@@ -0,0 +1,99 @@
#include<ESP32epdx.h> //E-paper SPI etc
//EPD
#include"EPD.h" //E-paper driver
#include"IMAGE.h" //E-paper image data
unsigned char ImageBW[EPD_ARRAY];//Define canvas space
void setup() {
/* ESP32-WROOM-32D (Using hardware SPI)
BUSY——GPIO13 RES——GPIO12 DC——GPIO14 CS——GPIO27 SCK—GPIO18 SDIN—GPIO23 */
pinMode(13, INPUT); //BUSY
pinMode(12, OUTPUT); //RES
pinMode(14, OUTPUT); //DC
pinMode(27, OUTPUT); //CS
//SPI
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
SPI.begin ();
}
//Tips//
/*
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.
2.There will be no flicker when EPD performs a partial update.
3.Please make sue that EPD enters sleep mode when update is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD.
4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.)
5.Re-initialization is required for every full screen update.
6.When porting the program, set the BUSY pin to input mode and other pins to output mode.
*/
void loop() {
unsigned char i;
#if 1 //Full screen update, fast update, and partial update demostration.
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
/************Full display(2s)*******************/
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen update.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#endif
#if 1 //GUI demostration.
///////////////////////////GUI///////////////////////////////////////////////////////////////////////////////////
//Data initialization settings
Paint_NewImage(ImageBW, EPD_WIDTH, EPD_HEIGHT, 0, WHITE); //Set screen size and display orientation
/**************Drawing**********************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
//Point.
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); //point 1x1.
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); //point 2x2.
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); //point 3x3.
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT); //point 4x4.
//Line.
Paint_DrawLine(20, 5, 50, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 1.
Paint_DrawLine(50, 5, 20, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 2.
//Rectangle.
Paint_DrawRectangle(20, 5, 50, 35, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow rectangle 1.
Paint_DrawRectangle(70, 5, 100, 35, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //Hollow rectangle 2.
//Circle.
Paint_DrawCircle(30, 50, 10, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow circle.
Paint_DrawCircle(80, 50, 10, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //solid circle.
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW);//display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
/***********String&Number***************************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK); //Font8
Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //Font12
Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //Font16
Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //Font20
Paint_DrawNum(0, 80, 123456789, &Font8, WHITE, BLACK); //Font8
Paint_DrawNum(0, 90, 123456789, &Font12, WHITE, BLACK); //Font12
Paint_DrawNum(0, 105, 123456789, &Font16, WHITE, BLACK); //Font16
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW); //display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
#endif
//Clear
EPD_HW_Init(); //EPD init
EPD_WhiteScreen_White();//EPD Clear
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
while(1); // The program stops here
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,343 @@
#include <EPD_SPI.h>
#include "EPD.h"
//Delay Functions
void delay_xms(unsigned int xms)
{
delay(xms);
}
////////////////////////////////////E-paper demo//////////////////////////////////////////////////////////
//Busy function
void Epaper_READBUSY(void)
{
while(1)
{ //=1 BUSY
if(isEPD_W21_BUSY==0) break;
}
}
//Full screen update initialization
void EPD_HW_Init(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x0C); // Soft start setting
EPD_W21_WriteDATA(0xAE);
EPD_W21_WriteDATA(0xC7);
EPD_W21_WriteDATA(0xC3);
EPD_W21_WriteDATA(0xC0);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x01); // Set MUX as 527
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x11); // Data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44);
EPD_W21_WriteDATA(0x00); // RAM x address start at 0
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0xBF); // RAM x address end at 36Fh -> 879
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0x45);
EPD_W21_WriteDATA(0xA7); // RAM y address start at 20Fh;
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00); // RAM y address end at 00h;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // LUT1, for white
EPD_W21_WriteCMD(0x18);
EPD_W21_WriteDATA(0X80);
EPD_W21_WriteCMD(0x4E);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F);
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
}
//////////////////////////////Display Update Function///////////////////////////////////////////////////////
//Full screen update function
void EPD_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0xF7);
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
Epaper_READBUSY();
}
//Partial update function
void EPD_Part_Update(void)
{
EPD_W21_WriteCMD(0x22); //Display Update Control
EPD_W21_WriteDATA(0xFF);
EPD_W21_WriteCMD(0x20); //Activate Display Update Sequence
Epaper_READBUSY();
}
//////////////////////////////Display Data Transfer Function////////////////////////////////////////////
//Full screen update display function
void EPD_WhiteScreen_ALL(const unsigned char *datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Update();
}
//Clear screen display
void EPD_WhiteScreen_White(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0xff);
}
EPD_Update();
}
//Display all black
void EPD_WhiteScreen_Black(void)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //write RAM for black(0)/white (1)
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(0x00);
}
EPD_Update();
}
//Partial update of background display, this function is necessary, please do not delete it!!!
void EPD_SetRAMValue_BaseMap( const unsigned char * datas)
{
unsigned int i;
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_W21_WriteCMD(0x26); //Write Black and White image to RAM
for(i=0;i<EPD_ARRAY;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Update();
}
//Partial update display
void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE)
{
unsigned int i;
unsigned int x_end,y_end;
x_start=x_start/8; //x address start
x_end=x_start+PART_LINE/8-1; //x address end
y_start=y_start; //Y address start
y_end=y_start+PART_COLUMN-1; //Y address end
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x44); // set RAM x address start/end
EPD_W21_WriteDATA(x_start); //x address start
EPD_W21_WriteDATA(x_end); //y address end
EPD_W21_WriteCMD(0x45); // set RAM y address start/end
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteDATA(y_end%256); //y address end2
EPD_W21_WriteDATA(y_end/256); //y address end1
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(x_start); //x start address
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X127;
EPD_W21_WriteDATA(y_start%256);//y address start2
EPD_W21_WriteDATA(y_start/256);//y address start1
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Part_Update();
}
//Full screen partial update display
void EPD_Dis_PartAll(const unsigned char * datas)
{
unsigned int i;
unsigned int PART_COLUMN, PART_LINE;
PART_COLUMN=EPD_HEIGHT,PART_LINE=EPD_WIDTH;
EPD_W21_RST_0; // Module reset
delay(10); //At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
EPD_Part_Update();
}
//Deep sleep function
void EPD_DeepSleep(void)
{
EPD_W21_WriteCMD(0x10); //Enter deep sleep
EPD_W21_WriteDATA(0x01);
delay(100);
}
//Partial update write address and data
void EPD_Dis_Part_RAM(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE)
{
unsigned int i;
unsigned int x_end,y_end;
x_start=x_start/8; //x address start
x_end=x_start+PART_LINE/8-1; //x address end
y_start=y_start-1; //Y address start
y_end=y_start+PART_COLUMN-1; //Y address end
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x3C); //BorderWavefrom,
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x44); // set RAM x address start/end
EPD_W21_WriteDATA(x_start); //x address start
EPD_W21_WriteDATA(x_end); //y address end
EPD_W21_WriteCMD(0x45); // set RAM y address start/end
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteDATA(y_end%256); //y address end2
EPD_W21_WriteDATA(y_end/256); //y address end1
EPD_W21_WriteCMD(0x4E); // set RAM x address count to 0;
EPD_W21_WriteDATA(x_start); //x start address
EPD_W21_WriteCMD(0x4F); // set RAM y address count to 0X127;
EPD_W21_WriteDATA(y_start%256); //y address start2
EPD_W21_WriteDATA(y_start/256); //y address start1
EPD_W21_WriteCMD(0x24); //Write Black and White image to RAM
for(i=0;i<PART_COLUMN*PART_LINE/8;i++)
{
EPD_W21_WriteDATA(datas[i]);
}
}
//Clock display
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
)
{
EPD_Dis_Part_RAM(x_startA,y_startA,datasA,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startB,y_startB,datasB,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startC,y_startC,datasC,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startD,y_startD,datasD,PART_COLUMN,PART_LINE);
EPD_Dis_Part_RAM(x_startE,y_startE,datasE,PART_COLUMN,PART_LINE);
EPD_Part_Update();
}
// GUI initialization
void EPD_HW_Init_GUI(void)
{
EPD_W21_RST_0; // Module reset
delay(10);//At least 10ms delay
EPD_W21_RST_1;
delay(10); //At least 10ms delay
EPD_W21_WriteCMD(0x12); //SWRESET
Epaper_READBUSY(); //waiting for the electronic paper IC to release the idle signal
EPD_W21_WriteCMD(0x0C); // Soft start setting
EPD_W21_WriteDATA(0xAE);
EPD_W21_WriteDATA(0xC7);
EPD_W21_WriteDATA(0xC3);
EPD_W21_WriteDATA(0xC0);
EPD_W21_WriteDATA(0x80);
EPD_W21_WriteCMD(0x01); // Set MUX as 527
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x01); //mirror
EPD_W21_WriteCMD(0x11); // Data entry mode
EPD_W21_WriteDATA(0x01);
EPD_W21_WriteCMD(0x44);
EPD_W21_WriteDATA(0x00); // RAM x address start at 0
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0xBF); // RAM x address end at 36Fh -> 879
EPD_W21_WriteDATA(0x03);
EPD_W21_WriteCMD(0x45);
EPD_W21_WriteDATA(0xA7); // RAM y address start at 20Fh;
EPD_W21_WriteDATA(0x02);
EPD_W21_WriteDATA(0x00); // RAM y address end at 00h;
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x3C); // VBD
EPD_W21_WriteDATA(0x01); // LUT1, for white
EPD_W21_WriteCMD(0x18);
EPD_W21_WriteDATA(0X80);
EPD_W21_WriteCMD(0x4E);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteDATA(0x00);
EPD_W21_WriteCMD(0x4F);
EPD_W21_WriteDATA(0xA7);
EPD_W21_WriteDATA(0x02);
}
//GUI display
void EPD_Display(unsigned char *Image)
{
unsigned int Width, Height,i,j;
Width = (EPD_WIDTH % 8 == 0)? (EPD_WIDTH / 8 ): (EPD_WIDTH / 8 + 1);
Height = EPD_HEIGHT;
EPD_W21_WriteCMD(0x24);
for ( j = 0; j < Height; j++) {
for ( i = 0; i < Width; i++) {
EPD_W21_WriteDATA(Image[i + j * Width]);
}
}
EPD_Update();
}
/***********************************************************
end file
***********************************************************/

View File

@@ -0,0 +1,34 @@
#ifndef _EPD_H_
#define _EPD_H_
#define EPD_WIDTH 960
#define EPD_HEIGHT 680
#define EPD_ARRAY EPD_WIDTH*EPD_HEIGHT/8
//Full screen update display
void EPD_HW_Init(void);
void EPD_HW_Init_180(void);
void EPD_WhiteScreen_ALL(const unsigned char *datas);
void EPD_WhiteScreen_White(void);
void EPD_WhiteScreen_Black(void);
void EPD_DeepSleep(void);
//Partial update display
void EPD_SetRAMValue_BaseMap(const unsigned char * datas);
void EPD_Dis_PartAll(const unsigned char * datas);
void EPD_Dis_Part(unsigned int x_start,unsigned int y_start,const unsigned char * datas,unsigned int PART_COLUMN,unsigned int PART_LINE);
void EPD_Dis_Part_Time(unsigned int x_startA,unsigned int y_startA,const unsigned char * datasA,
unsigned int x_startB,unsigned int y_startB,const unsigned char * datasB,
unsigned int x_startC,unsigned int y_startC,const unsigned char * datasC,
unsigned int x_startD,unsigned int y_startD,const unsigned char * datasD,
unsigned int x_startE,unsigned int y_startE,const unsigned char * datasE,
unsigned int PART_COLUMN,unsigned int PART_LINE
);
//GUI
void EPD_HW_Init_GUI(void);
void EPD_Display(unsigned char *Image);
#endif

View File

@@ -0,0 +1,115 @@
#include<ESP32epdx.h> //E-paper SPI etc
//EPD
#include"EPD.h" //E-paper driver
#include"IMAGE.h" //E-paper image data
unsigned char ImageBW[EPD_ARRAY];//Define canvas space
void setup() {
/* ESP32-WROOM-32D (Using hardware SPI)
BUSY——GPIO13 RES——GPIO12 DC——GPIO14 CS——GPIO27 SCK—GPIO18 SDIN—GPIO23 */
pinMode(13, INPUT); //BUSY
pinMode(12, OUTPUT); //RES
pinMode(14, OUTPUT); //DC
pinMode(27, OUTPUT); //CS
//SPI
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
SPI.begin ();
}
//Tips//
/*
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.
2.There will be no flicker when EPD performs a partial update.
3.Please make sue that EPD enters sleep mode when update is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD.
4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.)
5.Re-initialization is required for every full screen update.
6.When porting the program, set the BUSY pin to input mode and other pins to output mode.
*/
void loop() {
unsigned char i;
#if 1 //Full screen update, fast update, and partial update demostration.
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_White(); //Clear screen function.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
/************Full display(2s)*******************/
EPD_HW_Init(); //Full screen update initialization.
EPD_WhiteScreen_ALL(gImage_1); //To Display one image using full screen update.
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#if 1 //Partial update demostration.
//Partial update demo support displaying a clock at 5 locations with 00:00. If you need to perform partial update more than 5 locations, please use the feature of using partial update at the full screen demo.
//After 5 partial updatees, implement a full screen update to clear the ghosting caused by partial updatees.
//////////////////////Partial update time demo/////////////////////////////////////
EPD_HW_Init(); //Electronic paper initialization.
EPD_SetRAMValue_BaseMap(gImage_basemap); //Please do not delete the background color function, otherwise it will cause unstable display during partial update.
for(i=0;i<6;i++)
EPD_Dis_Part_Time( 696+32*1,272,(unsigned char *)&Num[1], //x-A,y-A,DATA-A
696+32*2,272,(unsigned char *)&Num[0], //x-B,y-B,DATA-B
696+32*3,272,(unsigned char *)gImage_numdot, //x-C,y-C,DATA-C
696+32*4,272,(unsigned char *)&Num[0], //x-D,y-D,DATA-D
696+32*5,272,(unsigned char *)&Num[i],32,64); //x-E,y-E,DATA-E,Resolution 32*64
EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen.
delay(2000); //Delay for 2s.
#endif
#endif
#if 1 //GUI demostration.
///////////////////////////GUI///////////////////////////////////////////////////////////////////////////////////
//Data initialization settings
Paint_NewImage(ImageBW, EPD_WIDTH, EPD_HEIGHT, 0, WHITE); //Set screen size and display orientation
/**************Drawing**********************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
//Point.
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); //point 1x1.
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); //point 2x2.
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); //point 3x3.
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT); //point 4x4.
//Line.
Paint_DrawLine(20, 5, 50, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 1.
Paint_DrawLine(50, 5, 20, 35, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_1X1); //1x1line 2.
//Rectangle.
Paint_DrawRectangle(20, 5, 50, 35, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow rectangle 1.
Paint_DrawRectangle(70, 5, 100, 35, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //Hollow rectangle 2.
//Circle.
Paint_DrawCircle(30, 50, 10, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1); //Hollow circle.
Paint_DrawCircle(80, 50, 10, BLACK, DRAW_FILL_FULL, DOT_PIXEL_1X1); //solid circle.
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW);//display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
/***********String&Number***************************/
Paint_SelectImage(ImageBW);//Set the virtual canvas data storage location
Paint_Clear(WHITE);
Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK); //Font8
Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //Font12
Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //Font16
Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //Font20
Paint_DrawNum(0, 80, 123456789, &Font8, WHITE, BLACK); //Font8
Paint_DrawNum(0, 90, 123456789, &Font12, WHITE, BLACK); //Font12
Paint_DrawNum(0, 105, 123456789, &Font16, WHITE, BLACK); //Font16
EPD_HW_Init_GUI(); //EPD init GUI
EPD_Display(ImageBW); //display image
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
#endif
//Clear
EPD_HW_Init(); //EPD init
EPD_WhiteScreen_White();//EPD Clear
EPD_DeepSleep();//EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!!
delay(2000); //2s
while(1); // The program stops here
}

File diff suppressed because it is too large Load Diff