2020-12-11

This commit is contained in:
hnwangkg-ezio 2020-12-11 14:56:25 +08:00
commit 63409c20df
390 changed files with 0 additions and 80452 deletions

View file

@ -1,81 +0,0 @@
DIR_Config = ./lib/Config
DIR_EPD = ./lib/e-Paper
DIR_FONTS = ./lib/Fonts
DIR_GUI = ./lib/GUI
DIR_Examples = ./examples
DIR_BIN = ./bin
OBJ_C = $(wildcard ${DIR_EPD}/*.c ${DIR_GUI}/*.c ${DIR_Examples}/*.c ${DIR_FONTS}/*.c )
OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))
RPI_DEV_C = $(wildcard $(DIR_BIN)/dev_hardware_SPI.o $(DIR_BIN)/RPI_sysfs_gpio.o $(DIR_BIN)/DEV_Config.o )
JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o )
DEBUG = -D DEBUG
# USELIB_RPI = USE_BCM2835_LIB
USELIB_RPI = USE_WIRINGPI_LIB
# USELIB_RPI = USE_DEV_LIB
ifeq ($(USELIB_RPI), USE_BCM2835_LIB)
LIB_RPI = -lbcm2835 -lm
else ifeq ($(USELIB_RPI), USE_WIRINGPI_LIB)
LIB_RPI = -lwiringPi -lm
else ifeq ($(USELIB_RPI), USE_DEV_LIB)
LIB_RPI = -lm
endif
DEBUG_RPI = -D $(USELIB_RPI) -D RPI
USELIB_JETSONI = USE_DEV_LIB
# USELIB_JETSONI = USE_HARDWARE_LIB
ifeq ($(USELIB_JETSONI), USE_DEV_LIB)
LIB_JETSONI = -lm
else ifeq ($(USELIB_JETSONI), USE_HARDWARE_LIB)
LIB_JETSONI = -lm
endif
DEBUG_JETSONI = -D $(USELIB_JETSONI) -D JETSON
.PHONY : RPI JETSON clean
RPI:RPI_DEV RPI_epd
JETSON: JETSON_DEV JETSON_epd
TARGET = epd
CC = gcc
MSG = -g -O0 -Wall
CFLAGS += $(MSG)
RPI_epd:${OBJ_O}
echo $(@)
$(CC) $(CFLAGS) -D RPI $(OBJ_O) $(RPI_DEV_C) -o $(TARGET) $(LIB_RPI) $(DEBUG)
JETSON_epd:${OBJ_O}
echo $(@)
$(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_Examples)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_EPD)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_FONTS)/%.c
$(CC) $(CFLAGS) -c $< -o $@ $(DEBUG)
${DIR_BIN}/%.o:$(DIR_GUI)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
RPI_DEV:
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/dev_hardware_SPI.c -o $(DIR_BIN)/dev_hardware_SPI.o $(LIB_RPI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/RPI_sysfs_gpio.c -o $(DIR_BIN)/RPI_sysfs_gpio.o $(LIB_RPI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_RPI) $(DEBUG)
JETSON_DEV:
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_software_spi.c -o $(DIR_BIN)/sysfs_software_spi.o $(LIB_JETSONI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_gpio.c -o $(DIR_BIN)/sysfs_gpio.o $(LIB_JETSONI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_JETSONI) $(DEBUG)
clean :
rm $(DIR_BIN)/*.*
rm $(TARGET)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,188 +0,0 @@
/*****************************************************************************
* | File : EPD_1IN02_test.c
* | Author : Waveshare team
* | Function : 1.02inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-09-29
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_1in02d.h"
int EPD_1in02d_test(void)
{
printf("EPD_1IN02_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_1IN02_Init();
EPD_1IN02_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage,*old_Image;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_1IN02_WIDTH % 8 == 0)? (EPD_1IN02_WIDTH / 8 ): (EPD_1IN02_WIDTH / 8 + 1)) * EPD_1IN02_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((old_Image = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory2...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
Paint_NewImage(old_Image, EPD_1IN02_WIDTH, EPD_1IN02_HEIGHT, 270, WHITE);
Paint_SelectImage(old_Image);
Paint_Clear(WHITE);
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
#if 0 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x80.bmp", 0, 0);
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/1in02.bmp", 0, 0);
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 0 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_1in02d);
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1
// Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 15, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 25, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(30, 10, 80, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(80, 10, 30, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(30, 10, 90, 70, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawCircle(60, 40, 25, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
printf("EPD_1IN02_Display\r\n");
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
Paint_Clear(WHITE);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
printf("EPD_1IN02_Display\r\n");
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
Paint_Clear(WHITE);
Paint_DrawString_CN(0, 10,"ÄãºÃabcÊ÷Ý®ÅÉ", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(0, 30,"΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
printf("EPD_1IN02_Display\r\n");
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
Paint_Clear(WHITE);
EPD_1IN02_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Partial refresh, example shows time
printf("Partial refresh\r\n");
Paint_Clear(WHITE);
EPD_1IN02_Display(BlackImage);
EPD_1IN02_Part_Init();
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(20, 20, 20 + Font20.Width * 7, 20 + Font20.Height, WHITE);
Paint_DrawTime(20, 20, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_1IN02_DisplayPartial(old_Image, BlackImage);
memcpy(old_Image, BlackImage, Imagesize);
// DEV_Delay_ms(100);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_1IN02_Init();
EPD_1IN02_Clear();
printf("Goto Sleep...\r\n");
EPD_1IN02_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,170 +0,0 @@
/*****************************************************************************
* | 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");
if(DEV_Module_Init()!=0){
return -1;
}
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

@ -1,165 +0,0 @@
/*****************************************************************************
* | File : EPD_1IN54_test.c
* | Author : Waveshare team
* | Function : 1.54inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-11
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_1in54.h"
int EPD_1in54_test(void)
{
printf("EPD_1IN54_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_1IN54_Init(EPD_1IN54_FULL);
EPD_1IN54_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_1IN54_WIDTH % 8 == 0)? (EPD_1IN54_WIDTH / 8 ): (EPD_1IN54_WIDTH / 8 + 1)) * EPD_1IN54_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_1IN54_WIDTH, EPD_1IN54_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
EPD_1IN54_Display(BlackImage);
DEV_Delay_ms(500);
printf("show bmp------------------------\r\n");
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
EPD_1IN54_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 0 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_1in54);
EPD_1IN54_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_1IN54_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 0 //Partial refresh, example shows time
printf("Partial refresh\r\n");
EPD_1IN54_Init(EPD_1IN54_PART);
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(15, 65, 15 + Font20.Width * 7, 65 + Font20.Height, WHITE);
Paint_DrawTime(15, 65, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_1IN54_Display(BlackImage);
// DEV_Delay_ms(100);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_1IN54_Init(EPD_1IN54_FULL);
EPD_1IN54_Clear();
printf("Goto Sleep...\r\n");
EPD_1IN54_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,136 +0,0 @@
/*****************************************************************************
* | File : EPD_1in54b_test.c
* | Author : Waveshare team
* | Function : 1.54inch B e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-04-12
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_1in54b_V2.h"
int EPD_1in54b_V2_test(void)
{
printf("EPD_1IN54b_V2_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
EPD_1IN54B_V2_Init();
EPD_1IN54B_V2_Clear();
DEV_Delay_ms(200);
UBYTE *BlackImage, *RedImage;
UWORD Imagesize = ((EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1)) * EPD_1IN54B_V2_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RedImage\r\n");
Paint_NewImage(BlackImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
Paint_NewImage(RedImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
printf("read black bmp\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
EPD_1IN54B_V2_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
printf("read black bmp\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/1in54b-b.bmp", 0, 0);
printf("read red bmp\r\n");
Paint_SelectImage(RedImage);
GUI_ReadBmp("./pic/1in54b-r.bmp", 0, 0);
EPD_1IN54B_V2_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Drawing
printf("Drawing------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
EPD_1IN54B_V2_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_DrawBitMap(gImage_1in54b_Black);
Paint_SelectImage(RedImage);
Paint_DrawBitMap(gImage_1in54b_Red);
EPD_1IN54B_V2_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_1IN54B_V2_Clear();
printf("Goto Sleep...\r\n");
EPD_1IN54B_V2_Sleep();
free(BlackImage);
free(RedImage);
BlackImage = NULL;
RedImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,141 +0,0 @@
/*****************************************************************************
* | File : EPD_1in54b_test.c
* | Author : Waveshare team
* | Function : 1.54inch B e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-12
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_1in54b.h"
int EPD_1in54b_test(void)
{
printf("EPD_1in54b_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_1IN54B_Init();
EPD_1IN54B_Clear();
DEV_Delay_ms(500);
//Create new image
UBYTE *BlackImage, *RedImage;
UWORD Imagesize = ((EPD_1IN54B_WIDTH % 8 == 0)? (EPD_1IN54B_WIDTH / 8 ): (EPD_1IN54B_WIDTH / 8 + 1)) * EPD_1IN54B_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RedImage\r\n");
Paint_NewImage(BlackImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
Paint_NewImage(RedImage, EPD_1IN54B_WIDTH, EPD_1IN54B_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
printf("read black bmp\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
EPD_1IN54B_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
printf("read black bmp\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/1in54b-b.bmp", 0, 0);
printf("read red bmp\r\n");
Paint_SelectImage(RedImage);
GUI_ReadBmp("./pic/1in54b-r.bmp", 0, 0);
EPD_1IN54B_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Drawing
printf("Drawing------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
Paint_DrawString_CN(5, 160, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
EPD_1IN54B_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_DrawBitMap(gImage_1in54b_Black);
Paint_SelectImage(RedImage);
Paint_DrawBitMap(gImage_1in54b_Red);
EPD_1IN54B_Display(BlackImage, RedImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_1IN54B_Clear();
printf("Goto Sleep...\r\n");
EPD_1IN54B_Sleep();
free(BlackImage);
free(RedImage);
BlackImage = NULL;
RedImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,137 +0,0 @@
/*****************************************************************************
* | File : EPD_1in54c_test.c
* | Author : Waveshare team
* | Function : 1.54inch C e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-12
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_1in54c.h"
int EPD_1in54c_test(void)
{
printf("EPD_1IN54C_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_1IN54C_Init();
EPD_1IN54C_Clear();
DEV_Delay_ms(500);
//Create new image
UBYTE *BlackImage, *YellowImage;
UWORD Imagesize = ((EPD_1IN54C_WIDTH % 8 == 0)? (EPD_1IN54C_WIDTH / 8 ): (EPD_1IN54C_WIDTH / 8 + 1)) * EPD_1IN54C_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((YellowImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and YellowImage\r\n");
Paint_NewImage(BlackImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
Paint_NewImage(YellowImage, EPD_1IN54C_WIDTH, EPD_1IN54C_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
Paint_SelectImage(YellowImage);
Paint_Clear(WHITE);
EPD_1IN54C_Display(BlackImage, YellowImage);
DEV_Delay_ms(500);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/1in54c-b.bmp", 0, 0);
Paint_SelectImage(YellowImage);
GUI_ReadBmp("./pic/1in54c-y.bmp", 0, 0);
EPD_1IN54C_Display(BlackImage, YellowImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Drawing
printf("Drawing------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_SelectImage(YellowImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(45, 10, 45, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(20, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawCircle(45, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(110, 35, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 70, "waveshare", &Font20, BLACK, WHITE);
Paint_DrawNum(5, 95, 123456789, &Font20, BLACK, WHITE);
Paint_DrawString_CN(5, 120,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
EPD_1IN54C_Display(BlackImage, YellowImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array------------------------\r\n");
Paint_SelectImage(BlackImage);
Paint_DrawBitMap(gImage_1in54c_Black);
Paint_SelectImage(YellowImage);
Paint_DrawBitMap(gImage_1in54c_Yellow);
EPD_1IN54C_Display(BlackImage, YellowImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_1IN54C_Clear();
printf("Goto Sleep...\r\n");
EPD_1IN54C_Sleep();
free(BlackImage);
free(YellowImage);
BlackImage = NULL;
YellowImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,174 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN13_V2_test.c
* | Author : Waveshare team
* | Function : 2.13inch e-paper(V2) test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-13
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13_V2.h"
int EPD_2in13_V2_test(void)
{
printf("EPD_2IN13_V2_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1)) * EPD_2IN13_V2_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13_V2_WIDTH, EPD_2IN13_V2_HEIGHT, 270, WHITE);
Paint_SelectImage(BlackImage);
Paint_SetMirroring(MIRROR_HORIZONTAL); //
Paint_Clear(WHITE);
#if 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

@ -1,164 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN13_test.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-11
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13.h"
int EPD_2in13_test(void)
{
printf("EPD_2IN13_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13_Init(EPD_2IN13_FULL);
EPD_2IN13_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN13_WIDTH % 8 == 0)? (EPD_2IN13_WIDTH / 8 ): (EPD_2IN13_WIDTH / 8 + 1)) * EPD_2IN13_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13_WIDTH, EPD_2IN13_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
EPD_2IN13_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in13.bmp", 0, 0);
EPD_2IN13_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in13);
EPD_2IN13_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2IN13_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Partial refresh, example shows time
printf("Partial refresh\r\n");
EPD_2IN13_Init(EPD_2IN13_PART);
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(140, 90, 140 + Font20.Width * 7, 90 + Font20.Height, WHITE);
Paint_DrawTime(140, 90, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2IN13_Display(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_2IN13_Init(EPD_2IN13_FULL);
EPD_2IN13_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN13_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,142 +0,0 @@
/*****************************************************************************
* | File : EPD_2in13b_V3_test.c
* | Author : Waveshare team
* | Function : 2.13inch B V3 e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-04-13
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13b_V3.h"
int EPD_2in13b_V3_test(void)
{
printf("EPD_2IN13B_V3_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13B_V3_Init();
EPD_2IN13B_V3_Clear();
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RYImage; // Red or Yellow
UWORD Imagesize = ((EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1)) * EPD_2IN13B_V3_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13B_V3_WIDTH, EPD_2IN13B_V3_HEIGHT, 270, WHITE);
Paint_NewImage(RYImage, EPD_2IN13B_V3_WIDTH, EPD_2IN13B_V3_HEIGHT, 270, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
EPD_2IN13B_V3_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
printf("show red bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in13bc-b.bmp", 0, 0);
Paint_SelectImage(RYImage);
GUI_ReadBmp("./pic/2in13bc-ry.bmp", 0, 0);
EPD_2IN13B_V3_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
#endif
#if 0 // show image for array
printf("show image for array\r\n");
// EPD_2IN13B_V3_Display(gImage_2in13b_b, gImage_2in13b_r);
EPD_2IN13B_V3_Display(gImage_2in13c_b, gImage_2in13c_y);
DEV_Delay_ms(2000);
#endif
#if 0 // Drawing on the image
/*Horizontal screen*/
//1.Draw black image
printf("Draw black image\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
//2.Draw red image
printf("Draw red image\r\n");
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
printf("EPD_Display\r\n");
EPD_2IN13B_V3_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_2IN13B_V3_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN13B_V3_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;
RYImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,141 +0,0 @@
/*****************************************************************************
* | File : EPD_2in13bc_test.c
* | Author : Waveshare team
* | Function : 2.13inch B&C e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-13
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13bc.h"
int EPD_2in13bc_test(void)
{
printf("EPD_2IN13BC_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13BC_Init();
EPD_2IN13BC_Clear();
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RYImage; // Red or Yellow
UWORD Imagesize = ((EPD_2IN13BC_WIDTH % 8 == 0)? (EPD_2IN13BC_WIDTH / 8 ): (EPD_2IN13BC_WIDTH / 8 + 1)) * EPD_2IN13BC_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
Paint_NewImage(RYImage, EPD_2IN13BC_WIDTH, EPD_2IN13BC_HEIGHT, 270, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
EPD_2IN13BC_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
printf("show red bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in13bc-b.bmp", 0, 0);
Paint_SelectImage(RYImage);
GUI_ReadBmp("./pic/2in13bc-ry.bmp", 0, 0);
EPD_2IN13BC_Display(BlackImage, RYImage);
// DEV_Delay_ms(2000);
#endif
#if 1 // show image for array
printf("show image for array\r\n");
// EPD_2IN13BC_Display(gImage_2in13b_b, gImage_2in13b_r);
EPD_2IN13BC_Display(gImage_2in13c_b, gImage_2in13c_y);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
/*Horizontal screen*/
//1.Draw black image
printf("Draw black image\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
//2.Draw red image
printf("Draw red image\r\n");
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
printf("EPD_Display\r\n");
EPD_2IN13BC_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_2IN13BC_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN13BC_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;
RYImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,162 +0,0 @@
/*****************************************************************************
* | File : EPD_2in13d_test.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-13
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in13d.h"
int EPD_2in13d_test(void)
{
printf("EPD_2IN13D_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13D_Init();
EPD_2IN13D_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN13D_WIDTH % 8 == 0)? (EPD_2IN13D_WIDTH / 8 ): (EPD_2IN13D_WIDTH / 8 + 1)) * EPD_2IN13D_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13D_WIDTH, EPD_2IN13D_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 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

@ -1,173 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN66_test.c
* | Author : Waveshare team
* | Function : 2.66inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-21
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in66.h"
#include <time.h>
int EPD_2in66_test(void)
{
printf("EPD_2IN66_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN66_Init();
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_2IN66_Clear();
clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1)) * EPD_2IN66_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN66_WIDTH, EPD_2IN66_HEIGHT, 270, WHITE);
Paint_Clear(WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in66.bmp", 0, 0);
EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 20, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 30, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(20, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(20, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(20, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(20, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //partial refresh, show time
printf("EPD_2IN66_DisplayPart\r\n");
EPD_2IN66_Init_partial();
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time; //time struct
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UWORD num = 10;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(180, 100, 296, 152, WHITE);
Paint_DrawTime(180, 110, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
printf("Part refresh...\r\n");
EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(500);
}
EPD_2IN66_Clear();
#endif
printf("Clear...\r\n");
EPD_2IN66_Init();
EPD_2IN66_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN66_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,180 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN7_test.c
* | Author : Waveshare team
* | Function : 1.54inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-11
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in7.h"
int EPD_2in7_test(void)
{
printf("EPD_2IN7_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN7_Init();
EPD_2IN7_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN7_WIDTH % 8 == 0)? (EPD_2IN7_WIDTH / 8 ): (EPD_2IN7_WIDTH / 8 + 1)) * EPD_2IN7_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 50, 50);
EPD_2IN7_Display(BlackImage);
DEV_Delay_ms(500);
printf("show bmp------------------------\r\n");
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
EPD_2IN7_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in7);
EPD_2IN7_Display(BlackImage);
DEV_Delay_ms(500);
#endif
#if 1 // Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
printf("EPD_Display\r\n");
EPD_2IN7_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
// EPD_2IN7_Clear();
free(BlackImage);
#if 1 // show image for array
printf("show Gray------------------------\r\n");
Imagesize = ((EPD_2IN7_WIDTH % 4 == 0)? (EPD_2IN7_WIDTH / 4 ): (EPD_2IN7_WIDTH / 4 + 1)) * EPD_2IN7_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("4 grayscale display\r\n");
EPD_2IN7_Init_4Gray();
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 270, WHITE);
Paint_SetScale(4);
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
EPD_2IN7_4GrayDisplay(BlackImage);
DEV_Delay_ms(3000);
EPD_2IN7_4GrayDisplay(gImage_2in7_4Gray1);
DEV_Delay_ms(3000);
Paint_NewImage(BlackImage, EPD_2IN7_WIDTH, EPD_2IN7_HEIGHT, 0, WHITE);
Paint_SetScale(4);
Paint_Clear(WHITE);
GUI_ReadBmp_4Gray("./pic/2in7_Scale.bmp", 0, 0);
EPD_2IN7_4GrayDisplay(BlackImage);
DEV_Delay_ms(3000);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 20, 20);
EPD_2IN7_4GrayDisplay(BlackImage);
DEV_Delay_ms(3000);
EPD_2IN7_Clear();
#endif
// close 5V
printf("Goto Sleep...\r\n");
EPD_2IN7_Sleep();
free(BlackImage);
BlackImage = NULL;
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,141 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN7b_test.c
* | Author : Waveshare team
* | Function : 2.7inch e-paper b test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-11
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in7b.h"
int EPD_2in7b_test(void)
{
printf("EPD_2IN7B_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN7B_Init();
EPD_2IN7B_Clear();
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RedImage;
UWORD Imagesize = ((EPD_2IN7B_WIDTH % 8 == 0)? (EPD_2IN7B_WIDTH / 8 ): (EPD_2IN7B_WIDTH / 8 + 1)) * EPD_2IN7B_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RedImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
Paint_NewImage(RedImage, EPD_2IN7B_WIDTH, EPD_2IN7B_HEIGHT, 270, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
EPD_2IN7B_Display(BlackImage, RedImage);
DEV_Delay_ms(4000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in7b-b.bmp", 0, 0);
Paint_SelectImage(RedImage);
GUI_ReadBmp("./pic/2in7b-r.bmp", 0, 0);
EPD_2IN7B_Display(BlackImage, RedImage);
DEV_Delay_ms(4000);
#endif
#if 1 // show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_DrawBitMap(gImage_2in7b_Black);
Paint_SelectImage(RedImage);
Paint_DrawBitMap(gImage_2in7b_Red);
EPD_2IN7B_Display(BlackImage, RedImage);
DEV_Delay_ms(4000);
#endif
#if 1 // Drawing on the image
/*Horizontal screen*/
//1.Draw black image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
//2.Draw red image
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
printf("EPD_Display\r\n");
EPD_2IN7B_Display(BlackImage, RedImage);
DEV_Delay_ms(4000);
#endif
printf("Clear...\r\n");
EPD_2IN7B_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN7B_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
DEV_Delay_ms(12000);
return 0;
}

View file

@ -1,172 +0,0 @@
/*****************************************************************************
* | File : EPD_2IN9_test.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-11
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in9.h"
int EPD_2in9_test(void)
{
printf("EPD_2IN9_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN9_Init(EPD_2IN9_FULL);
EPD_2IN9_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* 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);
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 0, WHITE);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
EPD_2IN9_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
Paint_NewImage(BlackImage, EPD_2IN9_WIDTH, EPD_2IN9_HEIGHT, 270, WHITE);
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in9);
EPD_2IN9_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
EPD_2IN9_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Partial refresh, example shows time
printf("Partial refresh\r\n");
EPD_2IN9_Init(EPD_2IN9_PART);
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2IN9_Display(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_2IN9_Init(EPD_2IN9_FULL);
EPD_2IN9_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN9_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,151 +0,0 @@
/*****************************************************************************
* | File : EPD_2in9b_V2_test.c
* | Author : Waveshare team
* | Function : 2.9inch B V2 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_2in9b_V2.h"
#include <time.h>
int EPD_2in9b_V2_test(void)
{
printf("EPD_2IN9B_V2_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_2IN9B_V2_Init();
EPD_2IN9B_V2_Clear();
clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RYImage; // Red or Yellow
UWORD Imagesize = ((EPD_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 bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
EPD_2IN9B_V2_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
printf("show red bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in9bc-b.bmp", 0, 0);
Paint_SelectImage(RYImage);
GUI_ReadBmp("./pic/2in9bc-ry.bmp", 0, 0);
EPD_2IN9B_V2_Display(BlackImage, RYImage);
// DEV_Delay_ms(2000);
#endif
#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;
}

View file

@ -1,148 +0,0 @@
/*****************************************************************************
* | File : EPD_2in9bc_test.c
* | Author : Waveshare team
* | Function : 2.9inch B&C e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-12
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in9bc.h"
#include <time.h>
int EPD_2in9bc_test(void)
{
printf("EPD_2IN9BC_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_2IN9BC_Init();
EPD_2IN9BC_Clear();
clock_gettime(CLOCK_REALTIME,&finish);
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage, *RYImage; // Red or Yellow
UWORD Imagesize = ((EPD_2IN9BC_WIDTH % 8 == 0)? (EPD_2IN9BC_WIDTH / 8 ): (EPD_2IN9BC_WIDTH / 8 + 1)) * EPD_2IN9BC_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
Paint_NewImage(RYImage, EPD_2IN9BC_WIDTH, EPD_2IN9BC_HEIGHT, 270, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/100x100.bmp", 50, 10);
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
EPD_2IN9BC_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
printf("show red bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in9bc-b.bmp", 0, 0);
Paint_SelectImage(RYImage);
GUI_ReadBmp("./pic/2in9bc-ry.bmp", 0, 0);
EPD_2IN9BC_Display(BlackImage, RYImage);
// DEV_Delay_ms(2000);
#endif
#if 1 // show image for array
printf("show image for array\r\n");
EPD_2IN9BC_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
/*Horizontal screen*/
//1.Draw black image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
//2.Draw red image
Paint_SelectImage(RYImage);
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
printf("EPD_Display\r\n");
EPD_2IN9BC_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_2IN9BC_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN9BC_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;
RYImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,161 +0,0 @@
/*****************************************************************************
* | File : EPD_2in9d_test.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper d test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-13
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in9d.h"
int EPD_2in9d_test(void)
{
printf("EPD_2IN9D_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN9D_Init();
EPD_2IN9D_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN9D_WIDTH % 8 == 0)? (EPD_2IN9D_WIDTH / 8 ): (EPD_2IN9D_WIDTH / 8 + 1)) * EPD_2IN9D_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN9D_WIDTH, EPD_2IN9D_HEIGHT, 270, WHITE);
#if 1 // show bmp
printf("show window BMP-----------------\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
EPD_2IN9D_Display(BlackImage);
DEV_Delay_ms(2000);
printf("show bmp------------------------\r\n");
Paint_SelectImage(BlackImage);
GUI_ReadBmp("./pic/2in9d.bmp", 0, 0);
EPD_2IN9D_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in9);
EPD_2IN9D_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
printf("EPD_Display\r\n");
EPD_2IN9D_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 //Partial refresh, example shows time
printf("Partial refresh\r\n");
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 20;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2IN9D_DisplayPart(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
// EPD_2IN9D_Init();
EPD_2IN9D_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN9D_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

Some files were not shown because too many files have changed in this diff Show more