Speed up the refresh of some screens (experimental)(1.54 v2、2.13 v3、2.9 v2、7.5 v2)

This commit is contained in:
SSYYL 2021-07-15 15:11:46 +08:00
parent b36cfab0ea
commit 452880de52
16 changed files with 432 additions and 74 deletions

View file

@ -14,7 +14,7 @@ JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.
DEBUG = -D DEBUG
USELIB_RPI = USE_BCM2835_LIB
# USELIB_RPI = USE_WIRINGPI_LIB
#USELIB_RPI = USE_WIRINGPI_LIB
# USELIB_RPI = USE_DEV_LIB
LIB_RPI=-Wl,--gc-sections

View file

@ -29,6 +29,7 @@
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in7.h"
#include <time.h>
int EPD_2in7_test(void)
{
@ -39,8 +40,12 @@ int EPD_2in7_test(void)
printf("e-Paper Init and Clear...\r\n");
EPD_2IN7_Init();
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_2IN7_Clear();
DEV_Delay_ms(500);
clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
//Create a new image cache
UBYTE *BlackImage;

View file

@ -91,26 +91,25 @@ int EPD_5in65f_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(300, 0, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 20, "ÄãºÃabc", &Font12CN, EPD_5IN65F_GREEN, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 40, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLUE, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 60, "ÄãºÃabc", &Font12CN, EPD_5IN65F_RED, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 80, "ÄãºÃabc", &Font12CN, EPD_5IN65F_YELLOW, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 100, "ÄãºÃabc", &Font12CN, EPD_5IN65F_ORANGE, EPD_5IN65F_WHITE);
Paint_DrawString_CN(150, 0, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 40, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_GREEN, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLUE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 120, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_RED, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 160, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_YELLOW, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 200, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_ORANGE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 240, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLACK, EPD_5IN65F_YELLOW);
Paint_DrawString_CN(300, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 20, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_GREEN, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 40, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_BLUE, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 60, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_RED, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 80, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_YELLOW, EPD_5IN65F_WHITE);
Paint_DrawString_CN(300, 100, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_ORANGE, EPD_5IN65F_WHITE);
Paint_DrawString_CN(150, 0, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 40, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_GREEN, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 80, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_BLUE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 120, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_RED, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 160, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_YELLOW, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 200, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_ORANGE, EPD_5IN65F_BLACK);
Paint_DrawString_CN(150, 240, "΢ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_BLACK, EPD_5IN65F_YELLOW);
EPD_5IN65F_Display(BlackImage);
DEV_Delay_ms(4000);
#endif
printf("e-Paper Clear...\r\n");
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
DEV_Delay_ms(1000);
printf("e-Paper Sleep...\r\n");

View file

@ -30,14 +30,14 @@
#include "EPD_1in54_V2.h"
#include "Debug.h"
const unsigned char WF_PARTIAL_1IN54[159] =
const unsigned char WF_PARTIAL_1IN54_0[159] =
{
0x0,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0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0x0,0x32,0x20,
};
/******************************************************************************
function : Software reset
parameter:
@ -101,7 +124,7 @@ static void EPD_1IN54_V2_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
DEV_Delay_ms(10);
DEV_Delay_ms(1);
}
Debug("e-Paper busy release\r\n");
}
@ -113,7 +136,7 @@ parameter:
static void EPD_1IN54_V2_TurnOnDisplay(void)
{
EPD_1IN54_V2_SendCommand(0x22);
EPD_1IN54_V2_SendData(0xF7);
EPD_1IN54_V2_SendData(0xc7);
EPD_1IN54_V2_SendCommand(0x20);
EPD_1IN54_V2_ReadBusy();
}
@ -125,19 +148,38 @@ parameter:
static void EPD_1IN54_V2_TurnOnDisplayPart(void)
{
EPD_1IN54_V2_SendCommand(0x22);
EPD_1IN54_V2_SendData(0xFF);
EPD_1IN54_V2_SendData(0xcF);
EPD_1IN54_V2_SendCommand(0x20);
EPD_1IN54_V2_ReadBusy();
}
static void EPD_1IN54_V2_SetLut(void)
static void EPD_1IN54_V2_Lut(UBYTE *lut)
{
EPD_1IN54_V2_SendCommand(0x32);
for(UBYTE i=0; i<153; i++)
EPD_1IN54_V2_SendData(WF_PARTIAL_1IN54[i]);
EPD_1IN54_V2_SendData(lut[i]);
EPD_1IN54_V2_ReadBusy();
}
static void EPD_1IN54_V2_SetLut(UBYTE *lut)
{
EPD_1IN54_V2_Lut(lut);
EPD_1IN54_V2_SendCommand(0x3f);
EPD_1IN54_V2_SendData(lut[153]);
EPD_1IN54_V2_SendCommand(0x03);
EPD_1IN54_V2_SendData(lut[154]);
EPD_1IN54_V2_SendCommand(0x04);
EPD_1IN54_V2_SendData(lut[155]);
EPD_1IN54_V2_SendData(lut[156]);
EPD_1IN54_V2_SendData(lut[157]);
EPD_1IN54_V2_SendCommand(0x2c);
EPD_1IN54_V2_SendData(lut[158]);
}
static void EPD_1IN54_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{
EPD_1IN54_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
@ -211,6 +253,40 @@ void EPD_1IN54_V2_Init(void)
EPD_1IN54_V2_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register (Partial display)
parameter:
******************************************************************************/
void EPD_1IN54_V2_Init_Partial(void)
{
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(5);
EPD_1IN54_V2_ReadBusy();
EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_0);
EPD_1IN54_V2_SendCommand(0x37);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x40);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
EPD_1IN54_V2_SendData(0x80);
EPD_1IN54_V2_SendCommand(0x22);
EPD_1IN54_V2_SendData(0xc0);
EPD_1IN54_V2_SendCommand(0x20);
EPD_1IN54_V2_ReadBusy();
}
/******************************************************************************
function : Clear screen
parameter:
@ -283,7 +359,7 @@ void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image)
EPD_1IN54_V2_SendData(Image[Addr]);
}
}
EPD_1IN54_V2_TurnOnDisplayPart();
EPD_1IN54_V2_TurnOnDisplay();
}
/******************************************************************************
@ -295,27 +371,6 @@ void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
UWORD Width, Height;
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
Height = EPD_1IN54_V2_HEIGHT;
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(5);
EPD_1IN54_V2_SetLut();
EPD_1IN54_V2_SendCommand(0x37);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x40);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendData(0x00);
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
EPD_1IN54_V2_SendData(0x80);
UDOUBLE Addr = 0;
EPD_1IN54_V2_SendCommand(0x24);

View file

@ -37,6 +37,7 @@
#define EPD_1IN54_V2_HEIGHT 200
void EPD_1IN54_V2_Init(void);
void EPD_1IN54_V2_Init_Partial(void);
void EPD_1IN54_V2_Clear(void);
void EPD_1IN54_V2_Display(UBYTE *Image);
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);

View file

@ -31,6 +31,52 @@
#include "EPD_2in13_V3.h"
#include "Debug.h"
UBYTE WF_PARTIAL_2IN13_V2[159] =
{
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
0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0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
};
/******************************************************************************
function : Software reset
parameter:
@ -95,7 +141,7 @@ parameter:
static void EPD_2in13_V3_TurnOnDisplay(void)
{
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
EPD_2in13_V3_SendData(0xF7);
EPD_2in13_V3_SendData(0xc7);
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
}
@ -103,11 +149,36 @@ static void EPD_2in13_V3_TurnOnDisplay(void)
static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
{
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
EPD_2in13_V3_SendData(0xFF);
EPD_2in13_V3_SendData(0x0f); // c0/ff
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
}
static void EPD_2IN13_V3_LUT(UBYTE *lut)
{
UBYTE count;
EPD_2in13_V3_SendCommand(0x32);
for(count=0; count<153; count++)
EPD_2in13_V3_SendData(lut[count]);
EPD_2in13_V3_ReadBusy();
}
static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
{
EPD_2IN13_V3_LUT((UBYTE *)lut); //lut
EPD_2in13_V3_SendCommand(0x3f);
EPD_2in13_V3_SendData(*(lut+153));
EPD_2in13_V3_SendCommand(0x03); // gate voltage
EPD_2in13_V3_SendData(*(lut+154));
EPD_2in13_V3_SendCommand(0x04); // source voltage
EPD_2in13_V3_SendData(*(lut+155)); // VSH
EPD_2in13_V3_SendData(*(lut+156)); // VSH2
EPD_2in13_V3_SendData(*(lut+157)); // VSL
EPD_2in13_V3_SendCommand(0x2c); // VCOM
EPD_2in13_V3_SendData(*(lut+158));
}
/******************************************************************************
function : Setting the display window
parameter:
@ -178,6 +249,8 @@ void EPD_2in13_V3_Init(void)
EPD_2in13_V3_SetCursor(0, 0);
EPD_2in13_V3_ReadBusy();
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V2);
}
/******************************************************************************
@ -233,12 +306,31 @@ void EPD_2in13_V3_Display_Partial(UBYTE *Image)
//Reset
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(5);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
DEV_Delay_ms(3);
EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V2);
EPD_2in13_V3_SendCommand(0x37);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x40); ///RAM Ping-Pong enable
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendData(0x00);
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
EPD_2in13_V3_SendData(0x80);
EPD_2in13_V3_SendCommand(0x22); //Display Update Sequence Option
EPD_2in13_V3_SendData(0xC0); // Enable clock and Enable analog
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
EPD_2in13_V3_ReadBusy();
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1);
EPD_2in13_V3_SetCursor(0, 0);

View file

@ -54,6 +54,29 @@ UBYTE _WF_PARTIAL_2IN9[159] =
0x22,0x17,0x41,0xB0,0x32,0x36,
};
UBYTE WS_20_30[159] =
{
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x14, 0x8, 0x0, 0x0, 0x0, 0x0, 0x1,
0xA, 0xA, 0x0, 0xA, 0xA, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x14, 0x8, 0x0, 0x1, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x0, 0x0, 0x0,
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
};
/******************************************************************************
function : Software reset
parameter:
@ -61,11 +84,11 @@ parameter:
static void EPD_2IN9_V2_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Delay_ms(10);
}
/******************************************************************************
@ -111,15 +134,31 @@ void EPD_2IN9_V2_ReadBusy(void)
Debug("e-Paper busy release\r\n");
}
static void EPD_2IN9_V2_LUT(void)
static void EPD_2IN9_V2_LUT(UBYTE *lut)
{
UBYTE count;
EPD_2IN9_V2_SendCommand(0x32);
for(count=0; count<153; count++)
EPD_2IN9_V2_SendData(_WF_PARTIAL_2IN9[count]);
EPD_2IN9_V2_SendData(lut[count]);
EPD_2IN9_V2_ReadBusy();
}
static void EPD_2IN9_V2_LUT_by_host(UBYTE *lut)
{
EPD_2IN9_V2_LUT((UBYTE *)lut); //lut
EPD_2IN9_V2_SendCommand(0x3f);
EPD_2IN9_V2_SendData(*(lut+153));
EPD_2IN9_V2_SendCommand(0x03); // gate voltage
EPD_2IN9_V2_SendData(*(lut+154));
EPD_2IN9_V2_SendCommand(0x04); // source voltage
EPD_2IN9_V2_SendData(*(lut+155)); // VSH
EPD_2IN9_V2_SendData(*(lut+156)); // VSH2
EPD_2IN9_V2_SendData(*(lut+157)); // VSL
EPD_2IN9_V2_SendCommand(0x2c); // VCOM
EPD_2IN9_V2_SendData(*(lut+158));
}
/******************************************************************************
function : Turn On Display
parameter:
@ -127,7 +166,7 @@ parameter:
static void EPD_2IN9_V2_TurnOnDisplay(void)
{
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
EPD_2IN9_V2_SendData(0xF7);
EPD_2IN9_V2_SendData(0xc7);
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
EPD_2IN9_V2_ReadBusy();
}
@ -200,6 +239,8 @@ void EPD_2IN9_V2_Init(void)
EPD_2IN9_V2_SetCursor(0, 0);
EPD_2IN9_V2_ReadBusy();
EPD_2IN9_V2_LUT_by_host(WS_20_30);
}
/******************************************************************************
@ -209,6 +250,7 @@ parameter:
void EPD_2IN9_V2_Clear(void)
{
UWORD i;
EPD_2IN9_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
for(i=0;i<4736;i++)
{
@ -255,11 +297,11 @@ void EPD_2IN9_V2_Display_Partial(UBYTE *Image)
//Reset
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(5);
DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
DEV_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0x40, 0xF, 0xF, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
};
UBYTE LUT_BB_7IN5_V2[]={
0x80, 0xF, 0xF, 0x0, 0x0, 0x1,
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
0x40, 0xF, 0xF, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
};
UBYTE lut_vcomDC_7IN5_V2[] ={
0x00, 0x15, 0x19, 0x00, 0x00, 0x01,
0x00, 0x19, 0x01, 0x19, 0x01, 0x02,
0x00, 0x06, 0x01, 0x05, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
UBYTE lut_ww_7IN5_V2[] ={
0x04, 0x14, 0x01, 0x18, 0x01, 0x01,
0x84, 0x19, 0x01, 0x19, 0x01, 0x02,
0x80, 0x06, 0x01, 0x05, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
UBYTE lut_bw_7IN5_V2[] ={
0x04, 0x14, 0x01, 0x18, 0x01, 0x01,
0x84, 0x19, 0x01, 0x19, 0x01, 0x02,
0x80, 0x06, 0x01, 0x05, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
UBYTE lut_wb_7IN5_V2[] ={
0x80, 0x14, 0x01, 0x18, 0x01, 0x01,
0x84, 0x19, 0x01, 0x19, 0x01, 0x02,
0x04, 0x06, 0x01, 0x05, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
UBYTE lut_bb_7IN5_V2[] ={
0x80, 0x14, 0x01, 0x18, 0x01, 0x01,
0x84, 0x19, 0x01, 0x19, 0x01, 0x02,
0x04, 0x06, 0x01, 0x05, 0x01, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/******************************************************************************
function : Software reset
parameter:
@ -38,11 +157,11 @@ parameter:
static void EPD_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Delay_ms(20);
}
/******************************************************************************
@ -79,20 +198,43 @@ static void EPD_WaitUntilIdle(void)
{
Debug("e-Paper busy\r\n");
do{
EPD_SendCommand(0x71);
DEV_Delay_ms(20);
DEV_Delay_ms(5);
}while(!(DEV_Digital_Read(EPD_BUSY_PIN)));
DEV_Delay_ms(20);
DEV_Delay_ms(5);
Debug("e-Paper busy release\r\n");
}
static void EPD_7IN5_V2_LUT(UBYTE* lut_vcom, UBYTE* lut_ww, UBYTE* lut_bw, UBYTE* lut_wb, UBYTE* lut_bb)
{
UBYTE count;
EPD_SendCommand(0x20); //VCOM
for(count=0; count<60; count++)
EPD_SendData(lut_vcom[count]);
EPD_SendCommand(0x21); //LUTBW
for(count=0; count<60; count++)
EPD_SendData(lut_ww[count]);
EPD_SendCommand(0x22); //LUTBW
for(count=0; count<60; count++)
EPD_SendData(lut_bw[count]);
EPD_SendCommand(0x23); //LUTWB
for(count=0; count<60; count++)
EPD_SendData(lut_wb[count]);
EPD_SendCommand(0x24); //LUTBB
for(count=0; count<60; count++)
EPD_SendData(lut_bb[count]);
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_7IN5_V2_TurnOnDisplay(void)
{
{
EPD_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(100); //!!!The delay here is necessary, 200uS at least!!!
EPD_WaitUntilIdle();
@ -106,18 +248,37 @@ UBYTE EPD_7IN5_V2_Init(void)
{
EPD_Reset();
EPD_SendCommand(0x01); //POWER SETTING
EPD_SendData(0x07);
EPD_SendData(0x07); //VGH=20V,VGL=-20V
EPD_SendData(0x3f); //VDH=15V
EPD_SendData(0x3f); //VDL=-15V
// EPD_SendCommand(0x01); //POWER SETTING
// EPD_SendData(0x07);
// EPD_SendData(0x07); //VGH=20V,VGL=-20V
// EPD_SendData(0x3f); //VDH=15V
// EPD_SendData(0x3f); //VDL=-15V
EPD_SendCommand(0x01); // power setting
EPD_SendData(0x17); // 1-0=11: internal power
EPD_SendData(*(Voltage_Frame_7IN5_V2+6)); // VGH&VGL
EPD_SendData(*(Voltage_Frame_7IN5_V2+1)); // VSH
EPD_SendData(*(Voltage_Frame_7IN5_V2+2)); // VSL
EPD_SendData(*(Voltage_Frame_7IN5_V2+3)); // VSHR
EPD_SendCommand(0x82); // VCOM DC Setting
EPD_SendData(*(Voltage_Frame_7IN5_V2+4)); // VCOM
EPD_SendCommand(0x06); // Booster Setting
EPD_SendData(0x27);
EPD_SendData(0x27);
EPD_SendData(0x2F);
EPD_SendData(0x17);
EPD_SendCommand(0x30); // OSC Setting
EPD_SendData(*(Voltage_Frame_7IN5_V2+0)); // 2-0=100: N=4 ; 5-3=111: M=7 ; 3C=50Hz 3A=100HZ
EPD_SendCommand(0x04); //POWER ON
DEV_Delay_ms(100);
EPD_WaitUntilIdle();
EPD_SendCommand(0X00); //PANNEL SETTING
EPD_SendData(0x1F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
EPD_SendData(0x3F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
EPD_SendCommand(0x61); //tres
EPD_SendData(0x03); //source 800
@ -141,6 +302,8 @@ UBYTE EPD_7IN5_V2_Init(void)
EPD_SendData(0x00);
EPD_SendData(0x00);
EPD_7IN5_V2_LUT(LUT_VCOM_7IN5_V2, LUT_WW_7IN5_V2, LUT_BW_7IN5_V2, LUT_WB_7IN5_V2, LUT_BB_7IN5_V2);
return 0;
}
@ -193,7 +356,7 @@ void EPD_7IN5_V2_Display(const UBYTE *blackimage)
UDOUBLE Width, Height;
Width =(EPD_7IN5_V2_WIDTH % 8 == 0)?(EPD_7IN5_V2_WIDTH / 8 ):(EPD_7IN5_V2_WIDTH / 8 + 1);
Height = EPD_7IN5_V2_HEIGHT;
EPD_SendCommand(0x10);
for (UDOUBLE j = 0; j < Height; j++) {
for (UDOUBLE i = 0; i < Width; i++) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

View file

@ -41,6 +41,7 @@ try:
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
draw.rectangle((80, 50, 130, 100), fill = 0)
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
# Himage = Himage.transpose(method=Image.ROTATE_180)
epd.display(epd.getbuffer(Himage))
time.sleep(2)

View file

@ -36,7 +36,7 @@ try:
drawblack = ImageDraw.Draw(HBlackimage)
drawry = ImageDraw.Draw(HRYimage)
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
drawblack.text((10, 20), '5.83inch e-Paper bc', font = font24, fill = 0)
drawblack.text((10, 20), '5.83inch e-Paper b V2', font = font24, fill = 0)
drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0)
drawblack.line((20, 50, 70, 100), fill = 0)
drawblack.line((70, 50, 20, 100), fill = 0)
@ -57,7 +57,7 @@ try:
drawry = ImageDraw.Draw(LRYimage)
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
drawblack.text((2, 20), '5.83inch epd bc', font = font18, fill = 0)
drawblack.text((2, 20), '5.83inch epd b V2', font = font18, fill = 0)
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
drawblack.line((10, 90, 60, 140), fill = 0)
drawblack.line((60, 90, 10, 140), fill = 0)

View file

@ -67,8 +67,8 @@ try:
time.sleep(2)
logging.info("3.read bmp file")
Himage = Image.open(os.path.join(picdir, '7in5_V2_r.bmp'))
Himage_Other = Image.open(os.path.join(picdir, '7in5_V2_b.bmp'))
Himage = Image.open(os.path.join(picdir, '7in5_V2_b.bmp'))
Himage_Other = Image.open(os.path.join(picdir, '7in5_V2_r.bmp'))
epd.display(epd.getbuffer(Himage),epd.getbuffer(Himage_Other))
time.sleep(2)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB