first commit
This commit is contained in:
commit
9005e49d82
3071 changed files with 1941927 additions and 0 deletions
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_10in2b_test.c
Normal file
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_10in2b_test.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_10.2inb_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 10.2inch b e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_10in2b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_10in2b_test(void)
|
||||
{
|
||||
printf("EPD_10IN2b_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_10IN2b_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_10IN2b_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UDOUBLE Imagesize = ((EPD_10IN2b_WIDTH % 8 == 0)? (EPD_10IN2b_WIDTH / 8 ): (EPD_10IN2b_WIDTH / 8 + 1)) * EPD_10IN2b_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(RedImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
// Paint_NewImage(BlackImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/10in2_b.bmp", 0, 0);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/10in2_r.bmp", 0, 0);
|
||||
EPD_10IN2b_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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, 10, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 30, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
|
||||
Paint_DrawCircle(480, 480, 110, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(750, 270, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(200, 310, 90, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
|
||||
Paint_DrawLine(200, 310, 480, 480, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(480, 480, 750, 270, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
|
||||
// Red Image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawLine(750, 270, 200, 310, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawCircle(480, 480, 150, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(480, 480, 110, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(750, 270, 70, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(200, 310, 40, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
EPD_10IN2b_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/10in2_b1.bmp", 0, 0);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/10in2_r1.bmp", 0, 0);
|
||||
EPD_10IN2b_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_10IN2b_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_10IN2b_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
free(RedImage);
|
||||
RedImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
166
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_13in3b_test.c
Normal file
166
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_13in3b_test.c
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_13IN3B_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 13.3inch e-paper (B) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-04-08
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_13in3b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_13in3b_test(void)
|
||||
{
|
||||
printf("EPD_13IN3B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_13IN3B_Init();
|
||||
EPD_13IN3B_Clear();
|
||||
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UDOUBLE Imagesize = ((EPD_13IN3B_WIDTH % 8 == 0)? (EPD_13IN3B_WIDTH / 8 ): (EPD_13IN3B_WIDTH / 8 + 1)) * EPD_13IN3B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_13IN3B_WIDTH, EPD_13IN3B_HEIGHT, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_13IN3B_WIDTH, EPD_13IN3B_HEIGHT, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/13in3b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/13in3b_r.bmp", 0, 0);
|
||||
EPD_13IN3B_Display_Base(BlackImage, RYImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
EPD_13IN3B_Init();
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_13IN3B_Display_Base(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(0, 0, Font20.Width * 7, Font20.Height, WHITE);
|
||||
Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_13IN3B_Display_Partial(BlackImage, 10, 130, 10 + Font20.Width * 7, 130 + Font20.Height);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_13IN3B_Init();
|
||||
EPD_13IN3B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_13IN3B_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
249
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_13in3k_test.c
Normal file
249
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_13in3k_test.c
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_13IN3K_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 13.3inch e-paper (K) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-07-18
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_13in3k.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_13in3k_test(void)
|
||||
{
|
||||
printf("EPD_13IN3K_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_13IN3K_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_13IN3K_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_13IN3K_WIDTH % 8 == 0)? (EPD_13IN3K_WIDTH / 8 ): (EPD_13IN3K_WIDTH / 8 + 1)) * EPD_13IN3K_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/13in3.bmp", 0, 0);
|
||||
EPD_13IN3K_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/13in3_1.bmp", 0, 0);
|
||||
EPD_13IN3K_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/13in3_2.bmp", 0, 0);
|
||||
EPD_13IN3K_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_13in3k);
|
||||
|
||||
EPD_13IN3K_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_DrawCircle(200, 310, 90, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(200, 310, 40, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(480, 480, 150, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(480, 480, 110, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(750, 270, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(750, 270, 70, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(200, 310, 480, 480, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(480, 480, 750, 270, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(750, 270, 200, 310, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
|
||||
|
||||
EPD_13IN3K_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("Partial refresh\r\n");
|
||||
// If you didn't use the EPD_13IN3K_Display_Base() function to refresh the image before,
|
||||
// use the EPD_13IN3K_color_Base() function to refresh the background color,
|
||||
// otherwise the background color will be garbled
|
||||
EPD_13IN3K_Init_Part();
|
||||
// EPD_13IN3K_color_Base(WHITE);
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_NewImage(BlackImage, 200, 50, 0, WHITE);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawTime(20, 10, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_13IN3K_Display_Part(BlackImage, 10, 150, 200, 50);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_13IN3K_WIDTH % 4 == 0)? (EPD_13IN3K_WIDTH / 4 ): (EPD_13IN3K_WIDTH / 4 + 1)) * EPD_13IN3K_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_13IN3K_Init_4GRAY();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_13IN3K_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_13IN3K_WIDTH, EPD_13IN3K_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/13in3k_Scale.bmp", 0, 0);
|
||||
EPD_13IN3K_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_13IN3K_Init();
|
||||
EPD_13IN3K_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_13IN3K_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
188
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in02d_test.c
Normal file
188
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in02d_test.c
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN02_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.02inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-09-29
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in02d.h"
|
||||
|
||||
int EPD_1in02d_test(void)
|
||||
{
|
||||
printf("EPD_1IN02_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN02_Init();
|
||||
EPD_1IN02_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage,*old_Image;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN02_WIDTH % 8 == 0)? (EPD_1IN02_WIDTH / 8 ): (EPD_1IN02_WIDTH / 8 + 1)) * EPD_1IN02_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((old_Image = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory2...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(old_Image, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(old_Image);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x80.bmp", 0, 0);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/1in02.bmp", 0, 0);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in02d);
|
||||
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
#if 1
|
||||
// Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 15, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 25, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(30, 10, 80, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(80, 10, 30, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(30, 10, 90, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawCircle(60, 40, 25, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
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);
|
||||
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawString_CN(0, 10,"ÄãºÃabcÊ÷Ý®ÅÉ", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(0, 30,"΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
printf("EPD_1IN02_Display\r\n");
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
EPD_1IN02_Display(BlackImage);
|
||||
|
||||
EPD_1IN02_Part_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
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(20, 20, 20 + Font20.Width * 7, 20 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(20, 20, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN02_DisplayPartial(old_Image, BlackImage);
|
||||
memcpy(old_Image, BlackImage, Imagesize);
|
||||
// DEV_Delay_ms(100);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN02_Init();
|
||||
EPD_1IN02_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN02_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
134
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_DES_test.c
Normal file
134
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_DES_test.c
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN54_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_1in54_DES_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_1IN54_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_1IN54_DES_WIDTH % 8 == 0)? (EPD_1IN54_DES_WIDTH / 8 ): (EPD_1IN54_DES_WIDTH / 8 + 1)) * EPD_1IN54_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(45, 10, 45, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(20, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(45, 35, 10, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(5, 65, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 90, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 105, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_DES_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
177
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_V2_test.c
Normal file
177
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_V2_test.c
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_1in54_V2_test(void)
|
||||
{
|
||||
printf("EPD_1in54_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_1IN54_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1)) * EPD_1IN54_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_V2_WIDTH, EPD_1IN54_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
// The image of the previous frame must be uploaded, otherwise the
|
||||
// first few seconds will display an exception.
|
||||
EPD_1IN54_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
// enter partial mode
|
||||
EPD_1IN54_V2_Init_Partial();
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN54_V2_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_test.c
Normal file
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54_test.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN54_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54.h"
|
||||
|
||||
int EPD_1in54_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1)) * EPD_1IN54_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
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(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_1IN54_Display(BlackImage);
|
||||
// DEV_Delay_ms(100);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_FULL);
|
||||
EPD_1IN54_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54b_V2_test.c
Normal file
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54b_V2_test.c
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54b_V2.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_1in54b_V2_test(void)
|
||||
{
|
||||
printf("EPD_1IN54b_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
EPD_1IN54B_V2_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_1IN54B_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(200);
|
||||
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1)) * EPD_1IN54B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
printf("read black bmp\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
printf("read black bmp\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/1in54b-b.bmp", 0, 0);
|
||||
printf("read red bmp\r\n");
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/1in54b-r.bmp", 0, 0);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Black);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Red);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54b_test.c
Normal file
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54b_test.c
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54b.h"
|
||||
|
||||
int EPD_1in54b_test(void)
|
||||
{
|
||||
printf("EPD_1in54b_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54B_Init();
|
||||
EPD_1IN54B_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create new image
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_WIDTH % 8 == 0)? (EPD_1IN54B_WIDTH / 8 ): (EPD_1IN54B_WIDTH / 8 + 1)) * EPD_1IN54B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
printf("read black bmp\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
printf("read black bmp\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/1in54b-b.bmp", 0, 0);
|
||||
printf("read red bmp\r\n");
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/1in54b-r.bmp", 0, 0);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(5, 160, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Black);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Red);
|
||||
|
||||
EPD_1IN54B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
137
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54c_test.c
Normal file
137
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in54c_test.c
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54c_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54c.h"
|
||||
|
||||
int EPD_1in54c_test(void)
|
||||
{
|
||||
printf("EPD_1IN54C_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54C_Init();
|
||||
EPD_1IN54C_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create new image
|
||||
UBYTE *BlackImage, *YellowImage;
|
||||
UWORD Imagesize = ((EPD_1IN54C_WIDTH % 8 == 0)? (EPD_1IN54C_WIDTH / 8 ): (EPD_1IN54C_WIDTH / 8 + 1)) * EPD_1IN54C_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((YellowImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and YellowImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(YellowImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/1in54c-b.bmp", 0, 0);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
GUI_ReadBmp("./pic/1in54c-y.bmp", 0, 0);
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(45, 10, 45, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(20, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 95, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 120,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54c_Black);
|
||||
|
||||
Paint_SelectImage(YellowImage);
|
||||
Paint_DrawBitMap(gImage_1in54c_Yellow);
|
||||
|
||||
EPD_1IN54C_Display(BlackImage, YellowImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54C_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54C_Sleep();
|
||||
free(BlackImage);
|
||||
free(YellowImage);
|
||||
BlackImage = NULL;
|
||||
YellowImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in64g_test.c
Normal file
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_1in64g_test.c
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in64g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.64inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-22
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in64g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_1in64g_test(void)
|
||||
{
|
||||
printf("EPD_1IN64G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN64G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_1IN64G_Clear(EPD_1IN64G_WHITE);
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_1IN64G_WIDTH % 4 == 0)? (EPD_1IN64G_WIDTH / 4 ): (EPD_1IN64G_WIDTH / 4 + 1)) * EPD_1IN64G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN64G_WIDTH, EPD_1IN64G_HEIGHT, 0, EPD_1IN64G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/1.64inch-2.bmp", 0, 0);
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_1IN64G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_1IN64G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_1IN64G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_1IN64G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_1IN64G_RED, EPD_1IN64G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_1IN64G_YELLOW, EPD_1IN64G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_1IN64G_RED, EPD_1IN64G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_1IN64G_RED, EPD_1IN64G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 168, 55, EPD_1IN64G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 112, 167, 167, EPD_1IN64G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 167, EPD_1IN64G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 8;
|
||||
hWidth = EPD_1IN64G_HEIGHT/hNumber; // 168/16=21
|
||||
vNumber = 8;
|
||||
vWidth = EPD_1IN64G_WIDTH/vNumber; // 168/16=21
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_1IN64G_WIDTH, hWidth*(1+i), EPD_1IN64G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_1IN64G_HEIGHT, EPD_1IN64G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_1IN64G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN64G_Clear(EPD_1IN64G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN64G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
135
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_DES_test.c
Normal file
135
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_DES_test.c
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_DES_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN13_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN13_DES_WIDTH % 8 == 0)? (EPD_2IN13_DES_WIDTH / 8 ): (EPD_2IN13_DES_WIDTH / 8 + 1)) * EPD_2IN13_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13.bmp", 0, 0);
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 65, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 35, "wave", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(140, 51, "share", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 75, 12345, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 10, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 63, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_DES_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
219
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V2_test.c
Normal file
219
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V2_test.c
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper(V2) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN13_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1)) * EPD_2IN13_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_V2_WIDTH, EPD_2IN13_V2_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetMirroring(MIRROR_HORIZONTAL); //
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13-v2.bmp", 0, 0);
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
|
||||
#if 0 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 60, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawLine(1, 1, 250,1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(250, 1, 250,122, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(250, 122,1, 122, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(1, 122,1, 1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(3, 3, 248,3, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(248, 3, 248,120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(248, 120,3, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(3, 120,3, 3, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(5, 5, 246,5, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(246, 5, 246,118, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(246, 118,5, 118, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(5, 118,5, 5, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(7, 7, 244,7, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(244, 7, 244,116, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(244, 116,7, 116, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(7, 116,7, 7, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(9, 9, 242,9, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(242, 9, 242,114, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(242, 114,9, 114, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(9, 114,9, 9, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawString_EN(60, 25, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(60, 55, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
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(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13_V2_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
EPD_2IN13_V2_Clear();
|
||||
DEV_Delay_ms(2000);//Analog clock 1s
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
170
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V3_test.c
Normal file
170
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V3_test.c
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2021-10-30
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_V3.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_V3_test(void)
|
||||
{
|
||||
Debug("EPD_2in13_V3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
Debug("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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);
|
||||
Debug("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Debug("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
Debug("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13_2);
|
||||
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Debug("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
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);
|
||||
|
||||
EPD_2in13_V3_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2in13_V3_Display_Partial(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug("Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
EPD_2in13_V3_Clear();
|
||||
|
||||
Debug("Goto Sleep...\r\n");
|
||||
EPD_2in13_V3_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
Debug("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
174
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V4_test.c
Normal file
174
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_V4_test.c
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V4_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V4 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-6-25
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_V4.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_V4_test(void)
|
||||
{
|
||||
|
||||
Debug("EPD_2in13_V4_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
Debug("e-Paper Init and Clear...\r\n");
|
||||
EPD_2in13_V4_Init();
|
||||
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2in13_V4_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2in13_V4_WIDTH % 8 == 0)? (EPD_2in13_V4_WIDTH / 8 ): (EPD_2in13_V4_WIDTH / 8 + 1)) * EPD_2in13_V4_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
Debug("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Debug("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
|
||||
Debug("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2in13_V4_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Debug("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0);
|
||||
EPD_2in13_V4_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
Debug("show image for array\r\n");
|
||||
EPD_2in13_V4_Init_Fast();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13_2);
|
||||
|
||||
EPD_2in13_V4_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
|
||||
Debug("Drawing\r\n");
|
||||
//1.Select Image
|
||||
EPD_2in13_V4_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
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);
|
||||
|
||||
EPD_2in13_V4_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2in13_V4_Display_Partial(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug("Clear...\r\n");
|
||||
EPD_2in13_V4_Init();
|
||||
EPD_2in13_V4_Clear();
|
||||
|
||||
Debug("Goto Sleep...\r\n");
|
||||
EPD_2in13_V4_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
Debug("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
164
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_test.c
Normal file
164
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13_test.c
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13.h"
|
||||
|
||||
int EPD_2in13_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_FULL);
|
||||
EPD_2IN13_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13_WIDTH % 8 == 0)? (EPD_2IN13_WIDTH / 8 ): (EPD_2IN13_WIDTH / 8 + 1)) * EPD_2IN13_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_WIDTH, EPD_2IN13_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13.bmp", 0, 0);
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
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);
|
||||
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
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(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13_Display(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13_Init(EPD_2IN13_FULL);
|
||||
EPD_2IN13_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
142
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13b_V3_test.c
Normal file
142
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13b_V3_test.c
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B V3 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13b_V3.h"
|
||||
|
||||
int EPD_2in13b_V3_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V3_Init();
|
||||
EPD_2IN13B_V3_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1)) * EPD_2IN13B_V3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN13B_V3_WIDTH, EPD_2IN13B_V3_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V3_WIDTH, EPD_2IN13B_V3_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN13B_V3_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in13bc-ry.bmp", 0, 0);
|
||||
EPD_2IN13B_V3_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
// EPD_2IN13B_V3_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13B_V3_Display(gImage_2in13c_b, gImage_2in13c_y);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13B_V3_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V3_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
146
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13b_V4_test.c
Normal file
146
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13b_V4_test.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V4_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B V4 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-04-21
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13b_V4.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_2in13b_V4_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V4_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V4_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN13B_V4_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13B_V4_WIDTH % 8 == 0)? (EPD_2IN13B_V4_WIDTH / 8 ): (EPD_2IN13B_V4_WIDTH / 8 + 1)) * EPD_2IN13B_V4_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN13B_V4_WIDTH, EPD_2IN13B_V4_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V4_WIDTH, EPD_2IN13B_V4_HEIGHT, 90, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN13B_V4_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13b_V4b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in13b_V4r.bmp", 0, 0);
|
||||
EPD_2IN13B_V4_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN13B_V4_Display(gImage_2in13b_V4b, gImage_2in13b_V4r);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13B_V4_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V4_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V4_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13bc_test.c
Normal file
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13bc_test.c
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13bc.h"
|
||||
|
||||
int EPD_2in13bc_test(void)
|
||||
{
|
||||
printf("EPD_2IN13BC_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13BC_Init();
|
||||
EPD_2IN13BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13BC_WIDTH % 8 == 0)? (EPD_2IN13BC_WIDTH / 8 ): (EPD_2IN13BC_WIDTH / 8 + 1)) * EPD_2IN13BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
// printf("show window BMP-----------------\r\n");
|
||||
// Paint_SelectImage(BlackImage);
|
||||
// GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
// Paint_SelectImage(RYImage);
|
||||
// Paint_Clear(WHITE);
|
||||
// EPD_2IN13BC_Display(BlackImage, RYImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13_b1.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in13_y1.bmp", 0, 0);
|
||||
EPD_2IN13BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
// EPD_2IN13BC_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13BC_Display(gImage_2in13c_b, gImage_2in13c_y);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13d_test.c
Normal file
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13d_test.c
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13d_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13d.h"
|
||||
|
||||
int EPD_2in13d_test(void)
|
||||
{
|
||||
printf("EPD_2IN13D_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13D_Init();
|
||||
EPD_2IN13D_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1)) * EPD_2IN13D_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13D_WIDTH, EPD_2IN13D_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13d.bmp", 0, 0);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13d);
|
||||
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawString_EN(5, 5, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 25, 123456789, &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 45,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 60,"΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 80, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
EPD_2IN13D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN13D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13D_Init();
|
||||
EPD_2IN13D_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13D_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13g_test.c
Normal file
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in13g_test.c
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2inch13 e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-05-29
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_2in13g_test(void)
|
||||
{
|
||||
printf("EPD_2IN13G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_2IN13G_Clear(EPD_2IN13G_WHITE); // White
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN13G_WIDTH % 4 == 0)? (EPD_2IN13G_WIDTH / 4 ): (EPD_2IN13G_WIDTH / 4 + 1)) * EPD_2IN13G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13G_WIDTH, EPD_2IN13G_HEIGHT, 0, EPD_2IN13G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/2in13g.bmp", 0, 0);
|
||||
EPD_2IN13G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN13G_WIDTH, EPD_2IN13G_HEIGHT, 90, EPD_2IN13G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN13G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_2IN13G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_2IN13G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_2IN13G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_2IN13G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_2IN13G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_2IN13G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_2IN13G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_2IN13G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_2IN13G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_2IN13G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_2IN13G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(0, 0, "Red,yellow,white,black", &Font16, EPD_2IN13G_RED, EPD_2IN13G_YELLOW);
|
||||
Paint_DrawString_EN(0, 16, "Four color e-Paper", &Font12, EPD_2IN13G_YELLOW, EPD_2IN13G_BLACK);
|
||||
Paint_DrawString_CN(120, 28, "΢ѩµç×Ó", &Font24CN, EPD_2IN13G_RED, EPD_2IN13G_WHITE);
|
||||
Paint_DrawNum(0, 28, 123456, &Font12, EPD_2IN13G_RED, EPD_2IN13G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN13G_WIDTH, EPD_2IN13G_HEIGHT, 0, EPD_2IN13G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN13G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, EPD_2IN13G_WIDTH, EPD_2IN13G_HEIGHT/4, EPD_2IN13G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, EPD_2IN13G_HEIGHT/4, EPD_2IN13G_WIDTH, EPD_2IN13G_HEIGHT/2, EPD_2IN13G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, EPD_2IN13G_HEIGHT/2, EPD_2IN13G_WIDTH, 3*EPD_2IN13G_HEIGHT/4, EPD_2IN13G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN13G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 20;
|
||||
hWidth = EPD_2IN13G_HEIGHT/hNumber;
|
||||
vNumber = 8;
|
||||
vWidth = EPD_2IN13G_WIDTH/vNumber;
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_2IN13G_WIDTH, hWidth*(1+i), EPD_2IN13G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_2IN13G_HEIGHT, EPD_2IN13G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13G_Clear(EPD_2IN13G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
126
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in15b_test.c
Normal file
126
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in15b_test.c
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in15b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2inch15 e-paper (B) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-08-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to dealv
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included inv
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in15b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in15b_test(void)
|
||||
{
|
||||
printf("EPD_2IN15B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN15B_Init();
|
||||
EPD_2IN15B_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN15B_WIDTH % 8 == 0)? (EPD_2IN15B_WIDTH / 8 ): (EPD_2IN15B_WIDTH / 8 + 1)) * EPD_2IN15B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 0, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2.15__b.bmp", 0, 0);
|
||||
Paint_NewImage(RedImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 0, WHITE);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/2.15__r.bmp", 0, 0);
|
||||
EPD_2IN15B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//1.Draw black image
|
||||
Paint_NewImage(BlackImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_NewImage(RedImage, EPD_2IN15B_WIDTH, EPD_2IN15B_HEIGHT, 270, WHITE);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_2IN15B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN15B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN15B_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in15g_test.c
Normal file
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in15g_test.c
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in15g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2inch15 e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-08-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in15g.h"
|
||||
|
||||
int EPD_2in15g_test(void)
|
||||
{
|
||||
printf("EPD_2IN15G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN15G_Init();
|
||||
EPD_2IN15G_Clear(EPD_2IN15G_WHITE); // White
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN15G_WIDTH % 4 == 0)? (EPD_2IN15G_WIDTH / 4 ): (EPD_2IN15G_WIDTH / 4 + 1)) * EPD_2IN15G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT, 90, EPD_2IN15G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show BMP-----------------\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT, 0, EPD_2IN15G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/2in15g.bmp", 0, 0);
|
||||
EPD_2IN15G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT, 90, EPD_2IN15G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN15G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_2IN15G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_2IN15G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_2IN15G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_2IN15G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_2IN15G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_2IN15G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_2IN15G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_2IN15G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_2IN15G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_2IN15G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_2IN15G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red,yellow,white and black", &Font16, EPD_2IN15G_RED, EPD_2IN15G_YELLOW);
|
||||
Paint_DrawString_EN(10, 20, "Four color e-Paper", &Font12, EPD_2IN15G_YELLOW, EPD_2IN15G_BLACK);
|
||||
Paint_DrawString_CN(150, 20, "΢ѩµç×Ó", &Font24CN, EPD_2IN15G_RED, EPD_2IN15G_WHITE);
|
||||
Paint_DrawNum(10, 35, 123456, &Font12, EPD_2IN15G_RED, EPD_2IN15G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN15G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT, 0, EPD_2IN15G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN15G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT/4, EPD_2IN15G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, EPD_2IN15G_HEIGHT/4, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT/2, EPD_2IN15G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, EPD_2IN15G_HEIGHT/2, EPD_2IN15G_WIDTH, EPD_2IN15G_HEIGHT/4*3, EPD_2IN15G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN15G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN15G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 20;
|
||||
hWidth = EPD_2IN15G_HEIGHT/hNumber;
|
||||
vNumber = 8;
|
||||
vWidth = EPD_2IN15G_WIDTH/vNumber;
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_2IN15G_WIDTH, hWidth*(1+i), EPD_2IN15G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_2IN15G_HEIGHT, EPD_2IN15G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN15G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN15G_Clear(EPD_2IN15G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN15G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in36g_test.c
Normal file
165
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in36g_test.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in36g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.36inch e-Paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-18
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in36g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_2in36g_test(void)
|
||||
{
|
||||
printf("EPD_2IN36G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN36G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_2IN36G_Clear(EPD_2IN36G_WHITE); // White
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN36G_WIDTH % 4 == 0)? (EPD_2IN36G_WIDTH / 4 ): (EPD_2IN36G_WIDTH / 4 + 1)) * EPD_2IN36G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN36G_WIDTH, EPD_2IN36G_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/2.36inch-1.bmp", 0, 0);
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/2.36inch-2.bmp", 0, 0);
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_2IN36G_WHITE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_2IN36G_RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_2IN36G_BLACK, EPD_2IN36G_WHITE);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_2IN36G_WHITE, EPD_2IN36G_RED);
|
||||
Paint_DrawString_CN(10, 125, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_2IN36G_BLACK, EPD_2IN36G_YELLOW);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_2IN36G_BLACK, EPD_2IN36G_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 168, 86, EPD_2IN36G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 210, 167, 295, EPD_2IN36G_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 295, EPD_2IN36G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_2IN36G_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_2IN36G_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_2IN36G_WIDTH, hWidth*(1+i), EPD_2IN36G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_2IN36G_HEIGHT, EPD_2IN36G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN36G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN36G_Clear(EPD_2IN36G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN36G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
173
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66_test.c
Normal file
173
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66_test.c
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN66_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-21
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in66.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in66_test(void)
|
||||
{
|
||||
printf("EPD_2IN66_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN66_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN66_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1)) * EPD_2IN66_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN66_WIDTH, EPD_2IN66_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in66.bmp", 0, 0);
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 20, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 30, 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(20, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(20, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(20, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(20, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //partial refresh, show time
|
||||
printf("EPD_2IN66_DisplayPart\r\n");
|
||||
EPD_2IN66_Init_partial();
|
||||
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time; //time struct
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UWORD num = 10;
|
||||
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(180, 100, 296, 152, WHITE);
|
||||
Paint_DrawTime(180, 110, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
EPD_2IN66_Clear();
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN66_Init();
|
||||
EPD_2IN66_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN66_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66b_test.c
Normal file
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66b_test.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN66b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-paper b test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-11-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in66b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in66b_test(void)
|
||||
{
|
||||
printf("EPD_2IN66B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN66B_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN66B_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1)) * EPD_2IN66B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in66b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/2in66b_r.bmp", 0, 0);
|
||||
EPD_2IN66B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_2IN66B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN66B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN66B_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
142
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66g_test.c
Normal file
142
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in66g_test.c
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in66g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.66inch e-Paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-12-20
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in66g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_2in66g_test(void)
|
||||
{
|
||||
printf("EPD_2IN66g_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN66g_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_2IN66g_Clear(EPD_2IN66g_WHITE); // White
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN66g_WIDTH % 4 == 0)? (EPD_2IN66g_WIDTH / 4 ): (EPD_2IN66g_WIDTH / 4 + 1)) * EPD_2IN66g_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN66g_WIDTH, EPD_2IN66g_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/2in66g.bmp", 0, 0);
|
||||
EPD_2IN66g_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN66g_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_2IN66g_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_2IN66g_WHITE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_2IN66g_RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_2IN66g_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_2IN66g_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_2IN66g_WHITE, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_2IN66g_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_2IN66g_RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_2IN66g_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_2IN66g_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_2IN66g_WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_2IN66g_BLACK, EPD_2IN66g_WHITE);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_2IN66g_WHITE, EPD_2IN66g_RED);
|
||||
Paint_DrawString_CN(10, 125, "΢ѩµç×Ó", &Font24CN, EPD_2IN66g_BLACK, EPD_2IN66g_YELLOW);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_2IN66g_BLACK, EPD_2IN66g_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN66g_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_2IN66g_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_2IN66g_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_2IN66g_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_2IN66g_WIDTH, hWidth*(1+i), EPD_2IN66g_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_2IN66g_HEIGHT, EPD_2IN66g_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN66g_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN66g_Clear(EPD_2IN66g_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN66g_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
284
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7_V2_test.c
Normal file
284
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7_V2_test.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch V2 e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in7_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN7_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1)) * EPD_2IN7_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN7_V2_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Fast Drawing on the image
|
||||
// Fast refresh
|
||||
printf("This is followed by a quick refresh demo\r\n");
|
||||
printf("First, clear the screen\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
printf("e-Paper Init Fast\r\n");
|
||||
EPD_2IN7_V2_Init_Fast();
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN7_V2_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
|
||||
EPD_2IN7_V2_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_Clear(WHITE);
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN7_V2_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
// If you didn't use the EPD_2IN7_V2_Display_Base() function to refresh the image before,
|
||||
// use the EPD_2IN7_V2_Display_Base_color() function to refresh the background color,
|
||||
// otherwise the background color will be garbled
|
||||
EPD_2IN7_V2_Init();
|
||||
// EPD_2IN7_V2_Display_Base_color(WHITE);
|
||||
Paint_NewImage(BlackImage, 50, 120, 90, WHITE);
|
||||
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_2IN7_V2_Display_Partial(BlackImage, 60, 134, 110, 254); // Xstart must be a multiple of 8
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_2IN7_V2_WIDTH % 4 == 0)? (EPD_2IN7_V2_WIDTH / 4 ): (EPD_2IN7_V2_WIDTH / 4 + 1)) * EPD_2IN7_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_2IN7_V2_Init_4GRAY();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/2in7_Scale.bmp", 0, 0);
|
||||
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7_V2_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
185
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7_test.c
Normal file
185
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7_test.c
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN7_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in7_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
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();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN7_WIDTH % 8 == 0)? (EPD_2IN7_WIDTH / 8 ): (EPD_2IN7_WIDTH / 8 + 1)) * EPD_2IN7_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in7);
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN7_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
// EPD_2IN7_Clear();
|
||||
free(BlackImage);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_2IN7_WIDTH % 4 == 0)? (EPD_2IN7_WIDTH / 4 ): (EPD_2IN7_WIDTH / 4 + 1)) * EPD_2IN7_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("4 grayscale display\r\n");
|
||||
EPD_2IN7_Init_4Gray();
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_2IN7_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
EPD_2IN7_4GrayDisplay(gImage_2in7_4Gray1);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/2in7_Scale.bmp", 0, 0);
|
||||
EPD_2IN7_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 20, 20);
|
||||
EPD_2IN7_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
EPD_2IN7_Clear();
|
||||
#endif
|
||||
// close 5V
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
147
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7b_V2_test.c
Normal file
147
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7b_V2_test.c
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN7b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-10-20
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7b_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in7b_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN7B_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7B_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN7B_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_2IN7B_V2_WIDTH % 8 == 0)? (EPD_2IN7B_V2_WIDTH / 8 ): (EPD_2IN7B_V2_WIDTH / 8 + 1)) * EPD_2IN7B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7B_V2_WIDTH, EPD_2IN7B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN7B_V2_WIDTH, EPD_2IN7B_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN7B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in7b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/2in7b-r.bmp", 0, 0);
|
||||
EPD_2IN7B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Black);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Red);
|
||||
EPD_2IN7B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN7B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7B_V2_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7b_test.c
Normal file
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in7b_test.c
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN7b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch e-paper b test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7b.h"
|
||||
|
||||
int EPD_2in7b_test(void)
|
||||
{
|
||||
printf("EPD_2IN7B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7B_Init();
|
||||
EPD_2IN7B_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1)) * EPD_2IN7B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in7b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/2in7b-r.bmp", 0, 0);
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Black);
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_2in7b_Red);
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN7B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7B_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");
|
||||
DEV_Module_Exit();
|
||||
DEV_Delay_ms(2000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_DES_test.c
Normal file
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_DES_test.c
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in9_DES_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN9_DES_WIDTH % 8 == 0)? (EPD_2IN9_DES_WIDTH / 8 ): (EPD_2IN9_DES_WIDTH / 8 + 1)) * EPD_2IN9_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_DES_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
222
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_V2_test.c
Normal file
222
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_V2_test.c
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.2
|
||||
* | Date : 2023-12-21
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in9_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN9_V2_WIDTH % 8 == 0)? (EPD_2IN9_V2_WIDTH / 8 ): (EPD_2IN9_V2_WIDTH / 8 + 1)) * EPD_2IN9_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN9_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_2IN9_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
EPD_2IN9_V2_Init_Fast();
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN9_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN9_V2_Display_Partial(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_2IN9_V2_WIDTH % 4 == 0)? (EPD_2IN9_V2_WIDTH / 4 ): (EPD_2IN9_V2_WIDTH / 4 + 1)) * EPD_2IN9_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_2IN9_V2_Gray4_Init();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_2IN9_V2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/2in9_Scale.bmp", 0, 0);
|
||||
EPD_2IN9_V2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_V2_Init();
|
||||
EPD_2IN9_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_V2_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
171
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_test.c
Normal file
171
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9_test.c
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-11
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9.h"
|
||||
|
||||
int EPD_2in9_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_FULL);
|
||||
EPD_2IN9_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN9_WIDTH % 8 == 0)? (EPD_2IN9_WIDTH / 8 ): (EPD_2IN9_WIDTH / 8 + 1)) * EPD_2IN9_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 0, WHITE);
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
|
||||
#if 1 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 270, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
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);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN9_Display(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_Init(EPD_2IN9_FULL);
|
||||
EPD_2IN9_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
148
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9b_V3_test.c
Normal file
148
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9b_V3_test.c
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9b_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B V3 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2020-12-03
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9b_V3.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in9b_V3_test(void)
|
||||
{
|
||||
printf("EPD_2IN9B_V3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9B_V3_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9B_V3_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN9B_V3_WIDTH % 8 == 0)? (EPD_2IN9B_V3_WIDTH / 8 ): (EPD_2IN9B_V3_WIDTH / 8 + 1)) * EPD_2IN9B_V3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN9B_V3_WIDTH, EPD_2IN9B_V3_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9B_V3_WIDTH, EPD_2IN9B_V3_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN9B_V3_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in9bc-ry.bmp", 0, 0);
|
||||
EPD_2IN9B_V3_Display(BlackImage, RYImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9B_V3_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9B_V3_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9B_V3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9B_V3_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
201
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9b_V4_test.c
Normal file
201
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9b_V4_test.c
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9b_V4_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B V4 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-12-18
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9b_V4.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in9b_V4_test(void)
|
||||
{
|
||||
printf("EPD_2IN9B_V4_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9B_V4_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9B_V4_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN9B_V4_WIDTH % 8 == 0)? (EPD_2IN9B_V4_WIDTH / 8 ): (EPD_2IN9B_V4_WIDTH / 8 + 1)) * EPD_2IN9B_V4_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN9B_V4_WIDTH, EPD_2IN9B_V4_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9B_V4_WIDTH, EPD_2IN9B_V4_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN9B_V4_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in9bc-ry.bmp", 0, 0);
|
||||
EPD_2IN9B_V4_Display(BlackImage, RYImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
EPD_2IN9B_V4_Init_Fast();
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9B_V4_Display_Fast(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
EPD_2IN9B_V4_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
// Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
// Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9B_V4_Display_Base(BlackImage, RYImage);
|
||||
// EPD_2IN9B_V4_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
// If you didn't use the EPD_2IN9B_V4_Display_Base() function to refresh the image before,
|
||||
// use the EPD_2IN9B_V4_Display_Base_color() function to refresh the background color,
|
||||
// otherwise the background color will be garbled
|
||||
// EPD_2IN9B_V4_Init();
|
||||
// EPD_2IN9B_V4_Display_Base(BlackImage, RYImage);
|
||||
// EPD_2IN9B_V4_Display_Base_color(WHITE);
|
||||
Paint_NewImage(BlackImage, 50, 120, 270, WHITE);
|
||||
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_2IN9B_V4_Display_Partial(BlackImage, 70, 35, 120, 155); // Xstart must be a multiple of 8
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9B_V4_Init();
|
||||
EPD_2IN9B_V4_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9B_V4_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
139
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9bc_test.c
Normal file
139
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9bc_test.c
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9bc.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
int EPD_2in9bc_test(void)
|
||||
{
|
||||
printf("EPD_2IN9BC_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9BC_Init();
|
||||
EPD_2IN9BC_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN9BC_WIDTH % 8 == 0)? (EPD_2IN9BC_WIDTH / 8 ): (EPD_2IN9BC_WIDTH / 8 + 1)) * EPD_2IN9BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_2IN9BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9BC_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
161
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9d_test.c
Normal file
161
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_2in9d_test.c
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9d_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper d test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9d.h"
|
||||
|
||||
int EPD_2in9d_test(void)
|
||||
{
|
||||
printf("EPD_2IN9D_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1)) * EPD_2IN9D_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9D_WIDTH, EPD_2IN9D_HEIGHT, 270, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9d.bmp", 0, 0);
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9D_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN9D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9D_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(3000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in0g_test.c
Normal file
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in0g_test.c
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_3in0g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-15
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_3in0g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_3in0g_test(void)
|
||||
{
|
||||
printf("EPD_3IN0G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN0G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_3IN0G_Clear(EPD_3IN0G_WHITE); // White
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_3IN0G_WIDTH % 4 == 0)? (EPD_3IN0G_WIDTH / 4 ): (EPD_3IN0G_WIDTH / 4 + 1)) * EPD_3IN0G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_3IN0G_WIDTH, EPD_3IN0G_HEIGHT, 0, EPD_3IN0G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show BMP-----------------\r\n");
|
||||
EPD_3IN0G_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/3inch-3.bmp", 0, 0);
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_3IN0G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_3IN0G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_3IN0G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_3IN0G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_3IN0G_RED, EPD_3IN0G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_3IN0G_YELLOW, EPD_3IN0G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_3IN0G_RED, EPD_3IN0G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_3IN0G_RED, EPD_3IN0G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawRectangle(1, 1, 167, 86, EPD_3IN0G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(1, 314, 167, 399, EPD_3IN0G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawRectangle(59, 1, 109, 399, EPD_3IN0G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_3IN0G_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 20;
|
||||
hWidth = EPD_3IN0G_HEIGHT/hNumber; // 400/20=20
|
||||
vNumber = 8;
|
||||
vWidth = EPD_3IN0G_WIDTH/vNumber; // 168/8=21
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_3IN0G_WIDTH, hWidth*(1+i), EPD_3IN0G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_3IN0G_HEIGHT, EPD_3IN0G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN0G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
EPD_3IN0G_Init();
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN0G_Clear(EPD_3IN0G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN0G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
151
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in52_test.c
Normal file
151
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in52_test.c
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_3IN52_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3.52inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-16
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_3in52.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_3in52_test(void)
|
||||
{
|
||||
printf("EPD_3IN52_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN52_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_3IN52_display_NUM(EPD_3IN52_WHITE);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
EPD_3IN52_SendCommand(0x50);
|
||||
EPD_3IN52_SendData(0x17);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_3IN52_WIDTH % 8 == 0)? (EPD_3IN52_WIDTH / 8 ): (EPD_3IN52_WIDTH / 8 + 1)) * EPD_3IN52_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_3IN52_WIDTH, EPD_3IN52_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // GC waveform refresh
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/3in52-1.bmp", 0, 0);
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/3in52-2.bmp", 0, 0);
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 0 //DU waveform refresh
|
||||
printf("Quick refresh is supported, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/3in52-3.bmp", 0, 0);
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_DU();
|
||||
EPD_3IN52_refresh();
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/3in52-4.bmp", 0, 0);
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_DU();
|
||||
EPD_3IN52_refresh();
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN52_display(BlackImage);
|
||||
EPD_3IN52_lut_GC();
|
||||
EPD_3IN52_refresh();
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN52_Clear();
|
||||
|
||||
// Sleep & close 5V
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN52_sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
198
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in7_test.c
Normal file
198
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_3in7_test.c
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_3IN7_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 3.7inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-16
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_3in7.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_3in7_test(void)
|
||||
{
|
||||
printf("EPD_3IN7_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_3IN7_4Gray_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_3IN7_4Gray_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
|
||||
// Allocate enough for for 4 bits for each pixel (16 gray)
|
||||
// If you don't use the dithering, this will only need to be 2 bits per pixel
|
||||
// you may have to edit the startup_stm32fxxx.s file and set a big enough heap size
|
||||
int Imagesize = (EPD_3IN7_WIDTH + 1) / 2 * EPD_3IN7_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_3IN7_WIDTH, EPD_3IN7_HEIGHT, 270, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
|
||||
EPD_3IN7_4Gray_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
|
||||
printf("show 4 gray bmp------------------------\r\n");
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/3in7_Scale.bmp", 0, 0);
|
||||
EPD_3IN7_4Gray_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image, partial display
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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_EN(10, 150, "GRAY1 with black background", &Font24, BLACK, GRAY1);
|
||||
Paint_DrawString_EN(10, 175, "GRAY2 with white background", &Font24, WHITE, GRAY2);
|
||||
Paint_DrawString_EN(10, 200, "GRAY3 with white background", &Font24, WHITE, GRAY3);
|
||||
Paint_DrawString_EN(10, 225, "GRAY4 with white background", &Font24, WHITE, GRAY4);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_3IN7_4Gray_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1 // partial update, just 1 Gray mode
|
||||
Paint_NewImage(BlackImage, 50, 120, 270, WHITE);
|
||||
EPD_3IN7_1Gray_Init(); //init 1 Gray mode
|
||||
EPD_3IN7_1Gray_Clear();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
printf("show time, partial update, just 1 Gary mode\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_3IN7_1Gray_Display_Part(BlackImage, 40, 30, 90, 150); // Xstart must be a multiple of 8
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
#if 1 // show dithered bmp
|
||||
EPD_3IN7_4Gray_Init(); // Clear
|
||||
EPD_3IN7_4Gray_Clear();
|
||||
|
||||
EPD_3IN7_1Gray_Init(); //init 1 Gray mode
|
||||
EPD_3IN7_1Gray_Clear();
|
||||
|
||||
Paint_NewImage(BlackImage, 280, 480, 0, WHITE);
|
||||
Paint_SetScale(16);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
printf("show dithered BMP with Sierra-Lite\r\n");
|
||||
GUI_ReadBmp_16Gray("./pic/3in7_4bit1.bmp", 0, 0);
|
||||
EPD_3IN7_1Gray_Display_Dithered(BlackImage, 0);
|
||||
DEV_Delay_ms(4000);
|
||||
|
||||
printf("show dithered BMP with Floyd-Steinberg\r\n");
|
||||
EPD_3IN7_1Gray_Display_Dithered(BlackImage, 1);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
EPD_3IN7_4Gray_Init();
|
||||
printf("Clear...\r\n");
|
||||
EPD_3IN7_4Gray_Clear();
|
||||
|
||||
// Sleep & close 5V
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_3IN7_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
118
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in01f_test.c
Normal file
118
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in01f_test.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in01f.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.01inch F e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-11-06
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_4in01f.h"
|
||||
#include "EPD_Test.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_4in01f_test(void)
|
||||
{
|
||||
printf("EPD_4in01F_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN01F_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN01F_Clear(EPD_4IN01F_WHITE);
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_4IN01F_WIDTH % 2 == 0)? (EPD_4IN01F_WIDTH / 2 ): (EPD_4IN01F_WIDTH / 2 + 1)) * EPD_4IN01F_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN01F_WIDTH, EPD_4IN01F_HEIGHT, 0, EPD_4IN01F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 1
|
||||
printf("show image for array\r\n");
|
||||
Paint_Clear(EPD_4IN01F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/4in01-1.bmp", 0, 0);
|
||||
EPD_4IN01F_Display(BlackImage);
|
||||
// EPD_4IN01F_Display_part(BlackImage, 0, 0, 640, 200);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
Paint_Clear(EPD_4IN01F_WHITE);
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_4IN01F_BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_4IN01F_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_4IN01F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_4IN01F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, EPD_4IN01F_BLACK, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, EPD_4IN01F_WHITE, EPD_4IN01F_BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_4IN01F_BLACK, EPD_4IN01F_WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_4IN01F_WHITE, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(300, 0, "ÄãºÃabc", &Font12CN, EPD_4IN01F_BLACK, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(300, 20, "ÄãºÃabc", &Font12CN, EPD_4IN01F_GREEN, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(300, 40, "ÄãºÃabc", &Font12CN, EPD_4IN01F_BLUE, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(300, 60, "ÄãºÃabc", &Font12CN, EPD_4IN01F_RED, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(300, 80, "ÄãºÃabc", &Font12CN, EPD_4IN01F_YELLOW, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(300, 100, "ÄãºÃabc", &Font12CN, EPD_4IN01F_ORANGE, EPD_4IN01F_WHITE);
|
||||
Paint_DrawString_CN(150, 0, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_WHITE, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 40, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_GREEN, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_BLUE, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 120, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_RED, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 160, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_YELLOW, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 200, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_ORANGE, EPD_4IN01F_BLACK);
|
||||
Paint_DrawString_CN(150, 240, "΢ѩµç×Ó", &Font24CN, EPD_4IN01F_BLACK, EPD_4IN01F_YELLOW);
|
||||
|
||||
EPD_4IN01F_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
printf("e-Paper Clear...\r\n");
|
||||
EPD_4IN01F_Clear(EPD_4IN01F_WHITE);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
printf("e-Paper Sleep...\r\n");
|
||||
EPD_4IN01F_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
215
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in26_test.c
Normal file
215
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in26_test.c
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in26_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.26inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-12-19
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in26.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_4in26_test(void)
|
||||
{
|
||||
printf("EPD_4in26_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4in26_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4in26_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_4in26_WIDTH % 8 == 0)? (EPD_4in26_WIDTH / 8 ): (EPD_4in26_WIDTH / 8 + 1)) * EPD_4in26_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4in26_WIDTH, EPD_4in26_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_4in26_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
// EPD_4in26_Init_Fast();
|
||||
// printf("show bmp------------------------\r\n");
|
||||
// Paint_SelectImage(BlackImage);
|
||||
// GUI_ReadBmp("./pic/800x480.bmp", 0, 0);
|
||||
// EPD_4in26_Display_Fast(BlackImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
EPD_4in26_Init_Fast();
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_7in5_V2);
|
||||
EPD_4in26_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
|
||||
EPD_4in26_Init();
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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, 1, "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(130, 1, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
// EPD_4in26_Display(BlackImage);
|
||||
EPD_4in26_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_NewImage(BlackImage, 200, 50, 0, WHITE);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawTime(20, 10, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_4in26_Display_Part(BlackImage, 80, 200, 200, 50);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_4in26_WIDTH % 4 == 0)? (EPD_4in26_WIDTH / 4 ): (EPD_4in26_WIDTH / 4 + 1)) * EPD_4in26_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_4in26_Init_4GRAY();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4in26_WIDTH, EPD_4in26_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_4in26_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_4in26_WIDTH, EPD_4in26_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/4in26_Scale.bmp", 0, 0);
|
||||
EPD_4in26_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
EPD_4in26_Init();
|
||||
EPD_4in26_Clear();
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4in26_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
225
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2_V2_test.c
Normal file
225
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2_V2_test.c
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-09-11
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2_V2.h"
|
||||
#include <string.h>
|
||||
|
||||
int EPD_4in2_V2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_V2_Init();
|
||||
EPD_4IN2_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1)) * EPD_4IN2_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_V2_WIDTH, EPD_4IN2_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_4IN2_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
// EPD_4IN2_V2_Init_Fast(Seconds_1_5S);
|
||||
// printf("show bmp------------------------\r\n");
|
||||
// Paint_SelectImage(BlackImage);
|
||||
// GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
|
||||
// EPD_4IN2_V2_Display_Fast(BlackImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
EPD_4IN2_V2_Init_Fast(Seconds_1_5S);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_4in2);
|
||||
EPD_4IN2_V2_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
|
||||
EPD_4IN2_V2_Init();
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
// EPD_4IN2_V2_Display(BlackImage);
|
||||
EPD_4IN2_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_NewImage(BlackImage, 200, 50, 0, WHITE);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawTime(20, 10, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_4IN2_V2_PartialDisplay(BlackImage, 80, 200, 200, 50);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
// EPD_4IN2_V2_Init();
|
||||
// EPD_4IN2_V2_Clear();
|
||||
EPD_4IN2_V2_Init_4Gray();
|
||||
printf("show Gray------------------------\r\n");
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
Imagesize = ((EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 4 ): (EPD_4IN2_V2_WIDTH / 4 + 1)) * EPD_4IN2_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_V2_WIDTH, EPD_4IN2_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
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_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2_V2_Display_4Gray(gImage_4in2_4Gray1);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
GUI_ReadBmp_4Gray("./pic/4in2_Scale.bmp",0 , 0);
|
||||
EPD_4IN2_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 20, 20);
|
||||
EPD_4IN2_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
EPD_4IN2_V2_Init();
|
||||
EPD_4IN2_V2_Clear();
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
228
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2_test.c
Normal file
228
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2_test.c
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2.h"
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
int EPD_4in2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_Init_Fast();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 1 // show bmp
|
||||
|
||||
EPD_4IN2_Init_Fast();
|
||||
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_4in2);
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
EPD_4IN2_Init_Partial();
|
||||
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
|
||||
#if 1
|
||||
EPD_4IN2_Init_Fast();
|
||||
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);
|
||||
|
||||
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, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(140, 40, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(140, 80, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(140, 120, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
|
||||
|
||||
Paint_DrawString_CN(220, 0, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(220, 40, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(220, 80, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(220, 120, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY4, GRAY1);
|
||||
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
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_Init_Fast();
|
||||
EPD_4IN2_Clear();
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
148
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2b_V2_test.c
Normal file
148
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2b_V2_test.c
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-23
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2b_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
int EPD_4in2b_V2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2B_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2B_V2_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN2B_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1)) * EPD_4IN2B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/4in2b-r.bmp", 0, 0);
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_4IN2B_V2_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-23
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2b_V2_old.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
int EPD_4in2b_V2_test_old(void)
|
||||
{
|
||||
printf("EPD_4IN2B_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2B_V2_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN2B_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1)) * EPD_4IN2B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_4IN2B_V2_WIDTH, EPD_4IN2B_V2_HEIGHT, 180, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/4in2b-r.bmp", 0, 0);
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_4IN2B_V2_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
147
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2bc_test.c
Normal file
147
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in2bc_test.c
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in2bc.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
int EPD_4in2bc_test(void)
|
||||
{
|
||||
printf("EPD_4IN2BC_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2BC_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN2BC_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_4IN2BC_WIDTH % 8 == 0)? (EPD_4IN2BC_WIDTH / 8 ): (EPD_4IN2BC_WIDTH / 8 + 1)) * EPD_4IN2BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_4IN2BC_WIDTH, EPD_4IN2BC_HEIGHT, 180, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_4IN2BC_WIDTH, EPD_4IN2BC_HEIGHT, 180, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/4in2b-r.bmp", 0, 0);
|
||||
EPD_4IN2BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_4IN2BC_Display(gImage_4in2bc_b, gImage_4in2bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN2BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in37b_test.c
Normal file
158
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in37b_test.c
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in37b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in37b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_4in37b_test(void)
|
||||
{
|
||||
printf("EPD_4IN37B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN37B_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN37B_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN37B_WIDTH % 8 == 0)? (EPD_4IN37B_WIDTH / 8 ): (EPD_4IN37B_WIDTH / 8 + 1)) * EPD_4IN37B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN37B_WIDTH, EPD_4IN37B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, EPD_4IN37B_WIDTH, EPD_4IN37B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in37b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/4in37b_r.bmp", 0, 0);
|
||||
EPD_4IN37B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_4IN37B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //partial data transmission
|
||||
Paint_NewImage(BlackImage, 120, 300, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, 120, 300, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawLine(1, 1, 300, 1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(300, 1, 300, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(300, 120, 1, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(1, 120, 1, 1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(20, 95, 70, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 20, "partial transmission", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_4IN37B_Display_Part(BlackImage, RedImage, 20, 100, 140, 400);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN37B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN37B_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in37g_test.c
Normal file
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_4in37g_test.c
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in37g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-Paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-08-15
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in37g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_4in37g_test(void)
|
||||
{
|
||||
printf("EPD_4IN37G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN37G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_4IN37G_Clear(EPD_4IN37G_WHITE); // WHITE
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_4IN37G_WIDTH % 4 == 0)? (EPD_4IN37G_WIDTH / 4 ): (EPD_4IN37G_WIDTH / 4 + 1)) * EPD_4IN37G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN37G_WIDTH, EPD_4IN37G_HEIGHT, 0, EPD_4IN37G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/4in37g0.bmp", 0, 0);
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/4in37g1.bmp", 0, 0);
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_4IN37G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_4IN37G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_4IN37G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_4IN37G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_4IN37G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_4IN37G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_4IN37G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font20, EPD_4IN37G_YELLOW, EPD_4IN37G_WHITE);
|
||||
Paint_DrawString_EN(10, 30, "Four color e-Paper", &Font12, EPD_4IN37G_RED, EPD_4IN37G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "微雪电子", &Font24CN, EPD_4IN37G_WHITE, EPD_4IN37G_RED);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_4IN37G_WHITE, EPD_4IN37G_BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_4IN37G_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_4IN37G_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_4IN37G_WIDTH, hWidth*(1+i), EPD_4IN37G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_4IN37G_HEIGHT, EPD_4IN37G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN37G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN37G_Clear(EPD_4IN37G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN37G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in65f_test.c
Normal file
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in65f_test.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in65f_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.65inch F e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_5in65f.h"
|
||||
#include "EPD_Test.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_5in65f_test(void)
|
||||
{
|
||||
printf("EPD_5in65F_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN65F_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_5IN65F_WIDTH % 2 == 0)? (EPD_5IN65F_WIDTH / 2 ): (EPD_5IN65F_WIDTH / 2 + 1)) * EPD_5IN65F_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_5IN65F_WIDTH, EPD_5IN65F_HEIGHT, 0, EPD_5IN65F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 1
|
||||
printf("show image for array\r\n");
|
||||
|
||||
EPD_5IN65F_Display(flagimage);
|
||||
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("show image for array\r\n");
|
||||
Paint_Clear(EPD_5IN65F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/5in65f.bmp", 0, 0);
|
||||
EPD_5IN65F_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
Paint_Clear(EPD_5IN65F_WHITE);
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_5IN65F_BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_5IN65F_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_5IN65F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_5IN65F_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
|
||||
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, "<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);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
printf("e-Paper Sleep...\r\n");
|
||||
EPD_5IN65F_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
218
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79_test.c
Normal file
218
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79_test.c
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in79_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.79inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-03-05
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in79.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_5in79_test(void)
|
||||
{
|
||||
printf("EPD_5in79_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in79_Init();
|
||||
EPD_5in79_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_5in79_WIDTH % 8 == 0)? (EPD_5in79_WIDTH / 8 ): (EPD_5in79_WIDTH / 8 + 1)) * EPD_5in79_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in79_WIDTH, EPD_5in79_HEIGHT, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
EPD_5in79_Init_Fast();
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
EPD_5in79_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in79.bmp", 0, 0);
|
||||
EPD_5in79_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
EPD_5in79_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
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_DrawPoint(10, 110, 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_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_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(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in79_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
|
||||
//If you did not use EPD_5in79_Display_Base_color or EPD_5in79_Display_Base to refresh previously,
|
||||
//you will need to use these two functions for a refresh, or the local brush display will be problematic
|
||||
|
||||
// EPD_5in79_Display_Base_color(WHITE);
|
||||
// EPD_5in79_Display_Base(BlackImage);
|
||||
EPD_5in79_Init_Partial();
|
||||
Paint_NewImage(BlackImage, 120, 50, 0, WHITE);
|
||||
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_SetScale(2);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 15;
|
||||
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_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_5in79_Display_Partial(BlackImage, 50, 100, 170, 150); // Xstart must be a multiple of 8
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_5in79_WIDTH % 4 == 0)? (EPD_5in79_WIDTH / 4 ): (EPD_5in79_WIDTH / 4 + 1)) * EPD_5in79_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_5in79_Init_4Gray();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in79_WIDTH, EPD_5in79_HEIGHT, 90, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
|
||||
EPD_5in79_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_5in79_WIDTH, EPD_5in79_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/5in79_Scale.bmp", 0, 0);
|
||||
|
||||
EPD_5in79_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in79_Init();
|
||||
EPD_5in79_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in79_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
134
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79b_test.c
Normal file
134
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79b_test.c
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in79b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-03-05
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in79b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_5in79b_test(void)
|
||||
{
|
||||
printf("EPD_5in79b_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in79b_Init();
|
||||
EPD_5in79b_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_5in79b_WIDTH % 8 == 0)? (EPD_5in79b_WIDTH / 8 ): (EPD_5in79b_WIDTH / 8 + 1)) * EPD_5in79b_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_5in79b_WIDTH, EPD_5in79b_HEIGHT, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5in79b_WIDTH, EPD_5in79b_HEIGHT, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
// printf("show window BMP-----------------\r\n");
|
||||
// Paint_SelectImage(BlackImage);
|
||||
// GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
// Paint_SelectImage(RYImage);
|
||||
// Paint_Clear(WHITE);
|
||||
// EPD_5in79b_Display(BlackImage, RYImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in79b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/5in79b_r.bmp", 0, 0);
|
||||
EPD_5in79b_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in79b_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in79b_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in79b_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
140
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79g_test.c
Normal file
140
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in79g_test.c
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in79g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.79inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-03-19
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in79g.h"
|
||||
|
||||
int EPD_5in79g_test(void)
|
||||
{
|
||||
printf("EPD_5in79g_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in79g_Init();
|
||||
EPD_5in79g_Clear(EPD_5in79G_WHITE);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_5in79G_WIDTH % 4 == 0)? (EPD_5in79G_WIDTH / 4 ):(EPD_5in79G_WIDTH / 4 + 1)) * EPD_5in79G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in79G_WIDTH, EPD_5in79G_HEIGHT, 180, WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/5in79g.bmp", 0, 0);
|
||||
EPD_5in79g_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_5in79G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_5in79G_BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_5in79G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_5in79G_RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_5in79G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_5in79G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_5in79G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_5in79G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_5in79G_RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_5in79G_RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_5in79G_BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_5in79G_WHITE, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 10, "Red, yellow, white and black", &Font16, EPD_5in79G_BLACK, EPD_5in79G_WHITE);
|
||||
Paint_DrawString_EN(10, 30, "Four color e-Paper", &Font12, EPD_5in79G_WHITE, EPD_5in79G_RED);
|
||||
Paint_DrawString_CN(10, 125, "΢ѩµç×Ó", &Font24CN, EPD_5in79G_BLACK, EPD_5in79G_YELLOW);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_5in79G_BLACK, EPD_5in79G_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in79g_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_5in79G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 16;
|
||||
hWidth = EPD_5in79G_HEIGHT/hNumber; // 368/16=23
|
||||
vNumber = 16;
|
||||
vWidth = EPD_5in79G_WIDTH/vNumber; // 512/16=32
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_5in79G_WIDTH, hWidth*(1+i), EPD_5in79G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_5in79G_HEIGHT, EPD_5in79G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in79g_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in79g_Clear(EPD_5in79G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in79g_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
209
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83_V2_test.c
Normal file
209
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83_V2_test.c
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2025-12-03
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83_V2.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_5in83_V2_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in83_V2_Init();
|
||||
EPD_5in83_V2_Clear();
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_5in83_V2_WIDTH % 8 == 0)? (EPD_5in83_V2_WIDTH / 8 ): (EPD_5in83_V2_WIDTH / 8 + 1)) * EPD_5in83_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
EPD_5in83_V2_Init();
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83_V2.bmp", 0, 0);
|
||||
EPD_5in83_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
EPD_5in83_V2_Init_Fast();
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in83_V2);
|
||||
EPD_5in83_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
EPD_5in83_V2_Init();
|
||||
Paint_NewImage(BlackImage, EPD_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 0, WHITE);
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in83_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
EPD_5in83_V2_Init_Part();
|
||||
Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
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(0, 0, Font20.Width * 7, Font20.Height, WHITE);
|
||||
Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_5in83_V2_Display_Partial(BlackImage, 150, 300, 150 + Font20.Width * 7, 300 + Font20.Height);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 1 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_5in83_V2_WIDTH % 4 == 0)? (EPD_5in83_V2_WIDTH / 4 ): (EPD_5in83_V2_WIDTH / 4 + 1)) * EPD_5in83_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
EPD_5in83_V2_Init_4GRAY();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_DrawPoint(5, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(15, 70, 65, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(65, 70, 15, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(15, 70, 65, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(75, 70, 125, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(40, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(100, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(80, 95, 120, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(100, 75, 100, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(5, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(5, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(5, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(130, 20,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(130, 40,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(130, 60,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(5, 130, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_5in83_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
Paint_NewImage(BlackImage, EPD_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp_4Gray("./pic/5in83_V2_4Gray.bmp", 0, 0);
|
||||
EPD_5in83_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in83_V2_Init();
|
||||
EPD_5in83_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in83_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83_test.c
Normal file
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83_test.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83.h"
|
||||
|
||||
int EPD_5in83_test(void)
|
||||
{
|
||||
printf("EPD_5IN83_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83_Init();
|
||||
EPD_5IN83_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_5IN83_WIDTH % 8 == 0)? (EPD_5IN83_WIDTH / 8 ): (EPD_5IN83_WIDTH / 8 + 1)) * EPD_5IN83_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5IN83_WIDTH, EPD_5IN83_HEIGHT, 180, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83.bmp", 0, 0);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in83);
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 0 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83b_V2_test.c
Normal file
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83b_V2_test.c
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B V2 e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-07-04
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83b_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_5in83b_V2_test(void)
|
||||
{
|
||||
printf("EPD_5in83b_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83B_V2_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_5IN83B_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_5IN83B_V2_WIDTH % 8 == 0)? (EPD_5IN83B_V2_WIDTH / 8 ): (EPD_5IN83B_V2_WIDTH / 8 + 1)) * EPD_5IN83B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_5IN83B_V2_WIDTH, EPD_5IN83B_V2_HEIGHT, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_5IN83B_V2_WIDTH, EPD_5IN83B_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83b_V2_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/5in83b_V2_r.bmp", 0, 0);
|
||||
EPD_5IN83B_V2_Display(BlackImage, RYImage);
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_5IN83B_V2_Display(gImage_5in83b_V2_b, gImage_5in83b_V2_r);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83bc_test.c
Normal file
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in83bc_test.c
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in83bc.h"
|
||||
|
||||
int EPD_5in83bc_test(void)
|
||||
{
|
||||
printf("EPD_5IN83BC_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5IN83BC_Init();
|
||||
EPD_5IN83BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//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) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == 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);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_5IN83BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/5in83bc-ry.bmp", 0, 0);
|
||||
EPD_5IN83BC_Display(BlackImage, RYImage);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_5IN83BC_Display(gImage_5in83bc_b, gImage_5in83bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5IN83BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5IN83BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5IN83BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
123
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in84_test.c
Normal file
123
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_5in84_test.c
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in84_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.84inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-08
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in84.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_5in84_test(void)
|
||||
{
|
||||
printf("EPD_5IN84_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in84_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_5in84_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_5in84_WIDTH % 8 == 0)? (EPD_5in84_WIDTH / 8 ): (EPD_5in84_WIDTH / 8 + 1)) * EPD_5in84_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in84_WIDTH, EPD_5in84_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in84_2.bmp", 0, 0);
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in84);
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in84_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in84_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
123
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3e_test.c
Normal file
123
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3e_test.c
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in3e_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.3inch e-Paper (F) Demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-10-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in3e.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_7in3e_test(void)
|
||||
{
|
||||
printf("EPD_7IN3E_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN3E_Init();
|
||||
EPD_7IN3E_Clear(EPD_7IN3E_WHITE); // WHITE
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_7IN3E_WIDTH % 2 == 0)? (EPD_7IN3E_WIDTH / 2 ): (EPD_7IN3E_WIDTH / 2 + 1)) * EPD_7IN3E_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN3E_WIDTH, EPD_7IN3E_HEIGHT, 0, EPD_7IN3E_WHITE);
|
||||
Paint_SetScale(6);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp1-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3E_WHITE);
|
||||
GUI_ReadBmp_RGB_6Color("./pic/7in3e.bmp", 0, 0);
|
||||
EPD_7IN3E_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_7IN3E_WIDTH, EPD_7IN3E_HEIGHT, 0, EPD_7IN3E_WHITE);
|
||||
Paint_SetScale(6);
|
||||
// 1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3E_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_7IN3E_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_7IN3E_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_7IN3E_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_7IN3E_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(10, 160, "ÄãºÃabc", &Font12CN, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_CN(10, 180, "΢ѩµç×Ó", &Font24CN, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(400, 0, "waveshare", &Font16, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_EN(400, 20, "waveshare", &Font16, EPD_7IN3E_GREEN, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_EN(400, 40, "waveshare", &Font16, EPD_7IN3E_BLUE, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_EN(400, 60, "waveshare", &Font16, EPD_7IN3E_RED, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_EN(400, 80, "waveshare", &Font16, EPD_7IN3E_YELLOW, EPD_7IN3E_WHITE);
|
||||
Paint_DrawString_EN(150, 0, "hello world", &Font24, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(150, 30, "hello world", &Font24, EPD_7IN3E_GREEN, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(150, 60, "hello world", &Font24, EPD_7IN3E_BLUE, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(150, 90, "hello world", &Font24, EPD_7IN3E_RED, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(150, 120, "hello world", &Font24, EPD_7IN3E_YELLOW, EPD_7IN3E_BLACK);
|
||||
Paint_DrawString_EN(150, 180, "hello world", &Font24, EPD_7IN3E_BLACK, EPD_7IN3E_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3E_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN3E_Clear(EPD_7IN3E_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN3E_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3f_test.c
Normal file
162
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3f_test.c
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in3f_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.3inch e-Paper (F) Demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-10-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in3f.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_7in3f_test(void)
|
||||
{
|
||||
printf("EPD_7IN3F_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN3F_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_7IN3F_Clear(EPD_7IN3F_WHITE); // WHITE
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_7IN3F_WIDTH % 2 == 0)? (EPD_7IN3F_WIDTH / 2 ): (EPD_7IN3F_WIDTH / 2 + 1)) * EPD_7IN3F_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN3F_WIDTH, EPD_7IN3F_HEIGHT, 0, EPD_7IN3F_WHITE);
|
||||
Paint_SetScale(7);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp1-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/7in3f3.bmp", 0, 0);
|
||||
EPD_7IN3F_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp2------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/7in3f1.bmp", 0, 0);
|
||||
EPD_7IN3F_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
// 1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_7IN3F_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_7IN3F_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_7IN3F_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_7IN3F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(10, 160, "<EFBFBD><EFBFBD><EFBFBD>Abc", &Font12CN, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_CN(10, 180, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(400, 0, "waveshare", &Font16, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(400, 20, "waveshare", &Font16, EPD_7IN3F_GREEN, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(400, 40, "waveshare", &Font16, EPD_7IN3F_BLUE, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(400, 60, "waveshare", &Font16, EPD_7IN3F_RED, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(400, 80, "waveshare", &Font16, EPD_7IN3F_YELLOW, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(400, 100, "waveshare", &Font16, EPD_7IN3F_ORANGE, EPD_7IN3F_WHITE);
|
||||
Paint_DrawString_EN(150, 0, "hello world", &Font24, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 30, "hello world", &Font24, EPD_7IN3F_GREEN, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 60, "hello world", &Font24, EPD_7IN3F_BLUE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 90, "hello world", &Font24, EPD_7IN3F_RED, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 120, "hello world", &Font24, EPD_7IN3F_YELLOW, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 150, "hello world", &Font24, EPD_7IN3F_ORANGE, EPD_7IN3F_BLACK);
|
||||
Paint_DrawString_EN(150, 180, "hello world", &Font24, EPD_7IN3F_BLACK, EPD_7IN3F_YELLOW);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3F_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 10;
|
||||
hWidth = EPD_7IN3F_HEIGHT/hNumber; // 480/10=48
|
||||
vNumber = 20;
|
||||
vWidth = EPD_7IN3F_WIDTH/vNumber; // 800/20=40
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_7IN3F_WIDTH, hWidth*(1+i), EPD_7IN3F_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_7IN3F_HEIGHT, EPD_7IN3F_GREEN + (i%5), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3F_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN3F_Clear(EPD_7IN3F_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN3F_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3g_test.c
Normal file
141
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in3g_test.c
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in3g_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.3inch e-paper (G) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2022-07-22
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in3g.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_7in3g_test(void)
|
||||
{
|
||||
printf("EPD_7IN3G_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN3G_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
EPD_7IN3G_Clear(EPD_7IN3G_WHITE);
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
printf("%ld S\r\n", finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_7IN3G_WIDTH % 4 == 0)? (EPD_7IN3G_WIDTH / 4 ): (EPD_7IN3G_WIDTH / 4 + 1)) * EPD_7IN3G_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN3G_WIDTH, EPD_7IN3G_HEIGHT, 0, EPD_7IN3G_WHITE);
|
||||
Paint_SetScale(4);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp_RGB_4Color("./pic/7.3inch-1.bmp", 0, 0);
|
||||
EPD_7IN3G_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3G_WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, EPD_7IN3G_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, EPD_7IN3G_YELLOW, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, EPD_7IN3G_BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3G_RED, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, EPD_7IN3G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, EPD_7IN3G_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3G_RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3G_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "Red, yellow, white and black", &Font16, EPD_7IN3G_RED, EPD_7IN3G_YELLOW);
|
||||
Paint_DrawString_EN(10, 35, "Four color e-Paper", &Font12, EPD_7IN3G_YELLOW, EPD_7IN3G_BLACK);
|
||||
Paint_DrawString_CN(10, 125, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_7IN3G_RED, EPD_7IN3G_WHITE);
|
||||
Paint_DrawNum(10, 50, 123456, &Font12, EPD_7IN3G_RED, EPD_7IN3G_WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(EPD_7IN3G_WHITE);
|
||||
|
||||
int hNumber, hWidth, vNumber, vWidth;
|
||||
hNumber = 50;
|
||||
hWidth = EPD_7IN3G_HEIGHT/hNumber; // 800/50=16
|
||||
vNumber = 48;
|
||||
vWidth = EPD_7IN3G_WIDTH/vNumber; // 480/48=10
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
for(int i=0; i<hNumber; i++) { // horizontal
|
||||
Paint_DrawRectangle(1, 1+i*hWidth, EPD_7IN3G_WIDTH, hWidth*(1+i), EPD_7IN3G_BLACK + (i % 2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
for(int i=0; i<vNumber; i++) { // vertical
|
||||
if(i%2) {
|
||||
Paint_DrawRectangle(1+i*vWidth, 1, vWidth*(i+1), EPD_7IN3G_HEIGHT, EPD_7IN3G_YELLOW + (i/2%2), DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN3G_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN3G_Clear(EPD_7IN3G_WHITE);
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN3G_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
122
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_HD_test.c
Normal file
122
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_HD_test.c
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_HD_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5_HD.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_7in5_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_HD_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_7IN5_HD_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("Clear Time: %ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_7IN5_HD_WIDTH % 8 == 0)? (EPD_7IN5_HD_WIDTH / 8 ): (EPD_7IN5_HD_WIDTH / 8 + 1)) * EPD_7IN5_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_HD_WIDTH, EPD_7IN5_HD_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_7IN5_HD_Display(BlackImage);
|
||||
// DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/7in5_HD.bmp", 0, 0);
|
||||
EPD_7IN5_HD_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5_HD_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_HD_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");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
216
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test.c
Normal file
216
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test.c
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2023-12-18
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_7in5_V2_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_7IN5_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0)? (EPD_7IN5_V2_WIDTH / 8 ): (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/800x480.bmp", 0, 0);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
EPD_7IN5_V2_Init_Fast();
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_7in5_V2);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
// EPD_7IN5_V2_Init();
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
EPD_7IN5_V2_Init_Part();
|
||||
Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(0, 0, Font20.Width * 7, Font20.Height, WHITE);
|
||||
Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_7IN5_V2_Display_Part(BlackImage, 150, 80, 150 + Font20.Width * 7, 80 + Font20.Height);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
The feature will only be available on screens sold after 24/10/23
|
||||
*/
|
||||
#if 0 // show image for array
|
||||
free(BlackImage);
|
||||
printf("show Gray------------------------\r\n");
|
||||
Imagesize = ((EPD_7IN5_V2_WIDTH % 4 == 0)? (EPD_7IN5_V2_WIDTH / 4 ): (EPD_7IN5_V2_WIDTH / 4 + 1)) * EPD_7IN5_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
EPD_7IN5_V2_Init_4Gray();
|
||||
printf("4 grayscale display\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(0xff);
|
||||
|
||||
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
EPD_7IN5_V2_Display_4Gray(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_V2_Init();
|
||||
EPD_7IN5_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
175
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test_old.c
Normal file
175
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test_old.c
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2023-12-18
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5_V2_old.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_7in5_V2_test_old(void)
|
||||
{
|
||||
printf("EPD_7IN5_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_7IN5_V2_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0)? (EPD_7IN5_V2_WIDTH / 8 ): (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/800x480.bmp", 0, 0);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5_V2_Init_Fast();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_7in5_V2);
|
||||
EPD_7IN5_V2_Display_Fast(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
EPD_7IN5_V2_Init_Fast();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
EPD_7IN5_V2_Init_Partial();
|
||||
Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(0, 0, Font20.Width * 7, Font20.Height, WHITE);
|
||||
Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_7IN5_V2_Display_Partial(BlackImage, 150, 80, 150 + Font20.Width * 7, 80 + Font20.Height);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_V2_Init();
|
||||
EPD_7IN5_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_V2_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_test.c
Normal file
125
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5_test.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5.h"
|
||||
|
||||
int EPD_7in5_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_Init();
|
||||
EPD_7IN5_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_7IN5_WIDTH % 8 == 0)? (EPD_7IN5_WIDTH / 8 ): (EPD_7IN5_WIDTH / 8 + 1)) * EPD_7IN5_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_WIDTH, EPD_7IN5_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/7in5.bmp", 0, 0);
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_7in5);
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(500);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
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(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_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");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5b_HD_test.c
Normal file
145
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5b_HD_test.c
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5b_HD_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-27
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5b_HD.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_7in5b_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_HD_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
|
||||
EPD_7IN5B_HD_Clear();
|
||||
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_HD_WIDTH % 8 == 0)? (EPD_7IN5B_HD_WIDTH / 8 ): (EPD_7IN5B_HD_WIDTH / 8 + 1)) * EPD_7IN5B_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_7IN5B_HD_WIDTH, EPD_7IN5B_HD_HEIGHT , 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5B_HD_WIDTH, EPD_7IN5B_HD_HEIGHT , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 200, 0);
|
||||
EPD_7IN5B_HD_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/7in5B_HD_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/7in5B_HD_r.bmp", 0, 0);
|
||||
EPD_7IN5B_HD_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "ABCDEFG", &Font16, BLACK, WHITE);
|
||||
// Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_HD_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_HD_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
184
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5b_V2_test.c
Normal file
184
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5b_V2_test.c
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper (B) test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2024-08-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5b_V2.h"
|
||||
|
||||
int EPD_7in5b_V2_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_V2_Init();
|
||||
EPD_7IN5B_V2_Clear();
|
||||
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_V2_WIDTH % 8 == 0)? (EPD_7IN5B_V2_WIDTH / 8 ): (EPD_7IN5B_V2_WIDTH / 8 + 1)) * EPD_7IN5B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 50, 100);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 350, 100);
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/7in5_V2_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/7in5_V2_r.bmp", 0, 0);
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5B_V2_Init_Fast();
|
||||
EPD_7IN5B_V2_Display(gImage_7in5_V2_b, gImage_7in5_V2_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
EPD_7IN5B_V2_Init();
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
EPD_7IN5B_V2_Init_Part();
|
||||
EPD_7IN5B_V2_Display_Base_color(WHITE);
|
||||
Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE);
|
||||
Debug("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
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(0, 0, Font20.Width * 7, Font20.Height, WHITE);
|
||||
Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_7IN5B_V2_Display_Partial(BlackImage, 10, 130, 10 + Font20.Width * 7, 130 + Font20.Height);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_V2_Init();
|
||||
EPD_7IN5B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5b_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-11-30
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5b_V2_old.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_7in5b_V2_test_old(void)
|
||||
{
|
||||
printf("EPD_7IN5B_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_V2_Init();
|
||||
EPD_7IN5B_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_V2_WIDTH % 8 == 0)? (EPD_7IN5B_V2_WIDTH / 8 ): (EPD_7IN5B_V2_WIDTH / 8 + 1)) * EPD_7IN5B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
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_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 50, 100);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 350, 100);
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/7in5_V2_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/7in5_V2_r.bmp", 0, 0);
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5B_V2_Display(gImage_7in5_V2_b, gImage_7in5_V2_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5bc_test.c
Normal file
138
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_7in5bc_test.c
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5bc.h"
|
||||
|
||||
int EPD_7in5bc_test(void)
|
||||
{
|
||||
printf("EPD_7IN5BC_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5BC_Init();
|
||||
EPD_7IN5BC_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5BC_WIDTH % 8 == 0)? (EPD_7IN5BC_WIDTH / 8 ): (EPD_7IN5BC_WIDTH / 8 + 1)) * EPD_7IN5BC_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize / 2)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_7IN5BC_WIDTH, EPD_7IN5BC_HEIGHT / 2, 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5BC_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show red bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/7in5b-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/7in5b-r.bmp", 0, 0);
|
||||
EPD_7IN5BC_Display(BlackImage, RYImage);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_7IN5BC_Display(gImage_7in5bc_b, gImage_7in5bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
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_DrawPoint(10, 110, 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_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, 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_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5BC_DisplayHalfScreen(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5BC_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5BC_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
132
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_Test.h
Normal file
132
e-Paper/RaspberryPi_JetsonNano/c/examples/EPD_Test.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_Test.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : e-Paper test Demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.1
|
||||
* | Date : 2022-07-28
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef _EPD_TEST_H_
|
||||
#define _EPD_TEST_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
#include "GUI_Paint.h"
|
||||
#include "GUI_BMPfile.h"
|
||||
#include "ImageData.h"
|
||||
#include "Debug.h"
|
||||
#include <stdlib.h> // malloc() free()
|
||||
|
||||
int EPD_1in64g_test(void);
|
||||
int EPD_2in36g_test(void);
|
||||
int EPD_3in0g_test(void);
|
||||
int EPD_4in37g_test(void);
|
||||
int EPD_7in3g_test(void);
|
||||
|
||||
int EPD_1in54_DES_test(void);
|
||||
int EPD_2in13_DES_test(void);
|
||||
int EPD_2in9_DES_test(void);
|
||||
|
||||
int EPD_1in02d_test(void);
|
||||
|
||||
int EPD_1in54_test(void);
|
||||
int EPD_1in54_V2_test(void);
|
||||
int EPD_1in54b_test(void);
|
||||
int EPD_1in54b_V2_test(void);
|
||||
int EPD_1in54c_test(void);
|
||||
|
||||
int EPD_2in66_test(void);
|
||||
int EPD_2in66b_test(void);
|
||||
int EPD_2in66g_test(void);
|
||||
|
||||
int EPD_2in7_test(void);
|
||||
int EPD_2in7_V2_test(void);
|
||||
int EPD_2in7b_test(void);
|
||||
int EPD_2in7b_V2_test(void);
|
||||
|
||||
int EPD_2in9_test(void);
|
||||
int EPD_2in9_V2_test(void);
|
||||
int EPD_2in9bc_test(void);
|
||||
int EPD_2in9b_V3_test(void);
|
||||
int EPD_2in9b_V4_test(void);
|
||||
int EPD_2in9d_test(void);
|
||||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13_V3_test(void);
|
||||
int EPD_2in13_V4_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13b_V3_test(void);
|
||||
int EPD_2in13b_V4_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
int EPD_2in13g_test(void);
|
||||
|
||||
int EPD_2in15b_test(void);
|
||||
int EPD_2in15g_test(void);
|
||||
|
||||
int EPD_3in52_test(void);
|
||||
|
||||
int EPD_3in7_test(void);
|
||||
|
||||
int EPD_4in01f_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
int EPD_4in2_V2_test(void);
|
||||
int EPD_4in2bc_test(void);
|
||||
int EPD_4in2b_V2_test(void);
|
||||
int EPD_4in2b_V2_test_old(void);
|
||||
|
||||
int EPD_4in26_test(void);
|
||||
|
||||
int EPD_4in37b_test(void);
|
||||
|
||||
int EPD_5in65f_test(void);
|
||||
|
||||
int EPD_5in79_test(void);
|
||||
int EPD_5in79b_test(void);
|
||||
int EPD_5in79g_test(void);
|
||||
|
||||
int EPD_5in83_test(void);
|
||||
int EPD_5in83_V2_test(void);
|
||||
int EPD_5in83bc_test(void);
|
||||
int EPD_5in83b_V2_test(void);
|
||||
|
||||
int EPD_5in84_test(void);
|
||||
|
||||
int EPD_7in3e_test(void);
|
||||
int EPD_7in3f_test(void);
|
||||
|
||||
int EPD_7in5_test(void);
|
||||
int EPD_7in5_HD_test(void);
|
||||
int EPD_7in5_V2_test(void);
|
||||
int EPD_7in5_V2_test_old(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
int EPD_7in5b_V2_test(void);
|
||||
int EPD_7in5b_V2_test_old(void);
|
||||
int EPD_7in5b_HD_test(void);
|
||||
|
||||
int EPD_10in2b_test(void);
|
||||
|
||||
int EPD_13in3b_test(void);
|
||||
int EPD_13in3k_test(void);
|
||||
#endif
|
||||
56320
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData.c
Normal file
56320
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData.c
Normal file
File diff suppressed because it is too large
Load diff
96
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData.h
Normal file
96
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*****************************************************************************
|
||||
* | File : ImageData.h
|
||||
* | Author : Waveshare team
|
||||
* | Function :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2018-10-23
|
||||
* | Info :
|
||||
*
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _IMAGEDATA_H_
|
||||
#define _IMAGEDATA_H_
|
||||
// ImageData2
|
||||
extern const unsigned char gImage_2in13b_V4b[];
|
||||
extern const unsigned char gImage_2in13b_V4r[];
|
||||
|
||||
|
||||
/* ------------------------------------------------ */
|
||||
// Imagedata
|
||||
extern const unsigned char flagimage[];
|
||||
extern const unsigned char gImage_2in13_2[];
|
||||
|
||||
extern const unsigned char gImage_1in02d[];
|
||||
|
||||
extern const unsigned char gImage_1in54[];
|
||||
extern const unsigned char gImage_1in54b_Black[];
|
||||
extern const unsigned char gImage_1in54b_Red[];
|
||||
extern const unsigned char gImage_1in54c_Black[];
|
||||
extern const unsigned char gImage_1in54c_Yellow[];
|
||||
|
||||
extern const unsigned char gImage_2in7[];
|
||||
extern const unsigned char gImage_2in7b_Black[5808];
|
||||
extern const unsigned char gImage_2in7b_Red[5808];
|
||||
extern const unsigned char gImage_2in7_4Gray[];
|
||||
extern const unsigned char gImage_2in7_4Gray1[];
|
||||
|
||||
extern const unsigned char gImage_2in9[];
|
||||
extern const unsigned char gImage_2in9bc_b[];
|
||||
extern const unsigned char gImage_2in9bc_ry[];
|
||||
|
||||
extern const unsigned char gImage_2in13[];
|
||||
extern const unsigned char gImage_2in13b_b[];
|
||||
extern const unsigned char gImage_2in13b_r[];
|
||||
extern const unsigned char gImage_2in13c_b[];
|
||||
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[];
|
||||
|
||||
extern const unsigned char gImage_5in83[];
|
||||
extern const unsigned char gImage_5in83_V2[];
|
||||
extern const unsigned char gImage_5in83bc_b[];
|
||||
extern const unsigned char gImage_5in83bc_ry[];
|
||||
extern const unsigned char gImage_5in83b_V2_b[];
|
||||
extern const unsigned char gImage_5in83b_V2_r[];
|
||||
|
||||
extern const unsigned char gImage_5in84[];
|
||||
|
||||
extern const unsigned char gImage_7in5[];
|
||||
extern const unsigned char gImage_7in5_V2[];
|
||||
extern const unsigned char gImage_7in5bc_b[];
|
||||
extern const unsigned char gImage_7in5bc_ry[];
|
||||
extern const unsigned char gImage_7in5_V2_b[];
|
||||
extern const unsigned char gImage_7in5_V2_ry[];
|
||||
|
||||
extern const unsigned char gImage_13in3k[];
|
||||
|
||||
#endif
|
||||
/* FILE END */
|
||||
|
||||
|
||||
5652
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData2.c
Normal file
5652
e-Paper/RaspberryPi_JetsonNano/c/examples/ImageData2.c
Normal file
File diff suppressed because it is too large
Load diff
235
e-Paper/RaspberryPi_JetsonNano/c/examples/main.c
Normal file
235
e-Paper/RaspberryPi_JetsonNano/c/examples/main.c
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
#include <stdlib.h> //exit()
|
||||
#include <signal.h> //signal()
|
||||
#include "EPD_Test.h" //Examples
|
||||
|
||||
void Handler(int signo)
|
||||
{
|
||||
//System Exit
|
||||
printf("\r\nHandler:exit\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Exception handling:ctrl + c
|
||||
signal(SIGINT, Handler);
|
||||
|
||||
#ifdef epd1in64g
|
||||
EPD_1in64g_test();
|
||||
|
||||
#elif epd2in36g
|
||||
EPD_2in36g_test();
|
||||
|
||||
#elif epd3in0g
|
||||
EPD_3in0g_test();
|
||||
|
||||
#elif epd4in37g
|
||||
EPD_4in37g_test();
|
||||
|
||||
#elif epd7in3g
|
||||
EPD_7in3g_test();
|
||||
|
||||
#elif epd1in54des
|
||||
EPD_1in54_DES_test();
|
||||
|
||||
#elif epd2in13des
|
||||
EPD_2in13_DES_test();
|
||||
|
||||
#elif epd2in9des
|
||||
EPD_2in9_DES_test();
|
||||
|
||||
#elif epd1in02d
|
||||
EPD_1in02d_test();
|
||||
|
||||
#elif epd1in54
|
||||
EPD_1in54_test();
|
||||
|
||||
#elif epd1in54V2
|
||||
EPD_1in54_V2_test();
|
||||
|
||||
#elif epd1in54b
|
||||
EPD_1in54b_test();
|
||||
|
||||
#elif epd1in54bV2
|
||||
EPD_1in54b_V2_test();
|
||||
|
||||
#elif epd1in54c
|
||||
EPD_1in54c_test();
|
||||
|
||||
#elif epd2in66
|
||||
EPD_2in66_test();
|
||||
|
||||
#elif epd2in66b
|
||||
EPD_2in66b_test();
|
||||
|
||||
#elif epd2in66g
|
||||
EPD_2in66g_test();
|
||||
|
||||
#elif epd2in7
|
||||
EPD_2in7_test();
|
||||
|
||||
#elif epd2in7V2
|
||||
EPD_2in7_V2_test();
|
||||
|
||||
#elif epd2in7b
|
||||
EPD_2in7b_test();
|
||||
|
||||
#elif epd2in7bV2
|
||||
EPD_2in7b_V2_test();
|
||||
|
||||
#elif epd2in9
|
||||
EPD_2in9_test();
|
||||
|
||||
#elif epd2in9V2
|
||||
EPD_2in9_V2_test();
|
||||
|
||||
#elif epd2in9bc
|
||||
EPD_2in9bc_test();
|
||||
|
||||
#elif epd2in9bV3
|
||||
EPD_2in9b_V3_test();
|
||||
|
||||
#elif epd2in9bV4
|
||||
EPD_2in9b_V4_test();
|
||||
|
||||
#elif epd2in9d
|
||||
EPD_2in9d_test();
|
||||
|
||||
#elif epd2in13
|
||||
EPD_2in13_test();
|
||||
|
||||
#elif epd2in13V2
|
||||
EPD_2in13_V2_test();
|
||||
|
||||
#elif epd2in13V3
|
||||
EPD_2in13_V3_test();
|
||||
|
||||
#elif epd2in13V4
|
||||
EPD_2in13_V4_test();
|
||||
|
||||
#elif epd2in13bc
|
||||
EPD_2in13bc_test();
|
||||
|
||||
#elif epd2in13bV3
|
||||
EPD_2in13b_V3_test();
|
||||
|
||||
#elif epd2in13bV4
|
||||
EPD_2in13b_V4_test();
|
||||
|
||||
#elif epd2in13d
|
||||
EPD_2in13d_test();
|
||||
|
||||
#elif epd2in13g
|
||||
EPD_2in13g_test();
|
||||
|
||||
#elif epd2in15b
|
||||
EPD_2in15b_test();
|
||||
|
||||
#elif epd2in15g
|
||||
EPD_2in15g_test();
|
||||
|
||||
#elif epd3in52
|
||||
EPD_3in52_test();
|
||||
|
||||
#elif epd3in7
|
||||
EPD_3in7_test();
|
||||
|
||||
#elif epd4in01f
|
||||
EPD_4in01f_test();
|
||||
|
||||
#elif epd4in2
|
||||
EPD_4in2_test();
|
||||
|
||||
#elif epd4in2V2
|
||||
EPD_4in2_V2_test();
|
||||
|
||||
#elif epd4in2bc
|
||||
EPD_4in2bc_test();
|
||||
|
||||
#elif epd4in2bV2
|
||||
EPD_4in2b_V2_test();
|
||||
|
||||
#elif epd4in2bV2_old
|
||||
EPD_4in2b_V2_test_old();
|
||||
|
||||
#elif epd4in26
|
||||
EPD_4in26_test();
|
||||
|
||||
#elif epd4in37b
|
||||
EPD_4in37b_test();
|
||||
|
||||
#elif epd5in65f
|
||||
EPD_5in65f_test();
|
||||
|
||||
#elif epd5in79
|
||||
EPD_5in79_test();
|
||||
|
||||
#elif epd5in79b
|
||||
EPD_5in79b_test();
|
||||
|
||||
#elif epd5in79g
|
||||
EPD_5in79g_test();
|
||||
|
||||
#elif epd5in83
|
||||
EPD_5in83_test();
|
||||
|
||||
#elif epd5in83V2
|
||||
EPD_5in83_V2_test();
|
||||
|
||||
#elif epd5in83bc
|
||||
EPD_5in83bc_test();
|
||||
|
||||
#elif epd5in83bV2
|
||||
EPD_5in83b_V2_test();
|
||||
|
||||
#elif epd5in84
|
||||
EPD_5in84_test();
|
||||
|
||||
#elif epd7in3e
|
||||
EPD_7in3e_test();
|
||||
|
||||
#elif epd7in3f
|
||||
EPD_7in3f_test();
|
||||
|
||||
#elif epd7in5
|
||||
EPD_7in5_test();
|
||||
|
||||
#elif epd7in5V2
|
||||
EPD_7in5_V2_test();
|
||||
|
||||
#elif epd7in5V2_old
|
||||
EPD_7in5_V2_test_old();
|
||||
|
||||
#elif epd7in5bc
|
||||
EPD_7in5bc_test();
|
||||
|
||||
#elif epd7in5bV2
|
||||
EPD_7in5b_V2_test();
|
||||
|
||||
#elif epd7in5bV2_old
|
||||
EPD_7in5b_V2_test_old();
|
||||
|
||||
#elif epd7in5HD
|
||||
EPD_7in5_HD_test();
|
||||
|
||||
#elif epd7in5bHD
|
||||
EPD_7in5b_HD_test();
|
||||
|
||||
#elif epd10in2b
|
||||
EPD_10in2b_test();
|
||||
|
||||
#elif epd13in3b
|
||||
EPD_13in3b_test();
|
||||
|
||||
#elif epd13in3k
|
||||
EPD_13in3k_test();
|
||||
#else
|
||||
printf("Please specify the EPD model when making. \r\n");
|
||||
printf("Example: When you run the EPD_7in5_V2_test() program, input: sudo make clean && make EPD=epd7in5V2 \r\n");
|
||||
printf("Don't know which program you need to run? Refer to the user manual (Wiki) and main.c \r\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue