add 2in13_V3 example code (RPi)
This commit is contained in:
parent
c1974d4cde
commit
9c097b5cc3
6 changed files with 512 additions and 83 deletions
|
|
@ -4,8 +4,8 @@
|
|||
* | Function : 2.13inch e-paper V3 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-22
|
||||
* | This version: V1.1
|
||||
* | Date : 2021-10-30
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
@ -33,40 +33,40 @@
|
|||
|
||||
int EPD_2in13_V3_test(void)
|
||||
{
|
||||
printf("EPD_2in13_V3_test Demo\r\n");
|
||||
Debug("EPD_2in13_V3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
Debug("e-Paper Init and Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2in13_V3_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
Debug("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Debug("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Debug("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Debug("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
|
|
@ -74,7 +74,7 @@ int EPD_2in13_V3_test(void)
|
|||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Debug("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13_2);
|
||||
|
|
@ -85,7 +85,7 @@ int EPD_2in13_V3_test(void)
|
|||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
Debug("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
@ -109,8 +109,8 @@ int EPD_2in13_V3_test(void)
|
|||
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 60, "你好abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "微雪电子", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2in13_V3_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
|
@ -118,7 +118,7 @@ int EPD_2in13_V3_test(void)
|
|||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("Partial refresh\r\n");
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
|
|
@ -153,17 +153,17 @@ int EPD_2in13_V3_test(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
Debug("Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
EPD_2in13_V3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
Debug("Goto Sleep...\r\n");
|
||||
EPD_2in13_V3_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
Debug("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ int main(void)
|
|||
// EPD_1in54_test();
|
||||
// EPD_1in54_V2_test();
|
||||
// EPD_1in54b_test();
|
||||
// EPD_1in54b_V2_test();
|
||||
// EPD_1in54b_V2_test();
|
||||
// EPD_1in54c_test();
|
||||
|
||||
// EPD_2in66_test();
|
||||
|
|
@ -43,8 +43,8 @@ int main(void)
|
|||
// EPD_2in9d_test();
|
||||
|
||||
// EPD_2in13_test();
|
||||
// EPD_2in13_V2_test();
|
||||
// EPD_2in13_V3_test();
|
||||
// EPD_2in13_V2_test();
|
||||
EPD_2in13_V3_test();
|
||||
// EPD_2in13bc_test();
|
||||
// EPD_2in13b_V3_test();
|
||||
// EPD_2in13d_test();
|
||||
|
|
@ -63,14 +63,14 @@ int main(void)
|
|||
// EPD_5in65f_test();
|
||||
|
||||
// EPD_5in83_test();
|
||||
// EPD_5in83_V2_test();
|
||||
// EPD_5in83_V2_test();
|
||||
// EPD_5in83bc_test();
|
||||
// EPD_5in83b_V2_test();
|
||||
|
||||
// EPD_5in84_test();
|
||||
|
||||
// EPD_7in5_test();
|
||||
// EPD_7in5_V2_test();
|
||||
// EPD_7in5_V2_test();
|
||||
|
||||
// EPD_7in5bc_test();
|
||||
// EPD_7in5b_V2_test();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue