Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
bb0a2b209a
651 changed files with 24869 additions and 12505 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -29,6 +29,7 @@
|
|||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2.h"
|
||||
#include <string.h>
|
||||
|
||||
int EPD_4in2_test(void)
|
||||
{
|
||||
|
|
@ -51,9 +52,10 @@ int EPD_4in2_test(void)
|
|||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 180, WHITE);
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 1 // show bmp
|
||||
#if 0 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
@ -68,7 +70,7 @@ int EPD_4in2_test(void)
|
|||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
@ -77,7 +79,7 @@ int EPD_4in2_test(void)
|
|||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
#if 0 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
|
@ -105,17 +107,104 @@ int EPD_4in2_test(void)
|
|||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
#if 0
|
||||
printf("Partial refresh\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_4IN2_PartialDisplay(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2_Clear();
|
||||
|
||||
EPD_4IN2_Init_4Gray();
|
||||
printf("show Gray------------------------\r\n");
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 4 ): (EPD_4IN2_WIDTH / 4 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
#if 1
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(140, 0, "ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(140, 40, "ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(140, 80, "ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(140, 120, "ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
|
||||
Paint_DrawString_CN(220, 0, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(220, 40, "΢ѩµç×Ó", &Font24CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(220, 80, "΢ѩµç×Ó", &Font24CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(220, 120, "΢ѩµç×Ó", &Font24CN, GRAY4, GRAY1);
|
||||
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
#if 1
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2_4GrayDisplay(gImage_4in2_4Gray1);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
GUI_ReadBmp_4Gray("./pic/4in2_Scale.bmp",0 , 0);
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 20, 20);
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
EPD_4IN2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
|
|
|||
|
|
@ -45,17 +45,17 @@ int EPD_5in83bc_test(void)
|
|||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_5IN83BC_WIDTH % 8 == 0)? (EPD_5IN83BC_WIDTH / 8 ): (EPD_5IN83BC_WIDTH / 8 + 1)) * EPD_5IN83BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(BlackImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5IN83BC_WIDTH, EPD_5IN83BC_HEIGHT, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -58,6 +58,8 @@ extern const unsigned char gImage_2in13c_y[];
|
|||
extern const unsigned char gImage_2in13d[];
|
||||
|
||||
extern const unsigned char gImage_4in2[];
|
||||
extern const unsigned char gImage_4in2_4Gray[];
|
||||
extern const unsigned char gImage_4in2_4Gray1[];
|
||||
extern const unsigned char gImage_4in2bc_b[];
|
||||
extern const unsigned char gImage_4in2bc_ry[];
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ int main(void)
|
|||
// EPD_1in54b_test();
|
||||
// EPD_1in54c_test();
|
||||
|
||||
EPD_2in7_test();
|
||||
// EPD_2in7_test();
|
||||
// EPD_2in7b_test();
|
||||
|
||||
// EPD_2in9_test();
|
||||
|
|
@ -37,7 +37,7 @@ int main(void)
|
|||
// EPD_2in13bc_test();
|
||||
// EPD_2in13d_test();
|
||||
|
||||
// EPD_4in2_test();
|
||||
EPD_4in2_test();
|
||||
// EPD_4in2bc_test();
|
||||
|
||||
// EPD_5in83_test();
|
||||
|
|
|
|||
|
|
@ -121,6 +121,11 @@ typedef enum {
|
|||
#define FONT_FOREGROUND BLACK
|
||||
#define FONT_BACKGROUND WHITE
|
||||
|
||||
//4 Gray level
|
||||
#define GRAY1 0x03 //Blackest
|
||||
#define GRAY2 0x02
|
||||
#define GRAY3 0x01 //gray
|
||||
#define GRAY4 0x00 //white
|
||||
/**
|
||||
* The size of the point
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -354,10 +354,6 @@ parameter:
|
|||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN13_V2_SendCommand(0x22); //POWER OFF
|
||||
EPD_2IN13_V2_SendData(0xC3);
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2IN13_V2_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
|
|
|
|||
|
|
@ -99,11 +99,7 @@
|
|||
#define EPD_2IN7_WIDTH 176
|
||||
#define EPD_2IN7_HEIGHT 264 //46464
|
||||
|
||||
//Gray level
|
||||
#define GRAY1 0x03 //Blackest
|
||||
#define GRAY2 0x02
|
||||
#define GRAY3 0x01 //gray
|
||||
#define GRAY4 0x00 //white
|
||||
|
||||
|
||||
void EPD_2IN7_Init(void);
|
||||
void EPD_2IN7_Clear(void);
|
||||
|
|
|
|||
|
|
@ -4,10 +4,31 @@
|
|||
* | Function : 4.2inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-11-14
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-11-14):
|
||||
* 1.Add 4 grayscale drive and display program
|
||||
* Add EPD_4IN2_4Gray_lut_vcom[]
|
||||
* Add EPD_4IN2_4Gray_lut_ww[]
|
||||
* Add EPD_4IN2_4Gray_lut_bw[]
|
||||
* Add EPD_4IN2_4Gray_lut_wb
|
||||
* Add EPD_4IN2_4Gray_lut_bb
|
||||
* Add EPD_4IN2_Partial_SetLut()
|
||||
* Add EPD_4IN2_4Gray_lut()
|
||||
* Add EPD_4IN2_Init_4Gray()
|
||||
* Add EPD_4IN2_4GrayDisplay(....)
|
||||
* 2.Add partial refresh display
|
||||
* Add EPD_4IN2_Partial_lut_vcom1[]
|
||||
* Add EPD_4IN2_Partial_lut_ww1[]
|
||||
* Add EPD_4IN2_Partial_lut_bw1[]
|
||||
* Add EPD_4IN2_Partial_lut_wb1[]
|
||||
* Add EPD_4IN2_Partial_lut_bb1[]
|
||||
* Add EPD_4IN2_Partial_SetLut()
|
||||
* Add EPD_4IN2_PartialDisplay(...)
|
||||
* Poor display, no display function by default
|
||||
*
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[]
|
||||
|
|
@ -137,6 +158,108 @@ static const unsigned char EPD_4IN2_lut_bb[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/******************************partial screen update LUT*********************************/
|
||||
const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={
|
||||
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
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, };
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_ww1[] ={
|
||||
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
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,};
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_bw1[] ={
|
||||
0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
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, };
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_wb1[] ={
|
||||
0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
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, };
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_bb1[] ={
|
||||
0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
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, };
|
||||
|
||||
/******************************gray*********************************/
|
||||
//0~3 gray
|
||||
const unsigned char EPD_4IN2_4Gray_lut_vcom[] =
|
||||
{
|
||||
0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
|
||||
|
||||
};
|
||||
//R21
|
||||
const unsigned char EPD_4IN2_4Gray_lut_ww[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R22H r
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bw[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R23H w
|
||||
const unsigned char EPD_4IN2_4Gray_lut_wb[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R24H b
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bb[] ={
|
||||
0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -184,7 +307,9 @@ parameter:
|
|||
void EPD_4IN2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
|
|
@ -234,6 +359,60 @@ static void EPD_4IN2_SetLut(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void EPD_4IN2_Partial_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_4IN2_SendCommand(0x20);
|
||||
for(count=0;count<44;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x21);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x22);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x23);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);}
|
||||
}
|
||||
|
||||
//LUT download
|
||||
static void EPD_4IN2_4Gray_lut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x20); //vcom
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x21); //red not use
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x22); //bw r
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x23); //wb w
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24); //bb b
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x25); //vcom
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
|
||||
}
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
|
|
@ -278,6 +457,42 @@ void EPD_4IN2_Init(void)
|
|||
EPD_4IN2_SetLut();
|
||||
}
|
||||
|
||||
void EPD_4IN2_Init_4Gray(void)
|
||||
{
|
||||
EPD_4IN2_Reset();
|
||||
EPD_4IN2_SendCommand(0x01); //POWER SETTING
|
||||
EPD_4IN2_SendData (0x03);
|
||||
EPD_4IN2_SendData (0x00); //VGH=20V,VGL=-20V
|
||||
EPD_4IN2_SendData (0x2b); //VDH=15V
|
||||
EPD_4IN2_SendData (0x2b); //VDL=-15V
|
||||
EPD_4IN2_SendData (0x13);
|
||||
|
||||
EPD_4IN2_SendCommand(0x06); //booster soft start
|
||||
EPD_4IN2_SendData (0x17); //A
|
||||
EPD_4IN2_SendData (0x17); //B
|
||||
EPD_4IN2_SendData (0x17); //C
|
||||
|
||||
EPD_4IN2_SendCommand(0x04);
|
||||
EPD_4IN2_ReadBusy();
|
||||
|
||||
EPD_4IN2_SendCommand(0x00); //panel setting
|
||||
EPD_4IN2_SendData(0x3f); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
EPD_4IN2_SendCommand(0x30); //PLL setting
|
||||
EPD_4IN2_SendData (0x3c); //100hz
|
||||
|
||||
EPD_4IN2_SendCommand(0x61); //resolution setting
|
||||
EPD_4IN2_SendData (0x01); //400
|
||||
EPD_4IN2_SendData (0x90);
|
||||
EPD_4IN2_SendData (0x01); //300
|
||||
EPD_4IN2_SendData (0x2c);
|
||||
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x12);
|
||||
|
||||
EPD_4IN2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_4IN2_SendData(0x97);
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
|
|
@ -301,7 +516,8 @@ void EPD_4IN2_Clear(void)
|
|||
EPD_4IN2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10);
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
|
@ -321,10 +537,158 @@ void EPD_4IN2_Display(UBYTE *Image)
|
|||
EPD_4IN2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_HEIGHT;
|
||||
|
||||
X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8);
|
||||
X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8);
|
||||
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0xf7);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x08);
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0x47);
|
||||
EPD_4IN2_Partial_SetLut();
|
||||
EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_4IN2_SendCommand(0x90); //resolution setting
|
||||
EPD_4IN2_SendData ((X_start)/256);
|
||||
EPD_4IN2_SendData ((X_start)%256); //x-start
|
||||
|
||||
EPD_4IN2_SendData ((X_end )/256);
|
||||
EPD_4IN2_SendData ((X_end )%256-1); //x-end
|
||||
|
||||
EPD_4IN2_SendData (Y_start/256);
|
||||
EPD_4IN2_SendData (Y_start%256); //y-start
|
||||
|
||||
EPD_4IN2_SendData (Y_end/256);
|
||||
EPD_4IN2_SendData (Y_end%256-1); //y-end
|
||||
EPD_4IN2_SendData (0x28);
|
||||
|
||||
EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming
|
||||
for (UWORD j = 0; j < Y_end - Y_start; j++) {
|
||||
for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
|
||||
EPD_4IN2_SendData(Image[(Y_start + j)*Width + X_start/8 + i]);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_SendCommand(0x13); //writes New data to SRAM.
|
||||
for (UWORD j = 0; j < Y_end - Y_start; j++) {
|
||||
for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
|
||||
EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10); //The delay here is necessary, 200uS at least!!!
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
|
||||
{
|
||||
UDOUBLE i,j,k,m;
|
||||
UBYTE temp1,temp2,temp3;
|
||||
/****Color display description****
|
||||
white gray1 gray2 black
|
||||
0x10| 01 01 00 00
|
||||
0x13| 01 00 01 00
|
||||
*********************************/
|
||||
EPD_4IN2_SendCommand(0x10);
|
||||
// EPD_4IN2_HEIGHT
|
||||
// EPD_4IN2_WIDTH
|
||||
for(m = 0; m<EPD_4IN2_HEIGHT;m++)
|
||||
for(i=0;i<EPD_4IN2_WIDTH/8;i++)
|
||||
{
|
||||
temp3=0;
|
||||
for(j=0;j<2;j++)
|
||||
{
|
||||
|
||||
temp1 = Image[(m*(EPD_4IN2_WIDTH/8)+i)*2+j];
|
||||
for(k=0;k<2;k++)
|
||||
{
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0)
|
||||
temp3 |= 0x01;//white
|
||||
else if(temp2 == 0x00)
|
||||
temp3 |= 0x00; //black
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x01; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x00; //gray2
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0) //white
|
||||
temp3 |= 0x01;
|
||||
else if(temp2 == 0x00) //black
|
||||
temp3 |= 0x00;
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x01; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x00; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
}
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
}
|
||||
// new data
|
||||
EPD_4IN2_SendCommand(0x13);
|
||||
for(m = 0; m<EPD_4IN2_HEIGHT;m++)
|
||||
for(i=0;i<EPD_4IN2_WIDTH/8;i++)
|
||||
{
|
||||
temp3=0;
|
||||
for(j=0;j<2;j++)
|
||||
{
|
||||
temp1 = Image[(m*(EPD_4IN2_WIDTH/8)+i)*2+j];
|
||||
for(k=0;k<2;k++)
|
||||
{
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0)
|
||||
temp3 |= 0x01;//white
|
||||
else if(temp2 == 0x00)
|
||||
temp3 |= 0x00; //black
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x00; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x01; //gray2
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0) //white
|
||||
temp3 |= 0x01;
|
||||
else if(temp2 == 0x00) //black
|
||||
temp3 |= 0x00;
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x00; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x01; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
}
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
}
|
||||
|
||||
EPD_4IN2_4Gray_lut();
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
|
|
|
|||
|
|
@ -4,10 +4,31 @@
|
|||
* | Function : 4.2inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-06-13
|
||||
* | This version: V3.1
|
||||
* | Date : 2019-11-14
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.1(2019-11-14):
|
||||
* 1.Add 4 grayscale drive and display program
|
||||
* Add EPD_4IN2_4Gray_lut_vcom[]
|
||||
* Add EPD_4IN2_4Gray_lut_ww[]
|
||||
* Add EPD_4IN2_4Gray_lut_bw[]
|
||||
* Add EPD_4IN2_4Gray_lut_wb
|
||||
* Add EPD_4IN2_4Gray_lut_bb
|
||||
* Add EPD_4IN2_Partial_SetLut()
|
||||
* Add EPD_4IN2_4Gray_lut()
|
||||
* Add EPD_4IN2_Init_4Gray()
|
||||
* Add EPD_4IN2_4GrayDisplay(....)
|
||||
* 2.Add partial refresh display
|
||||
* Add EPD_4IN2_Partial_lut_vcom1[]
|
||||
* Add EPD_4IN2_Partial_lut_ww1[]
|
||||
* Add EPD_4IN2_Partial_lut_bw1[]
|
||||
* Add EPD_4IN2_Partial_lut_wb1[]
|
||||
* Add EPD_4IN2_Partial_lut_bb1[]
|
||||
* Add EPD_4IN2_Partial_SetLut()
|
||||
* Add EPD_4IN2_PartialDisplay(...)
|
||||
* Poor display, no display function by default
|
||||
*
|
||||
* V3.0(2019-06-13):
|
||||
* 1.Change:
|
||||
* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[]
|
||||
|
|
@ -101,5 +122,8 @@ void EPD_4IN2_Init(void);
|
|||
void EPD_4IN2_Clear(void);
|
||||
void EPD_4IN2_Display(UBYTE *Image);
|
||||
void EPD_4IN2_Sleep(void);
|
||||
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image);
|
||||
|
||||
void EPD_4IN2_Init_4Gray(void);
|
||||
void EPD_4IN2_4GrayDisplay(const UBYTE *Image);
|
||||
#endif
|
||||
|
|
|
|||
BIN
RaspberryPi_and_JetsonNano/c/pic/4in2_Scale.bmp
Normal file
BIN
RaspberryPi_and_JetsonNano/c/pic/4in2_Scale.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_and_JetsonNano/c/pic/4in2_Scale_1.bmp
Normal file
BIN
RaspberryPi_and_JetsonNano/c/pic/4in2_Scale_1.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_and_JetsonNano/c/pic/x1.bmp
Normal file
BIN
RaspberryPi_and_JetsonNano/c/pic/x1.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Loading…
Add table
Add a link
Reference in a new issue