2020-12-10
This commit is contained in:
parent
751a9fb93f
commit
04d4621789
493 changed files with 128806 additions and 689 deletions
188
RaspberryPi_JetsonNano/c/examples/EPD_1in02d_test.c
Normal file
188
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;
|
||||
}
|
||||
|
||||
176
RaspberryPi_JetsonNano/c/examples/EPD_1in54_V2_test.c
Normal file
176
RaspberryPi_JetsonNano/c/examples/EPD_1in54_V2_test.c
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*****************************************************************************
|
||||
* | 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_Init();
|
||||
EPD_1IN54_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
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 = 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_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
RaspberryPi_JetsonNano/c/examples/EPD_1in54_test.c
Normal file
165
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 0 //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;
|
||||
}
|
||||
|
||||
136
RaspberryPi_JetsonNano/c/examples/EPD_1in54b_V2_test.c
Normal file
136
RaspberryPi_JetsonNano/c/examples/EPD_1in54b_V2_test.c
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
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();
|
||||
EPD_1IN54B_V2_Clear();
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_1in54b_test.c
Normal file
141
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
RaspberryPi_JetsonNano/c/examples/EPD_1in54c_test.c
Normal file
137
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;
|
||||
}
|
||||
|
||||
212
RaspberryPi_JetsonNano/c/examples/EPD_2in13_V2_test.c
Normal file
212
RaspberryPi_JetsonNano/c/examples/EPD_2in13_V2_test.c
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
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);
|
||||
EPD_2IN13_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_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 0 // 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 0 // 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_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, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(20000);
|
||||
#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;
|
||||
}
|
||||
|
||||
164
RaspberryPi_JetsonNano/c/examples/EPD_2in13_test.c
Normal file
164
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
RaspberryPi_JetsonNano/c/examples/EPD_2in13b_V3_test.c
Normal file
142
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;
|
||||
}
|
||||
|
||||
141
RaspberryPi_JetsonNano/c/examples/EPD_2in13bc_test.c
Normal file
141
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/2in13bc-b.bmp", 0, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
GUI_ReadBmp("./pic/2in13bc-ry.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
RaspberryPi_JetsonNano/c/examples/EPD_2in13d_test.c
Normal file
162
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;
|
||||
}
|
||||
|
||||
173
RaspberryPi_JetsonNano/c/examples/EPD_2in66_test.c
Normal file
173
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
RaspberryPi_JetsonNano/c/examples/EPD_2in66b_test.c
Normal file
125
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/f_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/f_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;
|
||||
}
|
||||
|
||||
180
RaspberryPi_JetsonNano/c/examples/EPD_2in7_test.c
Normal file
180
RaspberryPi_JetsonNano/c/examples/EPD_2in7_test.c
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
/*****************************************************************************
|
||||
* | 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"
|
||||
|
||||
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();
|
||||
EPD_2IN7_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_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;
|
||||
}
|
||||
|
||||
148
RaspberryPi_JetsonNano/c/examples/EPD_2in7b_V2_test.c
Normal file
148
RaspberryPi_JetsonNano/c/examples/EPD_2in7b_V2_test.c
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*****************************************************************************
|
||||
* | 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();
|
||||
DEV_Delay_ms(12000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
141
RaspberryPi_JetsonNano/c/examples/EPD_2in7b_test.c
Normal file
141
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(12000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
176
RaspberryPi_JetsonNano/c/examples/EPD_2in9_V2_test.c
Normal file
176
RaspberryPi_JetsonNano/c/examples/EPD_2in9_V2_test.c
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper 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_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 1 //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
|
||||
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_Base(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
|
||||
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_2in9_test.c
Normal file
171
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
RaspberryPi_JetsonNano/c/examples/EPD_2in9b_V3_test.c
Normal file
148
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;
|
||||
}
|
||||
|
||||
148
RaspberryPi_JetsonNano/c/examples/EPD_2in9bc_test.c
Normal file
148
RaspberryPi_JetsonNano/c/examples/EPD_2in9bc_test.c
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*****************************************************************************
|
||||
* | 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);
|
||||
|
||||
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_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
RaspberryPi_JetsonNano/c/examples/EPD_2in9d_test.c
Normal file
161
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 = 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_2IN9D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
// EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9D_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
RaspberryPi_JetsonNano/c/examples/EPD_3in7_test.c
Normal file
173
RaspberryPi_JetsonNano/c/examples/EPD_3in7_test.c
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/*****************************************************************************
|
||||
* | 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;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_3IN7_WIDTH % 4 == 0)? (EPD_3IN7_WIDTH / 4 ): (EPD_3IN7_WIDTH / 4 + 1)) * EPD_3IN7_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_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
|
||||
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 = 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(300, 0, 479, 80, WHITE);
|
||||
Paint_DrawTime(300, 20, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_3IN7_1Gray_Display(BlackImage);
|
||||
// EPD_3IN7_1Gray_Display_Part(BlackImage, 0, 0, 279, 180);
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
#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
RaspberryPi_JetsonNano/c/examples/EPD_4in01f_test.c
Normal file
118
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/4in01f.bmp", 0, 0);
|
||||
EPD_4IN01F_Display(BlackImage);
|
||||
// EPD_4IN01F_Display_part(BlackImage, 0, 0, 600, 260);
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_4in2_test.c
Normal file
215
RaspberryPi_JetsonNano/c/examples/EPD_4in2_test.c
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/*****************************************************************************
|
||||
* | 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>
|
||||
|
||||
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();
|
||||
EPD_4IN2_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_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 0 // show bmp
|
||||
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 0 // 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, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_4IN2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Support for partial refresh, but the refresh effect is not good, but it is not recommended\r\n");
|
||||
#if 0
|
||||
printf("Partial refresh\r\n");
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_4IN2_PartialDisplay(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
EPD_4IN2_Clear();
|
||||
EPD_4IN2_Init_4Gray();
|
||||
printf("show Gray------------------------\r\n");
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
Imagesize = ((EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 4 ): (EPD_4IN2_WIDTH / 4 + 1)) * EPD_4IN2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
Paint_SetScale(4);
|
||||
Paint_Clear(WHITE);
|
||||
#if 0
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(140, 0, "ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(140, 40, "ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(140, 80, "ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(140, 120, "ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
||||
|
||||
Paint_DrawString_CN(220, 0, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
||||
Paint_DrawString_CN(220, 40, "΢ѩµç×Ó", &Font24CN, GRAY2, GRAY3);
|
||||
Paint_DrawString_CN(220, 80, "΢ѩµç×Ó", &Font24CN, GRAY3, GRAY2);
|
||||
Paint_DrawString_CN(220, 120, "΢ѩµç×Ó", &Font24CN, GRAY4, GRAY1);
|
||||
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
#if 1
|
||||
Paint_Clear(WHITE);
|
||||
EPD_4IN2_4GrayDisplay(gImage_4in2_4Gray1);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
GUI_ReadBmp_4Gray("./pic/4in2_Scale.bmp",0 , 0);
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 20, 20);
|
||||
EPD_4IN2_4GrayDisplay(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
EPD_4IN2_Clear();
|
||||
EPD_4IN2_Init();
|
||||
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;
|
||||
}
|
||||
|
||||
146
RaspberryPi_JetsonNano/c/examples/EPD_4in2b_V2_test.c
Normal file
146
RaspberryPi_JetsonNano/c/examples/EPD_4in2b_V2_test.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*****************************************************************************
|
||||
* | 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;
|
||||
}
|
||||
|
||||
147
RaspberryPi_JetsonNano/c/examples/EPD_4in2bc_test.c
Normal file
147
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;
|
||||
}
|
||||
|
||||
121
RaspberryPi_JetsonNano/c/examples/EPD_5in65f_test.c
Normal file
121
RaspberryPi_JetsonNano/c/examples/EPD_5in65f_test.c
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/* DEV_Delay_ms(2000);//important, at least 2s/*****************************************************************************
|
||||
* | 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);
|
||||
|
||||
// EPD_5IN65F_Show7Block();
|
||||
// DEV_Delay_ms(10000);
|
||||
|
||||
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");
|
||||
Paint_Clear(EPD_5IN65F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/5in65f3.bmp", 0, 0);
|
||||
EPD_5IN65F_Display(BlackImage);
|
||||
// EPD_5IN65F_Display_part(BlackImage, 0, 0, 600, 260);
|
||||
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, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 20, "ÄãºÃabc", &Font12CN, EPD_5IN65F_GREEN, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 40, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLUE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 60, "ÄãºÃabc", &Font12CN, EPD_5IN65F_RED, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 80, "ÄãºÃabc", &Font12CN, EPD_5IN65F_YELLOW, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 100, "ÄãºÃabc", &Font12CN, EPD_5IN65F_ORANGE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(150, 0, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 40, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_GREEN, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLUE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 120, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_RED, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 160, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_YELLOW, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 200, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_ORANGE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 240, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLACK, EPD_5IN65F_YELLOW);
|
||||
|
||||
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;
|
||||
}
|
||||
123
RaspberryPi_JetsonNano/c/examples/EPD_5in83_V2_test.c
Normal file
123
RaspberryPi_JetsonNano/c/examples/EPD_5in83_V2_test.c
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in83_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-11-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_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();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_5in83_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_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, 180, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in83_V2.bmp", 0, 0);
|
||||
EPD_5in83_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_5in83_V2);
|
||||
EPD_5in83_V2_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_5in83_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_5in83_test.c
Normal file
125
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
RaspberryPi_JetsonNano/c/examples/EPD_5in83b_V2_test.c
Normal file
145
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
RaspberryPi_JetsonNano/c/examples/EPD_5in83bc_test.c
Normal file
138
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;
|
||||
}
|
||||
|
||||
125
RaspberryPi_JetsonNano/c/examples/EPD_7in5_HD_test.c
Normal file
125
RaspberryPi_JetsonNano/c/examples/EPD_7in5_HD_test.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*****************************************************************************
|
||||
* | 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)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
131
RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test.c
Normal file
131
RaspberryPi_JetsonNano/c/examples/EPD_7in5_V2_test.c
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_V2_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_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 */
|
||||
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);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_7IN5_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_7in5_V2);
|
||||
EPD_7IN5_V2_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_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_7in5_test.c
Normal file
125
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
RaspberryPi_JetsonNano/c/examples/EPD_7in5b_HD_test.c
Normal file
145
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;
|
||||
}
|
||||
|
||||
146
RaspberryPi_JetsonNano/c/examples/EPD_7in5b_V2_test.c
Normal file
146
RaspberryPi_JetsonNano/c/examples/EPD_7in5b_V2_test.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*****************************************************************************
|
||||
* | 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.h"
|
||||
#include <time.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();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_7IN5B_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_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/100x100.bmp", 10, 0);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 200, 0);
|
||||
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
RaspberryPi_JetsonNano/c/examples/EPD_7in5bc_test.c
Normal file
138
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;
|
||||
}
|
||||
|
||||
88
RaspberryPi_JetsonNano/c/examples/EPD_Test.h
Normal file
88
RaspberryPi_JetsonNano/c/examples/EPD_Test.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_Test.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#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_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_2in7_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_2in9d_test(void);
|
||||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13b_V3_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
|
||||
int EPD_3in7_test(void);
|
||||
|
||||
int EPD_4in01f_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
int EPD_4in2bc_test(void);
|
||||
int EPD_4in2b_V2_test(void);
|
||||
|
||||
int EPD_5in65f_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_7in5_test(void);
|
||||
int EPD_7in5_HD_test(void);
|
||||
int EPD_7in5_V2_test(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
int EPD_7in5b_V2_test(void);
|
||||
int EPD_7in5b_HD_test(void);
|
||||
#endif
|
||||
41073
RaspberryPi_JetsonNano/c/examples/ImageData.c
Normal file
41073
RaspberryPi_JetsonNano/c/examples/ImageData.c
Normal file
File diff suppressed because it is too large
Load diff
83
RaspberryPi_JetsonNano/c/examples/ImageData.h
Normal file
83
RaspberryPi_JetsonNano/c/examples/ImageData.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*****************************************************************************
|
||||
* | 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_
|
||||
|
||||
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_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[];
|
||||
|
||||
#endif
|
||||
/* FILE END */
|
||||
|
||||
|
||||
81
RaspberryPi_JetsonNano/c/examples/main.c
Normal file
81
RaspberryPi_JetsonNano/c/examples/main.c
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
#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);
|
||||
|
||||
// if(DEV_Module_Init()!=0){
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// EPD_1in02d_test();
|
||||
|
||||
// EPD_1in54_test();
|
||||
// EPD_1in54_V2_test();
|
||||
// EPD_1in54b_test();
|
||||
// EPD_1in54b_V2_test();
|
||||
// EPD_1in54c_test();
|
||||
|
||||
// EPD_2in66_test();
|
||||
// EPD_2in66b_test();
|
||||
|
||||
// EPD_2in7_test();
|
||||
// EPD_2in7b_test();
|
||||
// EPD_2in7b_V2_test();
|
||||
|
||||
// EPD_2in9_test();
|
||||
// EPD_2in9_V2_test();
|
||||
|
||||
// EPD_2in9bc_test();
|
||||
// EPD_2in9b_V3_test();
|
||||
// EPD_2in9d_test();
|
||||
|
||||
// EPD_2in13_test();
|
||||
// EPD_2in13_V2_test();
|
||||
// EPD_2in13bc_test();
|
||||
// EPD_2in13b_V3_test();
|
||||
// EPD_2in13d_test();
|
||||
|
||||
// EPD_3in7_test();
|
||||
|
||||
// EPD_4in01f_test();
|
||||
|
||||
// EPD_4in2_test();
|
||||
// EPD_4in2bc_test();
|
||||
// EPD_4in2b_V2_test();
|
||||
|
||||
// EPD_5in65f_test();
|
||||
|
||||
// EPD_5in83_test();
|
||||
// EPD_5in83_V2_test();
|
||||
// EPD_5in83bc_test();
|
||||
// EPD_5in83b_V2_test();
|
||||
|
||||
// EPD_5in84_test();
|
||||
|
||||
// EPD_7in5_test();
|
||||
// EPD_7in5_V2_test();
|
||||
|
||||
// EPD_7in5bc_test();
|
||||
// EPD_7in5b_V2_test();
|
||||
|
||||
// EPD_7in5_HD_test();
|
||||
// EPD_7in5b_HD_test();
|
||||
|
||||
// DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue