2020.05.22
This commit is contained in:
parent
8973995e53
commit
853a3a4632
224 changed files with 26246 additions and 3145 deletions
112
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_V2_test.c
Normal file
112
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_V2_test.c
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54b_V2.h"
|
||||
|
||||
int EPD_1in54b_V2_test(void)
|
||||
{
|
||||
printf("EPD_1IN54b_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
EPD_1IN54B_V2_Init();
|
||||
EPD_1IN54B_V2_Clear();
|
||||
DEV_Delay_ms(200);
|
||||
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1)) * EPD_1IN54B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Black);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Red);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13b_V2_test.c
Normal file
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13b_V2_test.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*****************************************************************************
|
||||
* | 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_2IN13B_V2.h"
|
||||
|
||||
int EPD_2in13b_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V2_Init();
|
||||
EPD_2IN13B_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13B_V2_WIDTH % 8 == 0)? (EPD_2IN13B_V2_WIDTH / 8 ): (EPD_2IN13B_V2_WIDTH / 8 + 1)) * EPD_2IN13B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
// EPD_2IN13B_V2_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13B_V2_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_2IN13B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V2_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;
|
||||
}
|
||||
|
||||
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9b_V2_test.c
Normal file
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9b_V2_test.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*****************************************************************************
|
||||
* | 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_2IN9B_V2.h"
|
||||
|
||||
int EPD_2in9b_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN9B_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9B_V2_Init();
|
||||
EPD_2IN9B_V2_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_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1)) * EPD_2IN9B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9B_V2_WIDTH, EPD_2IN9B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9B_V2_WIDTH, EPD_2IN9B_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9B_V2_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9B_V2_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;
|
||||
}
|
||||
|
||||
117
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_HD_test.c
Normal file
117
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_HD_test.c
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*****************************************************************************
|
||||
* | 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_HD.h"
|
||||
|
||||
int EPD_7in5_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_HD_Init();
|
||||
EPD_7IN5_HD_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_HD_WIDTH % 8 == 0)? (EPD_7IN5_HD_WIDTH / 8 ): (EPD_7IN5_HD_WIDTH / 8 + 1)) * EPD_7IN5_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_HD_WIDTH, EPD_7IN5_HD_HEIGHT/2, 0, WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
//Paint_DrawBitMap(gImage_7in5_V2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
//The entire image size is EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8
|
||||
//Since the memory problem is transmitted halfway, now the other half is transmitted, so the offset address is required.
|
||||
//Paint_DrawBitMap(gImage_7in5_V2 + EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8/2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
|
||||
EPD_7IN5_HD_DisplayImage(gImage_7in5_V2,0,0,800,480);
|
||||
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);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
printf("EPD_Display\r\n");
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_HD_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
118
STM32/STM32-F103ZET6/User/Examples/EPD_7in5b_HD_test.c
Normal file
118
STM32/STM32-F103ZET6/User/Examples/EPD_7in5b_HD_test.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_HD_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_7in5b_HD.h"
|
||||
#include "ImageData.h"
|
||||
|
||||
int EPD_7in5b_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_HD_Init();
|
||||
EPD_7IN5B_HD_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
// EPD_7IN5B_HD_ClearRed();
|
||||
// DEV_Delay_ms(3000);
|
||||
// EPD_7IN5B_HD_ClearBlack();
|
||||
// DEV_Delay_ms(3000);
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_HD_WIDTH % 8 == 0)? (EPD_7IN5B_HD_WIDTH / 8 ): (EPD_7IN5B_HD_WIDTH / 8 + 1)) * EPD_7IN5B_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage \r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5B_HD_WIDTH, EPD_7IN5B_HD_HEIGHT/2 , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
// Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
#if 1
|
||||
EPD_7IN5B_HD_DisplayImage(gImage_7in5_V2_b,gImage_7in5_V2_ry,16,10,800,480);
|
||||
DEV_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Drawing on the image \r\n");
|
||||
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);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,1);
|
||||
//2.Draw red image
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,2);
|
||||
Paint_Clear(WHITE);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,3);
|
||||
DEV_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_HD_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ int EPD_1in02d_test(void);
|
|||
int EPD_1in54_test(void);
|
||||
int EPD_1in54_V2_test(void);
|
||||
int EPD_1in54b_test(void);
|
||||
int EPD_1in54b_V2_test(void);
|
||||
int EPD_1in54c_test(void);
|
||||
|
||||
int EPD_2in7_test(void);
|
||||
|
|
@ -48,11 +49,13 @@ int EPD_2in7b_test(void);
|
|||
|
||||
int EPD_2in9_test(void);
|
||||
int EPD_2in9bc_test(void);
|
||||
int EPD_2in9b_V2_test(void);
|
||||
int EPD_2in9d_test(void);
|
||||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13b_V2_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
|
|
@ -65,4 +68,7 @@ int EPD_7in5_test(void);
|
|||
int EPD_7in5_V2_test(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
int EPD_7in5b_V2_test(void);
|
||||
|
||||
int EPD_7in5_HD_test(void);
|
||||
int EPD_7in5b_HD_test(void);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue