2020-09-03

This commit is contained in:
wangkg 2020-09-04 15:30:45 +08:00
commit 751a9fb93f
570 changed files with 50854 additions and 16474 deletions

View file

@ -64,22 +64,22 @@ int EPD_1in54c_test(void)
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_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(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_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(105, 30, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
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);
DEV_Delay_ms(5000);
#endif
#if 1 //show image for array
@ -91,7 +91,7 @@ int EPD_1in54c_test(void)
Paint_DrawBitMap(gImage_1in54c_Yellow);
EPD_1IN54C_Display(BlackImage, YellowImage);
DEV_Delay_ms(2000);
DEV_Delay_ms(5000);
#endif
printf("Clear...\r\n");

View file

@ -65,7 +65,7 @@ int EPD_2in13_V2_test(void)
DEV_Delay_ms(2000);
#endif
#if 0 // Drawing on the image
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
@ -97,7 +97,7 @@ int EPD_2in13_V2_test(void)
DEV_Delay_ms(2000);
#endif
#if 0 //Partial refresh, example shows time
#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);

View file

@ -28,21 +28,21 @@
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2IN13B_V2.h"
#include "EPD_2IN13B_V3.h"
int EPD_2in13b_V2_test(void)
int EPD_2in13b_V3_test(void)
{
printf("EPD_2IN13B_V2_test Demo\r\n");
printf("EPD_2IN13B_V3_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_2IN13B_V2_Init();
EPD_2IN13B_V2_Clear();
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_V2_WIDTH % 8 == 0)? (EPD_2IN13B_V2_WIDTH / 8 ): (EPD_2IN13B_V2_WIDTH / 8 + 1)) * EPD_2IN13B_V2_HEIGHT;
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;
@ -52,8 +52,8 @@ int EPD_2in13b_V2_test(void)
return -1;
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
Paint_NewImage(RYImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
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);
@ -63,9 +63,9 @@ int EPD_2in13b_V2_test(void)
#if 1 // show image for array
printf("show image for array\r\n");
// EPD_2IN13B_V2_Display(gImage_2in13b_b, gImage_2in13b_r);
// EPD_2IN13B_V3_Display(gImage_2in13b_b, gImage_2in13b_r);
EPD_2IN13B_V2_Display(gImage_2in13c_b, gImage_2in13c_y);
EPD_2IN13B_V3_Display(gImage_2in13c_b, gImage_2in13c_y);
DEV_Delay_ms(2000);
#endif
@ -97,15 +97,15 @@ int EPD_2in13b_V2_test(void)
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
printf("EPD_Display\r\n");
EPD_2IN13B_V2_Display(BlackImage, RYImage);
EPD_2IN13B_V3_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_2IN13B_V2_Clear();
EPD_2IN13B_V3_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN13B_V2_Sleep();
EPD_2IN13B_V3_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;

View file

@ -0,0 +1,160 @@
/*****************************************************************************
* | File : EPD_2IN66_test.c
* | Author : Waveshare team
* | Function : 2.66inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-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_2in66.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();
EPD_2IN66_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_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);
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in66);
EPD_2IN66_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
#if 1 // Drawing on the image
//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_2IN66_Display(BlackImage);
DEV_Delay_ms(4000);
#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

@ -5,7 +5,7 @@
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-12
* | Date : 2020-07-03
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -64,7 +64,7 @@ int EPD_2in9b_V2_test(void)
#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);
DEV_Delay_ms(5000);
#endif
#if 1 // Drawing on the image
@ -97,12 +97,12 @@ int EPD_2in9b_V2_test(void)
printf("EPD_Display\r\n");
EPD_2IN9B_V2_Display(BlackImage, RYImage);
DEV_Delay_ms(2000);
DEV_Delay_ms(5000);
#endif
// clear EPD
printf("Clear...\r\n");
EPD_2IN9B_V2_Clear();
//deep sleep mode, free heap ram
printf("Goto Sleep...\r\n");
EPD_2IN9B_V2_Sleep();
free(BlackImage);

View file

@ -0,0 +1,161 @@
/*****************************************************************************
* | File : EPD_3IN7_test.c
* | Author : Waveshare team
* | Function : 3.7inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-17
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_3in7.h"
int EPD_3in7_test(void)
{
printf("EPD_3IN7_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_3IN7_4Gray_Init();
EPD_3IN7_4Gray_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_3IN7_WIDTH % 4 == 0)? (EPD_3IN7_WIDTH / 4 ): (EPD_3IN7_WIDTH / 4 + 1)) * EPD_3IN7_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_3IN7_WIDTH, EPD_3IN7_HEIGHT, 270, WHITE);
Paint_SetScale(4);
Paint_Clear(WHITE);
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_SetScale(4);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_3in7);
EPD_3IN7_4Gray_Display(BlackImage);
DEV_Delay_ms(4000);
#endif
#if 1 // Drawing on the image, partial display
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_SetScale(4);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_EN(10, 150, "GRAY1 with black background", &Font24, BLACK, GRAY1);
Paint_DrawString_EN(10, 175, "GRAY2 with white background", &Font24, WHITE, GRAY2);
Paint_DrawString_EN(10, 200, "GRAY3 with white background", &Font24, WHITE, GRAY3);
Paint_DrawString_EN(10, 225, "GRAY4 with white background", &Font24, WHITE, GRAY4);
printf("EPD_Display\r\n");
EPD_3IN7_4Gray_Display(BlackImage);
DEV_Delay_ms(4000);
#endif
#if 1 // partial update, just 1 Gray mode
EPD_3IN7_1Gray_Init(); //init 1 Gray mode
EPD_3IN7_1Gray_Clear();
Paint_SelectImage(BlackImage);
Paint_SetScale(2);
Paint_Clear(WHITE);
printf("show time, partial update, just 1 Gary mode\r\n");
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 10;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(300, 0, 479, 80, WHITE);
Paint_DrawTime(300, 20, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
printf("Part refresh...\r\n");
EPD_3IN7_1Gray_Display(BlackImage);
// EPD_3IN7_1Gray_Display_Part(BlackImage, 0, 0, 279, 180);
DEV_Delay_ms(500);
}
#endif
EPD_3IN7_4Gray_Init();
printf("Clear...\r\n");
EPD_3IN7_4Gray_Clear();
// Sleep & close 5V
printf("Goto Sleep...\r\n");
EPD_3IN7_Sleep();
free(BlackImage);
BlackImage = NULL;
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,110 @@
/*****************************************************************************
* | File : EPD_5in65f_test.c
* | Author : Waveshare team
* | Function : 5.83inch F e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-07
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_5in65f.h"
#include "EPD_Test.h"
int EPD_5in65f_test(void)
{
printf("EPD_5in65F_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_5IN65F_Init();
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
DEV_Delay_ms(100);
UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UDOUBLE Imagesize = ((EPD_5IN65F_WIDTH % 2 == 0)? (EPD_5IN65F_WIDTH / 2 ): (EPD_5IN65F_WIDTH / 2 + 1)) * EPD_5IN65F_HEIGHT;
Imagesize = Imagesize/4;
printf("Not enough memory, only part of the window is displayed\r\n");
printf("Imagesize %d\r\n",Imagesize);
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
Paint_NewImage(BlackImage, EPD_5IN65F_WIDTH/2, EPD_5IN65F_HEIGHT/2, 0, EPD_5IN65F_WHITE);
Paint_SetScale(7);
#if 0
EPD_5IN65F_Display_part(gImage_5in65f, 204, 153, 192, 143);
DEV_Delay_ms(5000);
#endif
#if 1
Paint_Clear(EPD_5IN65F_GREEN);
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(10, 120, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLACK, WHITE);
Paint_DrawString_CN(10, 140, "ÄãºÃabc", &Font12CN, EPD_5IN65F_GREEN, WHITE);
Paint_DrawString_CN(10, 160, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLUE, WHITE);
Paint_DrawString_CN(10, 180, "ÄãºÃabc", &Font12CN, EPD_5IN65F_RED, WHITE);
Paint_DrawString_CN(10, 200, "ÄãºÃabc", &Font12CN, EPD_5IN65F_ORANGE, WHITE);
Paint_DrawString_CN(150, 0, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawString_CN(150, 40, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_GREEN, BLACK);
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLUE, BLACK);
Paint_DrawString_CN(150, 120, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_RED, BLACK);
Paint_DrawString_CN(150, 160, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_YELLOW, BLACK);
EPD_5IN65F_Display_part(BlackImage, 0, 0, 300, 224);
DEV_Delay_ms(5000);
#endif
printf("e-Paper Clear...\r\n");
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
DEV_Delay_ms(1000);
EPD_5IN65F_Sleep();
free(BlackImage);
BlackImage = NULL;
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,143 @@
/*****************************************************************************
* | File : EPD_5in83b_V2_test.c
* | Author : Waveshare team
* | Function : 5.83inch B V2 e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-04
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_5in83b_V2.h"
#include "ImageData.h"
int EPD_5in83b_V2_test(void)
{
printf("EPD_5in83b_V2_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_5IN83B_V2_Init();
EPD_5IN83B_V2_Clear();
DEV_Delay_ms(500);
//Create a new image cache named IMAGE_BW and fill it with white
UBYTE *BlackImage;
UWORD Imagesize = ((EPD_5IN83B_V2_WIDTH % 8 == 0)? (EPD_5IN83B_V2_WIDTH / 8 ): (EPD_5IN83B_V2_WIDTH / 8 + 1)) * EPD_5IN83B_V2_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize / 4)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("NewImage:BlackImage and RYImage\r\n");
Paint_NewImage(BlackImage, EPD_5IN83B_V2_WIDTH, EPD_5IN83B_V2_HEIGHT, 0, WHITE);
#if 1
EPD_5IN83B_V2_Display(gImage_5in83b_V2_b, gImage_5in83b_V2_r);
DEV_Delay_ms(5000);
#endif
#if 1 // Drawing on the image
/*Horizontal screen*/
//1.Draw black image
printf("Drawing on the image \r\n");
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
EPD_5IN83B_V2_DisplayPicture(BlackImage,0);
Paint_Clear(WHITE);
EPD_5IN83B_V2_DisplayPicture(BlackImage,1);
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
EPD_5IN83B_V2_DisplayPicture(BlackImage,2);
Paint_Clear(WHITE);
EPD_5IN83B_V2_DisplayPicture(BlackImage,3);
//2.Draw red image
Paint_Clear(WHITE);
EPD_5IN83B_V2_DisplayPicture(BlackImage,4);
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
EPD_5IN83B_V2_DisplayPicture(BlackImage,5);
Paint_Clear(WHITE);
EPD_5IN83B_V2_DisplayPicture(BlackImage,6);
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
printf("EPD_Display\r\n");
EPD_5IN83B_V2_DisplayPicture(BlackImage,7);
DEV_Delay_ms(15000);
#endif
printf("Clear...\r\n");
EPD_5IN83B_V2_Clear();
printf("Goto Sleep...\r\n");
EPD_5IN83B_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

@ -55,14 +55,21 @@ int EPD_2in9d_test(void);
int EPD_2in13_test(void);
int EPD_2in13_V2_test(void);
int EPD_2in13bc_test(void);
int EPD_2in13b_V2_test(void);
int EPD_2in13b_V3_test(void);
int EPD_2in13d_test(void);
int EPD_2in66_test(void);
int EPD_3in7_test(void);
int EPD_4in2_test(void);
int EPD_4in2bc_test(void);
int EPD_5in65f_test(void);
int EPD_5in83_test(void);
int EPD_5in83bc_test(void);
int EPD_5in83b_V2_test(void);
int EPD_7in5_test(void);
int EPD_7in5_V2_test(void);

File diff suppressed because it is too large Load diff

View file

@ -56,14 +56,22 @@ extern const unsigned char gImage_2in13c_b[];
extern const unsigned char gImage_2in13c_y[];
extern const unsigned char gImage_2in13d[];
extern const unsigned char gImage_2in66[];
extern const unsigned char gImage_3in7[]; //4 Gray
extern const unsigned char gImage_4in2[];
extern const unsigned char gImage_4in2_4Gray[];
extern const unsigned char gImage_4in2bc_b[];
extern const unsigned char gImage_4in2bc_ry[];
extern const unsigned char gImage_5in65f[];//192*143
extern const unsigned char gImage_5in83[];
extern const unsigned char gImage_5in83bc_b[];
extern const unsigned char gImage_5in83bc_ry[];
extern const unsigned char gImage_5in83b_V2_b[];
extern const unsigned char gImage_5in83b_V2_r[];
extern const unsigned char gImage_7in5[];
extern const unsigned char gImage_7in5_V2[];

View file

@ -8,10 +8,19 @@
* Achieve display characters: Display a single character, string, number
* Achieve time display: adaptive size display time minutes and seconds
*----------------
* | This version: V3.0
* | Date : 2019-04-18
* | This version: V3.1
* | Date : 2020-07-08
* | Info :
* -----------------------------------------------------------------------------
* V3.1(2020-07-08):
* 1.Change: Paint_SetScale(UBYTE scale)
* Add scale 7 for 5.65f e-Parper
* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
* Add the branch for scale 7
* 3.Change: Paint_Clear(UWORD Color)
* Add the branch for scale 7
*
* -----------------------------------------------------------------------------
* V3.0(2019-04-18):
* 1.Change:
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
@ -140,9 +149,12 @@ void Paint_SetScale(UBYTE scale)
}else if(scale == 4){
Paint.Scale = scale;
Paint.WidthByte = (Paint.WidthMemory % 4 == 0)? (Paint.WidthMemory / 4 ): (Paint.WidthMemory / 4 + 1);
}else{
}else if(scale == 7){//Only applicable with 5in65 e-Paper
Paint.Scale = scale;
Paint.WidthByte = (Paint.WidthMemory % 2 == 0)? (Paint.WidthMemory / 2 ): (Paint.WidthMemory / 2 + 1);;
}else{
Debug("Set Scale Input parameter error\r\n");
Debug("Scale Only support: 2 4 \r\n");
Debug("Scale Only support: 2 4 7\r\n");
}
}
/******************************************************************************
@ -234,7 +246,13 @@ void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
Rdata = Rdata & (~(0xC0 >> ((X % 4)*2)));
Paint.Image[Addr] = Rdata | ((Color << 6) >> ((X % 4)*2));
}
}else if(Paint.Scale == 7){
UDOUBLE Addr = X / 2 + Y * Paint.WidthByte;
UBYTE Rdata = Paint.Image[Addr];
Rdata = Rdata & (~(0xF0 >> ((X % 2)*4)));//Clear first, then set value
Paint.Image[Addr] = Rdata | ((Color << 4) >> ((X % 2)*4));
//printf("Add = %d ,data = %d\r\n",Addr,Rdata);
}
}
/******************************************************************************
@ -244,12 +262,21 @@ parameter:
******************************************************************************/
void Paint_Clear(UWORD Color)
{
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel = 1 byte
UDOUBLE Addr = X + Y*Paint.WidthByte;
Paint.Image[Addr] = Color;
}
}
if(Paint.Scale == 2 || Paint.Scale == 4){
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel = 1 byte
UDOUBLE Addr = X + Y*Paint.WidthByte;
Paint.Image[Addr] = Color;
}
}
}else if(Paint.Scale == 7){
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {
UDOUBLE Addr = X + Y*Paint.WidthByte;
Paint.Image[Addr] = (Color<<4)|Color;
}
}
}
}
/******************************************************************************

View file

@ -88,11 +88,11 @@ parameter:
static void EPD_1IN54C_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
DEV_Delay_ms(100);
}
/******************************************************************************

View file

@ -1,7 +1,7 @@
/*****************************************************************************
* | File : EPD_2in13b_V2.c
* | File : EPD_2in13b_V3.c
* | Author : Waveshare team
* | Function : 2.13inch e-paper b V2
* | Function : 2.13inch e-paper b V3
* | Info :
*----------------
* | This version: V1.0
@ -28,14 +28,14 @@
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_2in13b_V2.h"
#include "EPD_2in13b_V3.h"
#include "Debug.h"
//元太屏
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN13B_V2_Reset(void)
static void EPD_2IN13B_V3_Reset(void)
{
DEV_Digital_Write(EPD_CS_PIN, 1);
@ -52,7 +52,7 @@ function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN13B_V2_SendCommand(UBYTE Reg)
static void EPD_2IN13B_V3_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
@ -66,7 +66,7 @@ function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2IN13B_V2_SendData(UBYTE Data)
static void EPD_2IN13B_V3_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
@ -78,12 +78,12 @@ static void EPD_2IN13B_V2_SendData(UBYTE Data)
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2IN13B_V2_ReadBusy(void)
void EPD_2IN13B_V3_ReadBusy(void)
{
UBYTE busy;
Debug("e-Paper busy\r\n");
do{
EPD_2IN13B_V2_SendCommand(0x71);
EPD_2IN13B_V3_SendCommand(0x71);
busy = DEV_Digital_Read(EPD_BUSY_PIN);
busy =!(busy & 0x01);
}while(busy);
@ -95,36 +95,36 @@ void EPD_2IN13B_V2_ReadBusy(void)
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN13B_V2_TurnOnDisplay(void)
static void EPD_2IN13B_V3_TurnOnDisplay(void)
{
EPD_2IN13B_V2_SendCommand(0x12); //DISPLAY REFRESH
EPD_2IN13B_V3_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(100);
EPD_2IN13B_V2_ReadBusy();
EPD_2IN13B_V3_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN13B_V2_Init(void)
void EPD_2IN13B_V3_Init(void)
{
EPD_2IN13B_V2_Reset();
EPD_2IN13B_V3_Reset();
DEV_Delay_ms(10);
EPD_2IN13B_V2_SendCommand(0x04);
EPD_2IN13B_V2_ReadBusy();//waiting for the electronic paper IC to release the idle signal
EPD_2IN13B_V3_SendCommand(0x04);
EPD_2IN13B_V3_ReadBusy();//waiting for the electronic paper IC to release the idle signal
EPD_2IN13B_V2_SendCommand(0x00);//panel setting
EPD_2IN13B_V2_SendData(0x0f);//LUT from OTP128x296
EPD_2IN13B_V2_SendData(0x89);//Temperature sensor, boost and other related timing settings
EPD_2IN13B_V3_SendCommand(0x00);//panel setting
EPD_2IN13B_V3_SendData(0x0f);//LUT from OTP128x296
EPD_2IN13B_V3_SendData(0x89);//Temperature sensor, boost and other related timing settings
EPD_2IN13B_V2_SendCommand(0x61);//resolution setting
EPD_2IN13B_V2_SendData (0x68);
EPD_2IN13B_V2_SendData (0x00);
EPD_2IN13B_V2_SendData (0xD4);
EPD_2IN13B_V3_SendCommand(0x61);//resolution setting
EPD_2IN13B_V3_SendData (0x68);
EPD_2IN13B_V3_SendData (0x00);
EPD_2IN13B_V3_SendData (0xD4);
EPD_2IN13B_V2_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
EPD_2IN13B_V2_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
EPD_2IN13B_V3_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
EPD_2IN13B_V3_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
//WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7;
}
@ -132,66 +132,66 @@ void EPD_2IN13B_V2_Init(void)
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN13B_V2_Clear(void)
void EPD_2IN13B_V3_Clear(void)
{
UWORD Width = (EPD_2IN13B_V2_WIDTH % 8 == 0)? (EPD_2IN13B_V2_WIDTH / 8 ): (EPD_2IN13B_V2_WIDTH / 8 + 1);
UWORD Height = EPD_2IN13B_V2_HEIGHT;
UWORD Width = (EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1);
UWORD Height = EPD_2IN13B_V3_HEIGHT;
//send black data
EPD_2IN13B_V2_SendCommand(0x10);
EPD_2IN13B_V3_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN13B_V2_SendData(0xFF);
EPD_2IN13B_V3_SendData(0xFF);
}
}
//send red data
EPD_2IN13B_V2_SendCommand(0x13);
EPD_2IN13B_V3_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN13B_V2_SendData(0xFF);
EPD_2IN13B_V3_SendData(0xFF);
}
}
EPD_2IN13B_V2_TurnOnDisplay();
EPD_2IN13B_V3_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN13B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
void EPD_2IN13B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage)
{
UWORD Width, Height;
Width = (EPD_2IN13B_V2_WIDTH % 8 == 0)? (EPD_2IN13B_V2_WIDTH / 8 ): (EPD_2IN13B_V2_WIDTH / 8 + 1);
Height = EPD_2IN13B_V2_HEIGHT;
Width = (EPD_2IN13B_V3_WIDTH % 8 == 0)? (EPD_2IN13B_V3_WIDTH / 8 ): (EPD_2IN13B_V3_WIDTH / 8 + 1);
Height = EPD_2IN13B_V3_HEIGHT;
EPD_2IN13B_V2_SendCommand(0x10);
EPD_2IN13B_V3_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN13B_V2_SendData(blackimage[i + j * Width]);
EPD_2IN13B_V3_SendData(blackimage[i + j * Width]);
}
}
EPD_2IN13B_V2_SendCommand(0x13);
EPD_2IN13B_V3_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN13B_V2_SendData(ryimage[i + j * Width]);
EPD_2IN13B_V3_SendData(ryimage[i + j * Width]);
}
}
EPD_2IN13B_V2_TurnOnDisplay();
EPD_2IN13B_V3_TurnOnDisplay();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN13B_V2_Sleep(void)
void EPD_2IN13B_V3_Sleep(void)
{
EPD_2IN13B_V2_SendCommand(0X50);
EPD_2IN13B_V2_SendData(0xf7);
EPD_2IN13B_V3_SendCommand(0X50);
EPD_2IN13B_V3_SendData(0xf7);
EPD_2IN13B_V2_SendCommand(0X02); //power off
EPD_2IN13B_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
EPD_2IN13B_V2_SendCommand(0X07); //deep sleep
EPD_2IN13B_V2_SendData(0xA5);
EPD_2IN13B_V3_SendCommand(0X02); //power off
EPD_2IN13B_V3_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
EPD_2IN13B_V3_SendCommand(0X07); //deep sleep
EPD_2IN13B_V3_SendData(0xA5);
}

View file

@ -1,7 +1,7 @@
/*****************************************************************************
* | File : EPD_2in13b_V2.h
* | File : EPD_2in13b_V3.h
* | Author : Waveshare team
* | Function : 2.13inch e-paper b V2
* | Function : 2.13inch e-paper b V3
* | Info :
*----------------
* | This version: V1.0
@ -28,18 +28,18 @@
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_2IN13B_V2_H_
#define __EPD_2IN13B_V2_H_
#ifndef __EPD_2IN13B_V3_H_
#define __EPD_2IN13B_V3_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2IN13B_V2_WIDTH 104
#define EPD_2IN13B_V2_HEIGHT 212
#define EPD_2IN13B_V3_WIDTH 104
#define EPD_2IN13B_V3_HEIGHT 212
void EPD_2IN13B_V2_Init(void);
void EPD_2IN13B_V2_Clear(void);
void EPD_2IN13B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage);
void EPD_2IN13B_V2_Sleep(void);
void EPD_2IN13B_V3_Init(void);
void EPD_2IN13B_V3_Clear(void);
void EPD_2IN13B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage);
void EPD_2IN13B_V3_Sleep(void);
#endif

View file

@ -0,0 +1,259 @@
/*****************************************************************************
* | File : EPD_2in66.c
* | Author : Waveshare team
* | Function : 2.66inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-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_2in66.h"
#include "Debug.h"
const unsigned char WF_PARTIAL[159] ={
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0A,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x22,0x22,0x22,0x22,0x22,0x22,
0x00,0x00,0x00,0x22,0x17,0x41,0xB0,0x32,0x36,
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN66_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN66_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Reg);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2IN66_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2IN66_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
DEV_Delay_ms(100);
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
DEV_Delay_ms(100);
}
DEV_Delay_ms(100);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN66_TurnOnDisplay(void)
{
EPD_2IN66_SendCommand(0x20);
EPD_2IN66_ReadBusy();
}
/******************************************************************************
function : Send LUT
parameter:
******************************************************************************/
static void EPD_2IN66_SetLUA(void)
{
UWORD count;
EPD_2IN66_SendCommand(0x32);
for(count=0;count<153;count++){
EPD_2IN66_SendData(WF_PARTIAL[count]);
}
EPD_2IN66_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN66_Init(void)
{
EPD_2IN66_Reset();
EPD_2IN66_ReadBusy();
EPD_2IN66_SendCommand(0x12);//soft reset
EPD_2IN66_ReadBusy();
/* Y increment, X increment */
EPD_2IN66_SendCommand(0x11);
EPD_2IN66_SendData(0x03);
/* Set RamX-address Start/End position */
EPD_2IN66_SendCommand(0x44);
EPD_2IN66_SendData(0x01);
EPD_2IN66_SendData((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1) );
/* Set RamY-address Start/End position */
EPD_2IN66_SendCommand(0x45);
EPD_2IN66_SendData(0);
EPD_2IN66_SendData(0);
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0xff));
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0x100)>>8);
EPD_2IN66_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register(Partial display)
parameter:
******************************************************************************/
void EPD_2IN66_Init_Partial(void)
{
EPD_2IN66_Reset();
EPD_2IN66_ReadBusy();
EPD_2IN66_SendCommand(0x12);//soft reset
EPD_2IN66_ReadBusy();
EPD_2IN66_SetLUA();
EPD_2IN66_SendCommand(0x37);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x40);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
EPD_2IN66_SendData(0x00);
/* Y increment, X increment */
EPD_2IN66_SendCommand(0x11);
EPD_2IN66_SendData(0x03);
/* Set RamX-address Start/End position */
EPD_2IN66_SendCommand(0x44);
EPD_2IN66_SendData(0x01);
EPD_2IN66_SendData((EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1) );
/* Set RamY-address Start/End position */
EPD_2IN66_SendCommand(0x45);
EPD_2IN66_SendData(0);
EPD_2IN66_SendData(0);
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0xff));
EPD_2IN66_SendData((EPD_2IN66_HEIGHT&0x100)>>8);
EPD_2IN66_SendCommand(0x3C);
EPD_2IN66_SendData(0x80);
EPD_2IN66_SendCommand(0x22);
EPD_2IN66_SendData(0xcf);
EPD_2IN66_SendCommand(0x20);
EPD_2IN66_ReadBusy();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN66_Clear(void)
{
UWORD Width, Height;
Width = (EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1);
Height = EPD_2IN66_HEIGHT;
EPD_2IN66_SendCommand(0x24);
for (UWORD j = 0; j <=Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN66_SendData(0xff);
}
}
EPD_2IN66_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN66_Display(UBYTE *Image)
{
UWORD Width, Height;
Width = (EPD_2IN66_WIDTH % 8 == 0)? (EPD_2IN66_WIDTH / 8 ): (EPD_2IN66_WIDTH / 8 + 1);
Height = EPD_2IN66_HEIGHT;
UDOUBLE Addr = 0;
// UDOUBLE Offset = ImageName;
EPD_2IN66_SendCommand(0x24);
for (UWORD j = 0; j <Height; j++) {
for (UWORD i = 0; i <Width; i++) {
Addr = i + j * Width;
EPD_2IN66_SendData(Image[Addr]);
}
}
EPD_2IN66_TurnOnDisplay();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN66_Sleep(void)
{
EPD_2IN66_SendCommand(0x10);
EPD_2IN66_SendData(0x01);
//EPD_2IN66_ReadBusy();
}

View file

@ -0,0 +1,46 @@
/*****************************************************************************
* | File : EPD_2in66.h
* | Author : Waveshare team
* | Function : 2.66inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-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.
#
******************************************************************************/
#ifndef __EPD_2IN66_H_
#define __EPD_2IN66_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2IN66_WIDTH 152
#define EPD_2IN66_HEIGHT 296
void EPD_2IN66_Init(void);
void EPD_2IN66_Init_Partial(void);
void EPD_2IN66_Clear(void);
void EPD_2IN66_Display(UBYTE *Image);
void EPD_2IN66_Sleep(void);
#endif

View file

@ -104,7 +104,7 @@ static void EPD_2IN9_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(200);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -5,7 +5,7 @@
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-04-12
* | Date : 2020-07-03
* | Info :
* -----------------------------------------------------------------------------
#
@ -40,7 +40,7 @@ static void EPD_2IN9B_V2_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(5);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
@ -97,7 +97,6 @@ parameter:
void EPD_2IN9B_V2_Init(void)
{
EPD_2IN9B_V2_Reset();
EPD_2IN9B_V2_Reset();
EPD_2IN9B_V2_SendCommand(0x04);
EPD_2IN9B_V2_ReadBusy();//waiting for the electronic paper IC to release the idle signal
@ -155,6 +154,7 @@ void EPD_2IN9B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
Width = (EPD_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1);
Height = EPD_2IN9B_V2_HEIGHT;
//send black data
EPD_2IN9B_V2_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
@ -163,6 +163,7 @@ void EPD_2IN9B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
}
EPD_2IN9B_V2_SendCommand(0x92);
//send red data
EPD_2IN9B_V2_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {

View file

@ -93,7 +93,7 @@ static void EPD_2IN9BC_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -165,7 +165,7 @@ static void EPD_2IN9D_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(200);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,585 @@
/*****************************************************************************
* | File : EPD_3IN7.C
* | Author : Waveshare team
* | Function : 3.7inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-17
* | 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_3in7.h"
#include "Debug.h"
static const UBYTE lut_4Gray_GC[] =
{
0x2A,0x06,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x28,0x06,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x20,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x14,0x06,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x08,0x08,0x02,//6
0x00,0x02,0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22
};
static const UBYTE lut_1Gray_GC[] =
{
0x2A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x05,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x2A,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x05,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x02,0x03,0x0A,0x00,0x02,0x06,0x0A,0x05,0x00,//6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10
0x22,0x22,0x22,0x22,0x22
};
static const UBYTE lut_1Gray_DU[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x01,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0A,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x00,0x00,0x05,0x05,0x00,0x05,0x03,0x05,0x05,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x22,0x22,0x22,0x22,0x22
};
static const UBYTE lut_1Gray_A2[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2
0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //5
0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00, //6
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //7
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //8
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //9
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //10
0x22,0x22,0x22,0x22,0x22
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_3IN7_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(300);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(3);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(300);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_3IN7_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Reg);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_3IN7_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
static void EPD_3IN7_ReadBusy_HIGH(void)
{
Debug("e-Paper busy\r\n");
UBYTE busy;
do {
busy = DEV_Digital_Read(EPD_BUSY_PIN);
} while(busy);
DEV_Delay_ms(200);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : set the look-up tables
parameter:
******************************************************************************/
void EPD_3IN7_Load_LUT(UBYTE lut)
{
UWORD i;
EPD_3IN7_SendCommand(0x32);
for (i = 0; i < 105; i++)
{
if(lut == 0)
EPD_3IN7_SendData(lut_4Gray_GC[i]);
else if(lut == 1)
EPD_3IN7_SendData(lut_1Gray_GC[i]);
else if(lut == 2)
EPD_3IN7_SendData(lut_1Gray_DU[i]);
else if(lut == 3)
EPD_3IN7_SendData(lut_1Gray_A2[i]);
else
Debug("There is no such lut \r\n");
}
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_3IN7_4Gray_Init(void)
{
EPD_3IN7_Reset();
EPD_3IN7_SendCommand(0x12);
DEV_Delay_ms(300);
EPD_3IN7_SendCommand(0x46);
EPD_3IN7_SendData(0xF7);
EPD_3IN7_ReadBusy_HIGH();
EPD_3IN7_SendCommand(0x47);
EPD_3IN7_SendData(0xF7);
EPD_3IN7_ReadBusy_HIGH();
EPD_3IN7_SendCommand(0x01); // setting gaet number
EPD_3IN7_SendData(0xDF);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x03); // set gate voltage
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x04); // set source voltage
EPD_3IN7_SendData(0x41);
EPD_3IN7_SendData(0xA8);
EPD_3IN7_SendData(0x32);
EPD_3IN7_SendCommand(0x11); // set data entry sequence
EPD_3IN7_SendData(0x03);
EPD_3IN7_SendCommand(0x3C); // set border
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x0C); // set booster strength
EPD_3IN7_SendData(0xAE);
EPD_3IN7_SendData(0xC7);
EPD_3IN7_SendData(0xC3);
EPD_3IN7_SendData(0xC0);
EPD_3IN7_SendData(0xC0);
EPD_3IN7_SendCommand(0x18); // set internal sensor on
EPD_3IN7_SendData(0x80);
EPD_3IN7_SendCommand(0x2C); // set vcom value
EPD_3IN7_SendData(0x44);
EPD_3IN7_SendCommand(0x37); // set display option, these setting turn on previous function
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x44); // setting X direction start/end position of RAM
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x17);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendCommand(0x45); // setting Y direction start/end position of RAM
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0xDF);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendCommand(0x22); // Display Update Control 2
EPD_3IN7_SendData(0xCF);
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_3IN7_1Gray_Init(void)
{
EPD_3IN7_Reset();
EPD_3IN7_SendCommand(0x12);
DEV_Delay_ms(300);
EPD_3IN7_SendCommand(0x46);
EPD_3IN7_SendData(0xF7);
EPD_3IN7_ReadBusy_HIGH();
EPD_3IN7_SendCommand(0x47);
EPD_3IN7_SendData(0xF7);
EPD_3IN7_ReadBusy_HIGH();
EPD_3IN7_SendCommand(0x01); // setting gaet number
EPD_3IN7_SendData(0xDF);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x03); // set gate voltage
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x04); // set source voltage
EPD_3IN7_SendData(0x41);
EPD_3IN7_SendData(0xA8);
EPD_3IN7_SendData(0x32);
EPD_3IN7_SendCommand(0x11); // set data entry sequence
EPD_3IN7_SendData(0x03);
EPD_3IN7_SendCommand(0x3C); // set border
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x0C); // set booster strength
EPD_3IN7_SendData(0xAE);
EPD_3IN7_SendData(0xC7);
EPD_3IN7_SendData(0xC3);
EPD_3IN7_SendData(0xC0);
EPD_3IN7_SendData(0xC0);
EPD_3IN7_SendCommand(0x18); // set internal sensor on
EPD_3IN7_SendData(0x80);
EPD_3IN7_SendCommand(0x2C); // set vcom value
EPD_3IN7_SendData(0x44);
EPD_3IN7_SendCommand(0x37); // set display option, these setting turn on previous function
EPD_3IN7_SendData(0x00); //can switch 1 gray or 4 gray
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0x4F);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendData(0xFF);
EPD_3IN7_SendCommand(0x44); // setting X direction start/end position of RAM
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x17);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendCommand(0x45); // setting Y direction start/end position of RAM
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0xDF);
EPD_3IN7_SendData(0x01);
EPD_3IN7_SendCommand(0x22); // Display Update Control 2
EPD_3IN7_SendData(0xCF);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_3IN7_4Gray_Clear(void)
{
UWORD Width, Height;
Width = (EPD_3IN7_WIDTH % 8 == 0)? (EPD_3IN7_WIDTH / 8 ): (EPD_3IN7_WIDTH / 8 + 1);
Height = EPD_3IN7_HEIGHT;
EPD_3IN7_SendCommand(0x49);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_3IN7_SendData(0xff);
}
}
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x26);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_3IN7_SendData(0xff);
}
}
EPD_3IN7_Load_LUT(0);
EPD_3IN7_SendCommand(0x22);
EPD_3IN7_SendData(0xC7);
EPD_3IN7_SendCommand(0x20);
EPD_3IN7_ReadBusy_HIGH();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_3IN7_1Gray_Clear(void)
{
UWORD i;
UWORD IMAGE_COUNTER = EPD_3IN7_WIDTH * EPD_3IN7_HEIGHT / 8;
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++)
{
EPD_3IN7_SendData(0xff);
}
EPD_3IN7_Load_LUT(2);
EPD_3IN7_SendCommand(0x20);
EPD_3IN7_ReadBusy_HIGH();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_3IN7_4Gray_Display(const UBYTE *Image)
{
UDOUBLE i,j,k;
UBYTE temp1,temp2,temp3;
EPD_3IN7_SendCommand(0x49);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24);
for(i=0;i<16800;i++){
temp3=0;
for(j=0; j<2; j++) {
temp1 = Image[i*2+j];
for(k=0; k<2; k++) {
temp2 = temp1&0xC0;
if(temp2 == 0xC0)
temp3 |= 0x01;//white
else if(temp2 == 0x00)
temp3 |= 0x00; //black
else if(temp2 == 0x80)
temp3 |= 0x00; //gray1
else //0x40
temp3 |= 0x01; //gray2
temp3 <<= 1;
temp1 <<= 2;
temp2 = temp1&0xC0 ;
if(temp2 == 0xC0) //white
temp3 |= 0x01;
else if(temp2 == 0x00) //black
temp3 |= 0x00;
else if(temp2 == 0x80)
temp3 |= 0x00; //gray1
else //0x40
temp3 |= 0x01; //gray2
if(j!=1 || k!=1)
temp3 <<= 1;
temp1 <<= 2;
}
}
EPD_3IN7_SendData(temp3);
}
// new data
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x26);
for(i=0; i<16800; i++) {
temp3=0;
for(j=0; j<2; j++) {
temp1 = Image[i*2+j];
for(k=0; k<2; k++) {
temp2 = temp1&0xC0 ;
if(temp2 == 0xC0)
temp3 |= 0x01;//white
else if(temp2 == 0x00)
temp3 |= 0x00; //black
else if(temp2 == 0x80)
temp3 |= 0x01; //gray1
else //0x40
temp3 |= 0x00; //gray2
temp3 <<= 1;
temp1 <<= 2;
temp2 = temp1&0xC0 ;
if(temp2 == 0xC0) //white
temp3 |= 0x01;
else if(temp2 == 0x00) //black
temp3 |= 0x00;
else if(temp2 == 0x80)
temp3 |= 0x01; //gray1
else //0x40
temp3 |= 0x00; //gray2
if(j!=1 || k!=1)
temp3 <<= 1;
temp1 <<= 2;
}
}
EPD_3IN7_SendData(temp3);
}
EPD_3IN7_Load_LUT(0);
EPD_3IN7_SendCommand(0x22);
EPD_3IN7_SendData(0xC7);
EPD_3IN7_SendCommand(0x20);
EPD_3IN7_ReadBusy_HIGH();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_3IN7_1Gray_Display(const UBYTE *Image)
{
UWORD i;
UWORD IMAGE_COUNTER = EPD_3IN7_WIDTH * EPD_3IN7_HEIGHT / 8;
EPD_3IN7_SendCommand(0x4E);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x4F);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendData(0x00);
EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++)
{
EPD_3IN7_SendData(Image[i]);
}
EPD_3IN7_Load_LUT(2);
EPD_3IN7_SendCommand(0x20);
EPD_3IN7_ReadBusy_HIGH();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{
UWORD i, Width;
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
EPD_3IN7_SendCommand(0x44);
EPD_3IN7_SendData(Xstart & 0xff);
EPD_3IN7_SendData((Xstart>>8) & 0x03);
EPD_3IN7_SendData(Xend & 0xff);
EPD_3IN7_SendData((Xend>>8) & 0x03);
EPD_3IN7_SendCommand(0x45);
EPD_3IN7_SendData(Ystart & 0xff);
EPD_3IN7_SendData((Ystart>>8) & 0x03);
EPD_3IN7_SendData(Yend & 0xff);
EPD_3IN7_SendData((Yend>>8) & 0x03);
EPD_3IN7_SendCommand(0x24);
for (i = 0; i < IMAGE_COUNTER; i++)
{
EPD_3IN7_SendData(Image[i]);
}
EPD_3IN7_Load_LUT(2);
EPD_3IN7_SendCommand(0x20);
EPD_3IN7_ReadBusy_HIGH();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_3IN7_Sleep(void)
{
EPD_3IN7_SendCommand(0X50);
EPD_3IN7_SendData(0xf7);
EPD_3IN7_SendCommand(0X02); //power off
EPD_3IN7_SendCommand(0X07); //deep sleep
EPD_3IN7_SendData(0xA5);
}

View file

@ -0,0 +1,51 @@
/*****************************************************************************
* | File : EPD_3IN7.h
* | Author : Waveshare team
* | Function : 3.7inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-17
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_3IN7_H_
#define __EPD_3IN7_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_3IN7_WIDTH 280
#define EPD_3IN7_HEIGHT 480
void EPD_3IN7_4Gray_Clear(void);
void EPD_3IN7_4Gray_Init(void);
void EPD_3IN7_4Gray_Display(const UBYTE *Image);
void EPD_3IN7_1Gray_Clear(void);
void EPD_3IN7_1Gray_Init(void);
void EPD_3IN7_1Gray_Display(const UBYTE *Image);
void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend);
void EPD_3IN7_Sleep(void);
#endif

View file

@ -558,9 +558,8 @@ void EPD_4IN2_Display(UBYTE *Image)
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image)
{
UWORD Width, Height;
UWORD Width;
Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1);
Height = EPD_4IN2_HEIGHT;
X_start = (X_start % 8 == 0)? (X_start): (X_start/8*8+8);
X_end = (X_end % 8 == 0)? (X_end): (X_end/8*8+8);

View file

@ -93,7 +93,7 @@ static void EPD_4IN2BC_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(200);
DEV_Delay_ms(5);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,265 @@
/*****************************************************************************
* | File : EPD_5in65f.c
* | Author : Waveshare team
* | Function : 5.65inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-07
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_5in65f.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_5IN65F_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_5IN65F_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Reg);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_5IN65F_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
static void EPD_5IN65F_BusyHigh(void)// If BUSYN=0 then waiting
{
while(!(DEV_Digital_Read(EPD_BUSY_PIN)));
}
static void EPD_5IN65F_BusyLow(void)// If BUSYN=1 then waiting
{
while(DEV_Digital_Read(EPD_BUSY_PIN));
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_5IN65F_Init(void)
{
EPD_5IN65F_Reset();
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x00);
EPD_5IN65F_SendData(0xEF);
EPD_5IN65F_SendData(0x08);
EPD_5IN65F_SendCommand(0x01);
EPD_5IN65F_SendData(0x37);
EPD_5IN65F_SendData(0x00);
EPD_5IN65F_SendData(0x23);
EPD_5IN65F_SendData(0x23);
EPD_5IN65F_SendCommand(0x03);
EPD_5IN65F_SendData(0x00);
EPD_5IN65F_SendCommand(0x06);
EPD_5IN65F_SendData(0xC7);
EPD_5IN65F_SendData(0xC7);
EPD_5IN65F_SendData(0x1D);
EPD_5IN65F_SendCommand(0x30);
EPD_5IN65F_SendData(0x3C);
EPD_5IN65F_SendCommand(0x40);
EPD_5IN65F_SendData(0x00);
EPD_5IN65F_SendCommand(0x50);
EPD_5IN65F_SendData(0x37);
EPD_5IN65F_SendCommand(0x60);
EPD_5IN65F_SendData(0x22);
EPD_5IN65F_SendCommand(0x61);
EPD_5IN65F_SendData(0x02);
EPD_5IN65F_SendData(0x58);
EPD_5IN65F_SendData(0x01);
EPD_5IN65F_SendData(0xC0);
EPD_5IN65F_SendCommand(0xE3);
EPD_5IN65F_SendData(0xAA);
DEV_Delay_ms(100);
EPD_5IN65F_SendCommand(0x50);
EPD_5IN65F_SendData(0x37);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_5IN65F_Clear(UBYTE color)
{
EPD_5IN65F_SendCommand(0x61);//Set Resolution setting
EPD_5IN65F_SendData(0x02);
EPD_5IN65F_SendData(0x58);
EPD_5IN65F_SendData(0x01);
EPD_5IN65F_SendData(0xC0);
EPD_5IN65F_SendCommand(0x10);
for(int i=0; i<EPD_5IN65F_WIDTH/2; i++) {
for(int j=0; j<EPD_5IN65F_HEIGHT; j++)
EPD_5IN65F_SendData((color<<4)|color);
}
EPD_5IN65F_SendCommand(0x04);//0x04
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x12);//0x12
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x02); //0x02
EPD_5IN65F_BusyLow();
DEV_Delay_ms(500);
}
/******************************************************************************
function : show 7 kind of color block
parameter:
******************************************************************************/
void EPD_5IN65F_Show7Block(void)
{
unsigned long i,j,k;
unsigned char const Color_seven[8] =
{EPD_5IN65F_BLACK,EPD_5IN65F_BLUE,EPD_5IN65F_GREEN,EPD_5IN65F_ORANGE,
EPD_5IN65F_RED,EPD_5IN65F_YELLOW,EPD_5IN65F_WHITE,EPD_5IN65F_WHITE};
EPD_5IN65F_SendCommand(0x61);//Set Resolution setting
EPD_5IN65F_SendData(0x02);
EPD_5IN65F_SendData(0x58);
EPD_5IN65F_SendData(0x01);
EPD_5IN65F_SendData(0xC0);
EPD_5IN65F_SendCommand(0x10);
for(i=0; i<224; i++) {
for(k = 0 ; k < 4; k ++) {
for(j = 0 ; j < 75; j ++) {
EPD_5IN65F_SendData((Color_seven[k]<<4) |Color_seven[k]);
}
}
}
for(i=0; i<224; i++) {
for(k = 4 ; k < 8; k ++) {
for(j = 0 ; j < 75; j ++) {
EPD_5IN65F_SendData((Color_seven[k]<<4) |Color_seven[k]);
}
}
}
EPD_5IN65F_SendCommand(0x04);//0x04
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x12);//0x12
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x02); //0x02
EPD_5IN65F_BusyLow();
DEV_Delay_ms(200);
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_5IN65F_Display(const UBYTE *image)
{
unsigned long i,j;
EPD_5IN65F_SendCommand(0x61);//Set Resolution setting
EPD_5IN65F_SendData(0x02);
EPD_5IN65F_SendData(0x58);
EPD_5IN65F_SendData(0x01);
EPD_5IN65F_SendData(0xC0);
EPD_5IN65F_SendCommand(0x10);
for(i=0; i<EPD_5IN65F_HEIGHT; i++) {
for(j=0; j<EPD_5IN65F_WIDTH/2; j++)
EPD_5IN65F_SendData(image[j+((EPD_5IN65F_WIDTH/2)*i)]);
}
EPD_5IN65F_SendCommand(0x04);//0x04
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x12);//0x12
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x02); //0x02
EPD_5IN65F_BusyLow();
DEV_Delay_ms(200);
}
/******************************************************************************
function : Sends the part image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_5IN65F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart,
UWORD image_width, UWORD image_heigh)
{
unsigned long i,j;
EPD_5IN65F_SendCommand(0x61);//Set Resolution setting
EPD_5IN65F_SendData(0x02);
EPD_5IN65F_SendData(0x58);
EPD_5IN65F_SendData(0x01);
EPD_5IN65F_SendData(0xC0);
EPD_5IN65F_SendCommand(0x10);
for(i=0; i<EPD_5IN65F_HEIGHT; i++) {
for(j=0; j< EPD_5IN65F_WIDTH/2; j++) {
if(i<image_heigh+ystart && i>=ystart && j<(image_width+xstart)/2 && j>=xstart/2) {
EPD_5IN65F_SendData(image[(j-xstart/2) + (image_width/2*(i-ystart))]);
}
else {
EPD_5IN65F_SendData(0x11);
}
}
}
EPD_5IN65F_SendCommand(0x04);//0x04
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x12);//0x12
EPD_5IN65F_BusyHigh();
EPD_5IN65F_SendCommand(0x02); //0x02
EPD_5IN65F_BusyLow();
DEV_Delay_ms(200);
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_5IN65F_Sleep(void)
{
DEV_Delay_ms(100);
EPD_5IN65F_SendCommand(0x07);
EPD_5IN65F_SendData(0xA5);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0); // Reset
}

View file

@ -0,0 +1,61 @@
/*****************************************************************************
* | File : EPD_5in65f.h
* | Author : Waveshare team
* | Function : 5.65inch e-paper
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-07
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_5IN65F_H__
#define __EPD_5IN65F_H__
#include "DEV_Config.h"
/**********************************
Color Index
**********************************/
#define EPD_5IN65F_BLACK 0x0 /// 000
#define EPD_5IN65F_WHITE 0x1 /// 001
#define EPD_5IN65F_GREEN 0x2 /// 010
#define EPD_5IN65F_BLUE 0x3 /// 011
#define EPD_5IN65F_RED 0x4 /// 100
#define EPD_5IN65F_YELLOW 0x5 /// 101
#define EPD_5IN65F_ORANGE 0x6 /// 110
#define EPD_5IN65F_CLEAN 0x7 /// 111 unavailable Afterimage
#define EPD_5IN65F_WIDTH 600
#define EPD_5IN65F_HEIGHT 448
void EPD_5IN65F_Clear(UBYTE color);
void EPD_5IN65F_Show7Block(void);
void EPD_5IN65F_Sleep(void);
void EPD_5IN65F_Display(const UBYTE *image);
void EPD_5IN65F_Init(void);
void EPD_5IN65F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh);
#endif

View file

@ -0,0 +1,312 @@
/*****************************************************************************
* | File : EPD_5in83b_V2.c
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-04
* | Info :
******************************************************************************
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files(the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_5in83b_V2.h"
#include "Debug.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_5IN83B_V2_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(1);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_5IN83B_V2_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_SPI_WriteByte(Reg);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_5IN83B_V2_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_CS_PIN, 0);
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, 1);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_5IN83B_V2_WaitUntilIdle(void)
{
Debug("e-Paper busy\r\n");
UBYTE busy;
do
{
EPD_5IN83B_V2_SendCommand(0x71);
busy = DEV_Digital_Read(EPD_BUSY_PIN);
busy =!(busy & 0x01);
}
while(busy);
DEV_Delay_ms(200);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_5IN83B_V2_TurnOnDisplay(void)
{
EPD_5IN83B_V2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(100); //!!!The delay here is necessary, 200uS at least!!!
EPD_5IN83B_V2_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
UBYTE EPD_5IN83B_V2_Init(void)
{
EPD_5IN83B_V2_Reset();
EPD_5IN83B_V2_WaitUntilIdle();
EPD_5IN83B_V2_SendCommand(0x01); //POWER SETTING
EPD_5IN83B_V2_SendData (0x07);
EPD_5IN83B_V2_SendData (0x07); //VGH=20V,VGL=-20V
EPD_5IN83B_V2_SendData (0x3f); //VDH=15V
EPD_5IN83B_V2_SendData (0x3f); //VDL=-15V
EPD_5IN83B_V2_SendCommand(0x04); //POWER ON
DEV_Delay_ms(100);
EPD_5IN83B_V2_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
EPD_5IN83B_V2_SendCommand(0X00); //PANNEL SETTING
EPD_5IN83B_V2_SendData(0x0F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
EPD_5IN83B_V2_SendCommand(0x61); //tres
EPD_5IN83B_V2_SendData (0x02); //source 648
EPD_5IN83B_V2_SendData (0x88);
EPD_5IN83B_V2_SendData (0x01); //gate 480
EPD_5IN83B_V2_SendData (0xe0);
EPD_5IN83B_V2_SendCommand(0X15);
EPD_5IN83B_V2_SendData(0x00);
EPD_5IN83B_V2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
EPD_5IN83B_V2_SendData(0x11);
EPD_5IN83B_V2_SendData(0x07);
EPD_5IN83B_V2_SendCommand(0X60); //TCON SETTING
EPD_5IN83B_V2_SendData(0x22);
return 0;
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_5IN83B_V2_Clear(void)
{
UWORD Width, Height;
Width =(EPD_5IN83B_V2_WIDTH % 8 == 0)?(EPD_5IN83B_V2_WIDTH / 8 ):(EPD_5IN83B_V2_WIDTH / 8 + 1);
Height = EPD_5IN83B_V2_HEIGHT;
UWORD i;
EPD_5IN83B_V2_SendCommand(0x10);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0xff);
}
EPD_5IN83B_V2_SendCommand(0x13);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0x00);
}
EPD_5IN83B_V2_TurnOnDisplay();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_5IN83B_V2_Clear_C(UBYTE color)
{
UWORD Width, Height;
Width =(EPD_5IN83B_V2_WIDTH % 8 == 0)?(EPD_5IN83B_V2_WIDTH / 8 ):(EPD_5IN83B_V2_WIDTH / 8 + 1);
Height = EPD_5IN83B_V2_HEIGHT;
UWORD i;
if(color == 0) {
EPD_5IN83B_V2_SendCommand(0x10);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0xff);
}
EPD_5IN83B_V2_SendCommand(0x13);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0x00);
}
}
else if(color == 1) {
EPD_5IN83B_V2_SendCommand(0x10);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0xff);
}
EPD_5IN83B_V2_SendCommand(0x13);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0xff);
}
}
else if(color == 2) {
EPD_5IN83B_V2_SendCommand(0x10);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0x00);
}
EPD_5IN83B_V2_SendCommand(0x13);
for(i=0; i<Width*Height; i++) {
EPD_5IN83B_V2_SendData(0x00);
}
}
EPD_5IN83B_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_5IN83B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
{
UDOUBLE Width, Height;
Width =(EPD_5IN83B_V2_WIDTH % 8 == 0)?(EPD_5IN83B_V2_WIDTH / 8 ):(EPD_5IN83B_V2_WIDTH / 8 + 1);
Height = EPD_5IN83B_V2_HEIGHT;
//send black data
EPD_5IN83B_V2_SendCommand(0x10);
for (UDOUBLE j = 0; j < Height; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(blackimage[i + j * Width]);
}
}
//send red data
EPD_5IN83B_V2_SendCommand(0x13);
for (UDOUBLE j = 0; j < Height; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(~ryimage[i + j * Width]);
}
}
EPD_5IN83B_V2_TurnOnDisplay();
}
void EPD_5IN83B_V2_DisplayPicture(const UBYTE *blackimage,UBYTE Block)
{
UDOUBLE Width, Height;
Width =(EPD_5IN83B_V2_WIDTH % 8 == 0)?(EPD_5IN83B_V2_WIDTH / 8 ):(EPD_5IN83B_V2_WIDTH / 8 + 1);
Height = EPD_5IN83B_V2_HEIGHT;
if(Block == 0){
EPD_5IN83B_V2_SendCommand(0x10);
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(blackimage[i + j * Width]);
}
}
}else if(Block == 1){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(blackimage[i + j * Width]);
}
}
}else if(Block == 2){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(blackimage[i + j * Width]);
}
}
}else if(Block == 3){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(blackimage[i + j * Width]);
}
}
}
else if(Block == 4){
EPD_5IN83B_V2_SendCommand(0x13);
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(~blackimage[i + j * Width]);
}
}
}else if(Block == 5){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(~blackimage[i + j * Width]);
}
}
}else if(Block == 6){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(~blackimage[i + j * Width]);
}
}
}else if(Block == 7){
for (UDOUBLE j = 0; j < Height/4; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_5IN83B_V2_SendData(~blackimage[i + j * Width]);
}
}
EPD_5IN83B_V2_TurnOnDisplay();
}
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_5IN83B_V2_Sleep(void)
{
EPD_5IN83B_V2_SendCommand(0X02); //power off
EPD_5IN83B_V2_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
EPD_5IN83B_V2_SendCommand(0X07); //deep sleep
EPD_5IN83B_V2_SendData(0xA5);
}

View file

@ -0,0 +1,47 @@
/*****************************************************************************
* | File : EPD_5in83b_V2.h
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-04
* | Info :
******************************************************************************
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef _EPD_5IN83B_V2_h_
#define _EPD_5IN83B_V2_h_
#include "DEV_Config.h"
// Display resolution
#define EPD_5IN83B_V2_WIDTH 648
#define EPD_5IN83B_V2_HEIGHT 480
UBYTE EPD_5IN83B_V2_Init(void);
void EPD_5IN83B_V2_Clear(void);
void EPD_5IN83B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage);
void EPD_5IN83B_V2_Sleep(void);
void EPD_5IN83B_V2_DisplayPicture(const UBYTE *blackimage,UBYTE Block);
void EPD_5IN83B_V2_Clear_C(UBYTE color);
#endif

View file

@ -229,7 +229,6 @@ void EPD_7IN5_HD_WritePicture(const UBYTE *blackimage, UBYTE Block)
EPD_7IN5_HD_SendData(0x00);
EPD_7IN5_HD_SendData(0x00);
EPD_7IN5_HD_SendCommand(0x24);
UDOUBLE i;
for (UDOUBLE j = 0; j < Height/2; j++) {
for (UDOUBLE i = 0; i < Width; i++) {
EPD_7IN5_HD_SendData(blackimage[i + j * Width]);

View file

@ -33,7 +33,6 @@
#include "DEV_Config.h"
// Display resolution
#define EPD_7IN5_HD_WIDTH 880
#define EPD_7IN5_HD_HEIGHT 528