2019.06.24

This commit is contained in:
hnwangkg-ezio 2019-06-24 17:11:43 +08:00
commit 1f82e4a488
2990 changed files with 667957 additions and 444550 deletions

View file

@ -0,0 +1,168 @@
/*****************************************************************************
* | 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"
int EPD_1in54_V2_test(void)
{
printf("EPD_1in54_V2_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_1IN54_V2_Init();
EPD_1IN54_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_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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,163 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,139 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,135 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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, 130, 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(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_DrawCircle(45, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 30, 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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,172 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
EPD_2IN13_V2_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in13-v2.bmp", 0, 0);
EPD_2IN13_V2_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in13);
EPD_2IN13_V2_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2IN13_V2_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Partial refresh, example shows time
printf("Partial refresh\r\n");
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_DisplayPartBaseImage(BlackImage);
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2IN13_V2_DisplayPart(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Clear();
DEV_Delay_ms(2000);//Analog clock 1s
printf("Goto Sleep...\r\n");
EPD_2IN13_V2_Sleep();
free(BlackImage);
BlackImage = NULL;
DEV_Delay_ms(1000);//Analog clock 1s
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,162 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,139 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,160 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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", 10, 10);
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 1 //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 = 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_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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,125 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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();
printf("Goto Sleep...\r\n");
EPD_2IN7_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,139 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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(2000);
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(2000);
#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(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(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(2000);
#endif
printf("Clear...\r\n");
EPD_2IN7B_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN7B_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,168 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
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);
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
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,138 @@
/*****************************************************************************
* | 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"
int EPD_2in9bc_test(void)
{
printf("EPD_2IN9BC_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_2IN9BC_Init();
EPD_2IN9BC_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_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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,159 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,123 @@
/*****************************************************************************
* | 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"
int EPD_4in2_test(void)
{
printf("EPD_4IN2_test Demo\r\n");
DEV_Module_Init();
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, 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_4IN2_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
EPD_4IN2_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_4in2);
EPD_4IN2_Display(BlackImage);
DEV_Delay_ms(500);
#endif
#if 1 // Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0, " ÄãºÃ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("Clear...\r\n");
EPD_4IN2_Clear();
printf("Goto Sleep...\r\n");
EPD_4IN2_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,138 @@
/*****************************************************************************
* | 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"
int EPD_4in2bc_test(void)
{
printf("EPD_4IN2BC_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_4IN2BC_Init();
EPD_4IN2BC_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_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);
#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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,123 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,136 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,123 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,136 @@
/*****************************************************************************
* | 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");
DEV_Module_Init();
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;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,65 @@
/*****************************************************************************
* | 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_1in54_test(void);
int EPD_1in54_V2_test(void);
int EPD_1in54b_test(void);
int EPD_1in54c_test(void);
int EPD_2in7_test(void);
int EPD_2in7b_test(void);
int EPD_2in9_test(void);
int EPD_2in9bc_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_2in13d_test(void);
int EPD_4in2_test(void);
int EPD_4in2bc_test(void);
int EPD_5in83_test(void);
int EPD_5in83bc_test(void);
int EPD_7in5_test(void);
int EPD_7in5bc_test(void);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,70 @@
/*****************************************************************************
* | 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_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_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_4in2bc_b[];
extern const unsigned char gImage_4in2bc_ry[];
extern const unsigned char gImage_5in83[];
extern const unsigned char gImage_5in83bc_b[];
extern const unsigned char gImage_5in83bc_ry[];
extern const unsigned char gImage_7in5[];
extern const unsigned char gImage_7in5bc_b[];
extern const unsigned char gImage_7in5bc_ry[];
#endif
/* FILE END */

View file

@ -0,0 +1,46 @@
#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);
// EPD_1in54_test();
// EPD_1in54_V2_test();
// EPD_1in54b_test();
// EPD_1in54c_test();
// EPD_2in7_test();
EPD_2in7b_test();
// EPD_2in9_test();
// EPD_2in9bc_test();
// EPD_2in9d_test();
// EPD_2in13_test();
// EPD_2in13_V2_test();
// EPD_2in13bc_test();
// EPD_2in13d_test();
// EPD_4in2_test();
// EPD_4in2bc_test();
// EPD_5in83_test();
// EPD_5in83bc_test();
// EPD_7in5_test();
// EPD_7in5bc_test();
return 0;
}