2020-12-10

This commit is contained in:
hnwangkg-ezio 2020-12-11 14:36:30 +08:00
commit 04d4621789
493 changed files with 128806 additions and 689 deletions

View file

@ -0,0 +1,128 @@
/*****************************************************************************
* | File : EPD_2IN66b_test.c
* | Author : Waveshare team
* | Function : 2.66inch e-paper b test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-02
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in66b.h"
int EPD_2in66b_test(void)
{
printf("EPD_2IN66B_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN66B_Init();
EPD_2IN66B_Clear();
DEV_Delay_ms(500);
//Create a new image cache
UBYTE *BlackImage, *RedImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1)) * EPD_2IN66B_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for red memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
Paint_Clear(WHITE);
Paint_NewImage(RedImage, EPD_2IN66B_WIDTH, EPD_2IN66B_HEIGHT, 270, WHITE);
Paint_Clear(WHITE);
#if 1 //show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in66bb);
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in66br);
EPD_2IN66B_Display(BlackImage, RedImage);
DEV_Delay_ms(3000);
#endif
#if 1 // Drawing on the image
printf("Drawing\r\n");
//1.Draw black image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
//2.Draw red image
Paint_SelectImage(RedImage);
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
EPD_2IN66B_Display(BlackImage, RedImage);
DEV_Delay_ms(3000);
#endif
printf("Clear...\r\n");
EPD_2IN66B_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN66B_Sleep();
free(BlackImage);
BlackImage = NULL;
free(RedImage);
RedImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -0,0 +1,155 @@
/*****************************************************************************
* | File : EPD_2IN9_V2_test.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper V2 test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2in9_V2.h"
int EPD_2in9_V2_test(void)
{
printf("EPD_2IN9_V2_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_2IN9_V2_Init();
EPD_2IN9_V2_Clear();
//Create a new image cache
UBYTE *BlackImage;
UWORD Imagesize = ((EPD_2IN9_V2_WIDTH % 8 == 0)? (EPD_2IN9_V2_WIDTH / 8 ): (EPD_2IN9_V2_WIDTH / 8 + 1)) * EPD_2IN9_V2_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
Paint_Clear(WHITE);
#if 1 //show image for array
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_2in9);
EPD_2IN9_V2_Display(BlackImage);
DEV_Delay_ms(3000);
#endif
#if 1 // Drawing on the image
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
printf("Drawing\r\n");
//1.Select Image
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0,"你好abc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "微雪电子", &Font24CN, WHITE, BLACK);
EPD_2IN9_V2_Display_Base(BlackImage);
DEV_Delay_ms(3000);
#endif
#if 1 //Partial refresh, example shows time
Paint_NewImage(BlackImage, EPD_2IN9_V2_WIDTH, EPD_2IN9_V2_HEIGHT, 90, WHITE);
printf("Partial refresh\r\n");
Paint_SelectImage(BlackImage);
PAINT_TIME sPaint_time;
sPaint_time.Hour = 12;
sPaint_time.Min = 34;
sPaint_time.Sec = 56;
UBYTE num = 10;
for (;;) {
sPaint_time.Sec = sPaint_time.Sec + 1;
if (sPaint_time.Sec == 60) {
sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0;
sPaint_time.Min = 0;
sPaint_time.Sec = 0;
}
}
}
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1;
if(num == 0) {
break;
}
EPD_2IN9_V2_Display_Partial(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s
}
#endif
printf("Clear...\r\n");
EPD_2IN9_V2_Init();
EPD_2IN9_V2_Clear();
printf("Goto Sleep...\r\n");
EPD_2IN9_V2_Sleep();
free(BlackImage);
BlackImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_2in9bc_test.c
* | File : EPD_2in9b_V3_test.c
* | Author : Waveshare team
* | Function : 2.9inch B&C e-paper test demo
* | Function : 2.9inch B V3 e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-03
* | This version: V1.1
* | Date : 2020-12-03
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -28,21 +28,21 @@
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_2IN9B_V2.h"
#include "EPD_2IN9B_V3.h"
int EPD_2in9b_V2_test(void)
int EPD_2in9b_V3_test(void)
{
printf("EPD_2IN9B_V2_test Demo\r\n");
printf("EPD_2IN9B_V3_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
EPD_2IN9B_V2_Init();
EPD_2IN9B_V2_Clear();
EPD_2IN9B_V3_Init();
EPD_2IN9B_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_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1)) * EPD_2IN9B_V2_HEIGHT;
UWORD Imagesize = ((EPD_2IN9B_V3_WIDTH % 8 == 0)? (EPD_2IN9B_V3_WIDTH / 8 ): (EPD_2IN9B_V3_WIDTH / 8 + 1)) * EPD_2IN9B_V3_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
@ -52,8 +52,8 @@ int EPD_2in9b_V2_test(void)
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);
Paint_NewImage(BlackImage, EPD_2IN9B_V3_WIDTH, EPD_2IN9B_V3_HEIGHT, 270, WHITE);
Paint_NewImage(RYImage, EPD_2IN9B_V3_WIDTH, EPD_2IN9B_V3_HEIGHT, 270, WHITE);
//Select Image
Paint_SelectImage(BlackImage);
@ -63,7 +63,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);
EPD_2IN9B_V3_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
DEV_Delay_ms(5000);
#endif
@ -96,15 +96,15 @@ int EPD_2in9b_V2_test(void)
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
printf("EPD_Display\r\n");
EPD_2IN9B_V2_Display(BlackImage, RYImage);
EPD_2IN9B_V3_Display(BlackImage, RYImage);
DEV_Delay_ms(5000);
#endif
// clear EPD
printf("Clear...\r\n");
EPD_2IN9B_V2_Clear();
EPD_2IN9B_V3_Clear();
//deep sleep mode, free heap ram
printf("Goto Sleep...\r\n");
EPD_2IN9B_V2_Sleep();
EPD_2IN9B_V3_Sleep();
free(BlackImage);
free(RYImage);
BlackImage = NULL;

View file

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

View file

@ -0,0 +1,111 @@
/*****************************************************************************
* | File : EPD_5in83_V2_test.c
* | Author : Waveshare team
* | Function : 5.83inch e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_Test.h"
#include "EPD_5in83_V2.h"
#include "time.h"
int EPD_5in83_V2_test(void)
{
printf("EPD_5IN83_V2_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
printf("e-Paper Init and Clear...\r\n");
EPD_5in83_V2_Init();
EPD_5in83_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_5in83_V2_WIDTH % 8 == 0)? (EPD_5in83_V2_WIDTH / 8 ): (EPD_5in83_V2_WIDTH / 8 + 1)) * EPD_5in83_V2_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
return -1;
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_5in83_V2_WIDTH, EPD_5in83_V2_HEIGHT, 180, WHITE);
#if 1 // show image for array
printf("show image for array\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
Paint_DrawBitMap(gImage_5in83_V2);
EPD_5in83_V2_Display(BlackImage);
DEV_Delay_ms(500);
#endif
#if 1 // Drawing on the image
//1.Select Image
printf("SelectImage:BlackImage\r\n");
Paint_SelectImage(BlackImage);
Paint_Clear(WHITE);
// 2.Drawing on the image
printf("Drawing:BlackImage\r\n");
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
printf("EPD_Display\r\n");
EPD_5in83_V2_Display(BlackImage);
DEV_Delay_ms(2000);
#endif
printf("Clear...\r\n");
EPD_5in83_V2_Clear();
printf("Goto Sleep...\r\n");
EPD_5in83_V2_Sleep();
free(BlackImage);
BlackImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s
// close 5V
printf("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit();
return 0;
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_7in5bc_test.c
* | File : EPD_7in5b_V2_test.c
* | Author : Waveshare team
* | Function : 5.83inch B&C e-paper test demo
* | Function : 7.5inch B V2 e-paper test demo
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-13
* | This version: V1.1
* | Date : 2020-11-30
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -32,7 +32,7 @@
int EPD_7in5b_V2_test(void)
{
printf("EPD_7IN5BC_test Demo\r\n");
printf("EPD_7IN5B_V2_test Demo\r\n");
DEV_Module_Init();
printf("e-Paper Init and Clear...\r\n");
@ -82,8 +82,8 @@ int EPD_7in5b_V2_test(void)
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
EPD_7IN5B_V2_WritePicture(Image, 0);
Paint_Clear(WHITE);
EPD_7IN5B_V2_WritePicture(Image, 1);
Paint_Clear(WHITE);
EPD_7IN5B_V2_WritePicture(Image, 1);
//2.Draw red image
Paint_Clear(WHITE);
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
@ -94,8 +94,8 @@ int EPD_7in5b_V2_test(void)
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
EPD_7IN5B_V2_WritePicture(Image, 2);
Paint_Clear(WHITE);
EPD_7IN5B_V2_WritePicture(Image, 3);
Paint_Clear(WHITE);
EPD_7IN5B_V2_WritePicture(Image, 3);
printf("EPD_Display\r\n");
DEV_Delay_ms(2000);
#endif

View file

@ -48,8 +48,9 @@ int EPD_2in7_test(void);
int EPD_2in7b_test(void);
int EPD_2in9_test(void);
int EPD_2in9_V2_test(void);
int EPD_2in9bc_test(void);
int EPD_2in9b_V2_test(void);
int EPD_2in9b_V3_test(void);
int EPD_2in9d_test(void);
int EPD_2in13_test(void);
@ -59,15 +60,18 @@ int EPD_2in13b_V3_test(void);
int EPD_2in13d_test(void);
int EPD_2in66_test(void);
int EPD_2in66b_test(void);
int EPD_3in7_test(void);
int EPD_4in2_test(void);
int EPD_4in2bc_test(void);
int EPD_4in2b_V2_test(void);
int EPD_5in65f_test(void);
int EPD_5in83_test(void);
int EPD_5in83_V2_test(void);
int EPD_5in83bc_test(void);
int EPD_5in83b_V2_test(void);

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,8 @@ extern const unsigned char gImage_1in54c_Yellow[];
extern const unsigned char gImage_2in7[];
extern const unsigned char gImage_2in7b_Black[5808];
extern const unsigned char gImage_2in7b_Red[5808];
extern const unsigned char gImage_2in7b_Black_V2[5808];
extern const unsigned char gImage_2in7b_Red_V2[5808];
extern const unsigned char gImage_2in7_4Gray[];
@ -57,6 +59,8 @@ extern const unsigned char gImage_2in13c_y[];
extern const unsigned char gImage_2in13d[];
extern const unsigned char gImage_2in66[];
extern const unsigned char gImage_2in66bb[];
extern const unsigned char gImage_2in66br[];
extern const unsigned char gImage_3in7[]; //4 Gray
@ -68,6 +72,7 @@ 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_5in83_V2[];
extern const unsigned char gImage_5in83bc_b[];
extern const unsigned char gImage_5in83bc_ry[];
extern const unsigned char gImage_5in83b_V2_b[];

View file

@ -97,7 +97,7 @@ void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD
Paint.WidthMemory = Width;
Paint.HeightMemory = Height;
Paint.Color = Color;
Paint.Scale = 2;
Paint.Scale = 2;
Paint.WidthByte = (Width % 8 == 0)? (Width / 8 ): (Width / 8 + 1);
Paint.HeightByte = Height;

View file

@ -88,7 +88,7 @@ static void EPD_1IN02_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);
DEV_Digital_Write(EPD_RST_PIN, 0);// Module reset
DEV_Delay_ms(20);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(20);

View file

@ -110,7 +110,7 @@ static void EPD_1IN54_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -39,7 +39,7 @@ static void EPD_1IN54_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
@ -241,6 +241,13 @@ void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
Height = EPD_1IN54_V2_HEIGHT;
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
EPD_1IN54_V2_SendData(0x80);
UDOUBLE Addr = 0;
EPD_1IN54_V2_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {

View file

@ -112,7 +112,7 @@ static void EPD_1IN54B_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
}

View file

@ -40,7 +40,7 @@ static void EPD_1IN54B_V2_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
}

View file

@ -90,7 +90,7 @@ static void EPD_1IN54C_Reset(void)
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
}

View file

@ -73,7 +73,7 @@ static void EPD_2IN13_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -97,7 +97,7 @@ static void EPD_2IN13_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -30,7 +30,7 @@
******************************************************************************/
#include "EPD_2in13b_V3.h"
#include "Debug.h"
//元太屏
/******************************************************************************
function : Software reset
parameter:
@ -40,9 +40,9 @@ static void EPD_2IN13B_V3_Reset(void)
DEV_Digital_Write(EPD_CS_PIN, 1);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(1000);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
}

View file

@ -92,7 +92,7 @@ static void EPD_2IN13BC_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -174,7 +174,7 @@ static void EPD_2IN13D_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -59,7 +59,7 @@ 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_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,213 @@
/*****************************************************************************
* | File : EPD_2in66b.c
* | Author : Waveshare team
* | Function : 2.66inch e-paper b
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-02
* | 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_2in66b.h"
#include "Debug.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN66B_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN66B_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_2IN66B_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:
******************************************************************************/
static void EPD_2IN66B_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
DEV_Delay_ms(50);
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
DEV_Delay_ms(10);
}
DEV_Delay_ms(50);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN66B_TurnOnDisplay(void)
{
EPD_2IN66B_SendCommand(0x20);
EPD_2IN66B_ReadBusy();
}
/******************************************************************************
function : Setting the display window
parameter:
******************************************************************************/
static void EPD_2IN66B_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{
EPD_2IN66B_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
EPD_2IN66B_SendData((Xstart>>3) & 0x1F);
EPD_2IN66B_SendData((Xend>>3) & 0x1F);
EPD_2IN66B_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
EPD_2IN66B_SendData(Ystart & 0xFF);
EPD_2IN66B_SendData((Ystart >> 8) & 0x01);
EPD_2IN66B_SendData(Yend & 0xFF);
EPD_2IN66B_SendData((Yend >> 8) & 0x01);
}
/******************************************************************************
function : Set Cursor
parameter:
******************************************************************************/
static void EPD_2IN66B_SetCursor(UWORD Xstart, UWORD Ystart)
{
EPD_2IN66B_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
EPD_2IN66B_SendData(Xstart & 0x1F);
EPD_2IN66B_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
EPD_2IN66B_SendData(Ystart & 0xFF);
EPD_2IN66B_SendData((Ystart >> 8) & 0x01);
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN66B_Init(void)
{
EPD_2IN66B_Reset();
EPD_2IN66B_ReadBusy();
EPD_2IN66B_SendCommand(0x12);//soft reset
EPD_2IN66B_ReadBusy();
EPD_2IN66B_SendCommand(0x11); //data entry mode
EPD_2IN66B_SendData(0x03);
EPD_2IN66B_SetWindows(0, 0, EPD_2IN66B_WIDTH-1, EPD_2IN66B_HEIGHT-1);
EPD_2IN66B_SendCommand(0x21); // Display update control
EPD_2IN66B_SendData(0x00);
EPD_2IN66B_SendData(0x80);
EPD_2IN66B_SetCursor(0, 0);
EPD_2IN66B_ReadBusy();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN66B_Display(UBYTE *ImageBlack, UBYTE*ImageRed)
{
UWORD Width, Height;
Width = (EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1);
Height = EPD_2IN66B_HEIGHT;
EPD_2IN66B_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN66B_SendData(ImageBlack[i + j * Width]);
}
}
EPD_2IN66B_SendCommand(0x26);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN66B_SendData(~ImageRed[i + j * Width]);
}
}
EPD_2IN66B_TurnOnDisplay();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN66B_Clear(void)
{
UWORD Width, Height;
Width = (EPD_2IN66B_WIDTH % 8 == 0)? (EPD_2IN66B_WIDTH / 8 ): (EPD_2IN66B_WIDTH / 8 + 1);
Height = EPD_2IN66B_HEIGHT;
EPD_2IN66B_SendCommand(0x24);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN66B_SendData(0xff);
}
}
EPD_2IN66B_SendCommand(0x26);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN66B_SendData(0x00);
}
}
EPD_2IN66B_TurnOnDisplay();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN66B_Sleep(void)
{
EPD_2IN66B_SendCommand(0x10);
EPD_2IN66B_SendData(0x01);
}

View file

@ -0,0 +1,44 @@
/*****************************************************************************
* | File : EPD_2in66b.h
* | Author : Waveshare team
* | Function : 2.66inch e-paper b
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-02
* | 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_2IN66B_H_
#define __EPD_2IN66B_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2IN66B_WIDTH 152
#define EPD_2IN66B_HEIGHT 296
void EPD_2IN66B_Init(void);
void EPD_2IN66B_Display(UBYTE *ImageBlack, UBYTE*ImageRed);
void EPD_2IN66B_Clear(void);
void EPD_2IN66B_Sleep(void);
#endif

View file

@ -202,7 +202,7 @@ static void EPD_2in7_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -153,7 +153,7 @@ static void EPD_2IN7B_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

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(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,282 @@
/*****************************************************************************
* | File : EPD_2in9_V2.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper V2
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | 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_2in9_V2.h"
#include "Debug.h"
UBYTE _WF_PARTIAL_2IN9[159] =
{
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0A,0x0,0x0,0x0,0x0,0x0,0x2,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
0x22,0x17,0x41,0xB0,0x32,0x36,
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN9_V2_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(100);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN9_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_2IN9_V2_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_2IN9_V2_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
while(1)
{ //=1 BUSY
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
break;
DEV_Delay_ms(50);
}
DEV_Delay_ms(50);
Debug("e-Paper busy release\r\n");
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN9_V2_TurnOnDisplay(void)
{
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
EPD_2IN9_V2_SendData(0xF7);
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
EPD_2IN9_V2_ReadBusy();
}
static void EPD_2IN9_V2_TurnOnDisplay_Partial(void)
{
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
EPD_2IN9_V2_SendData(0xFF);
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
EPD_2IN9_V2_ReadBusy();
}
/******************************************************************************
function : Setting the display window
parameter:
******************************************************************************/
static void EPD_2IN9_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
{
EPD_2IN9_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
EPD_2IN9_V2_SendData((Xstart>>3) & 0xFF);
EPD_2IN9_V2_SendData((Xend>>3) & 0xFF);
EPD_2IN9_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
EPD_2IN9_V2_SendData(Ystart & 0xFF);
EPD_2IN9_V2_SendData((Ystart >> 8) & 0xFF);
EPD_2IN9_V2_SendData(Yend & 0xFF);
EPD_2IN9_V2_SendData((Yend >> 8) & 0xFF);
}
/******************************************************************************
function : Set Cursor
parameter:
******************************************************************************/
static void EPD_2IN9_V2_SetCursor(UWORD Xstart, UWORD Ystart)
{
EPD_2IN9_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
EPD_2IN9_V2_SendData(Xstart & 0xFF);
EPD_2IN9_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
EPD_2IN9_V2_SendData(Ystart & 0xFF);
EPD_2IN9_V2_SendData((Ystart >> 8) & 0xFF);
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN9_V2_Init(void)
{
EPD_2IN9_V2_Reset();
DEV_Delay_ms(100);
EPD_2IN9_V2_ReadBusy();
EPD_2IN9_V2_SendCommand(0x12); //SWRESET
EPD_2IN9_V2_ReadBusy();
EPD_2IN9_V2_SendCommand(0x01); //Driver output control
EPD_2IN9_V2_SendData(0x27);
EPD_2IN9_V2_SendData(0x01);
EPD_2IN9_V2_SendData(0x00);
EPD_2IN9_V2_SendCommand(0x11); //data entry mode
EPD_2IN9_V2_SendData(0x03);
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN9_V2_SendData(0x05);
EPD_2IN9_V2_SendCommand(0x21); // Display update control
EPD_2IN9_V2_SendData(0x00);
EPD_2IN9_V2_SendData(0x80);
EPD_2IN9_V2_SendCommand(0x18); //Read built-in temperature sensor
EPD_2IN9_V2_SendData(0x80);
EPD_2IN9_V2_SetCursor(0, 0);
EPD_2IN9_V2_ReadBusy();
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN9_V2_Clear(void)
{
UWORD i;
EPD_2IN9_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
for(i=0;i<4736;i++)
{
EPD_2IN9_V2_SendData(0xff);
}
EPD_2IN9_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN9_V2_Display(UBYTE *Image)
{
UWORD i;
EPD_2IN9_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
for(i=0;i<4736;i++)
{
EPD_2IN9_V2_SendData(Image[i]);
}
EPD_2IN9_V2_TurnOnDisplay();
}
void EPD_2IN9_V2_Display_Base(UBYTE *Image)
{
UWORD i;
EPD_2IN9_V2_SendCommand(0x24); //Write Black and White image to RAM
for(i=0;i<4736;i++)
{
EPD_2IN9_V2_SendData(Image[i]);
}
EPD_2IN9_V2_SendCommand(0x26); //Write Black and White image to RAM
for(i=0;i<4736;i++)
{
EPD_2IN9_V2_SendData(Image[i]);
}
EPD_2IN9_V2_TurnOnDisplay();
}
void EPD_2IN9_V2_Display_Partial(UBYTE *Image)
{
UWORD i;
//Reset
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(5);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(10);
EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN9_V2_SendData(0x80);
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
EPD_2IN9_V2_SetCursor(0, 0);
EPD_2IN9_V2_SendCommand(0x24); //Write Black and White image to RAM
for(i=0;i<4736;i++)
{
EPD_2IN9_V2_SendData(Image[i]);
}
EPD_2IN9_V2_TurnOnDisplay_Partial();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN9_V2_Sleep(void)
{
EPD_2IN9_V2_SendCommand(0x10); //enter deep sleep
EPD_2IN9_V2_SendData(0x01);
DEV_Delay_ms(100);
}

View file

@ -0,0 +1,47 @@
/*****************************************************************************
* | File : EPD_2in9_V2.h
* | Author : Waveshare team
* | Function : 2.9inch e-paper V2
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | 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_2IN9_V2_H_
#define __EPD_2IN9_V2_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2IN9_V2_WIDTH 128
#define EPD_2IN9_V2_HEIGHT 296
void EPD_2IN9_V2_Init(void);
void EPD_2IN9_V2_Clear(void);
void EPD_2IN9_V2_Display(UBYTE *Image);
void EPD_2IN9_V2_Display_Base(UBYTE *Image);
void EPD_2IN9_V2_Display_Partial(UBYTE *Image);
void EPD_2IN9_V2_Sleep(void);
#endif

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_2in9b_V2.c
* | File : EPD_2in9b_V3.c
* | Author : Waveshare team
* | Function : 2.9inch e-paper b V2
* | Function : 2.9inch e-paper b V3
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-07-03
* | This version: V1.1
* | Date : 2020-12-03
* | Info :
* -----------------------------------------------------------------------------
#
@ -28,14 +28,14 @@
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_2in9b_V2.h"
#include "EPD_2in9b_V3.h"
#include "Debug.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN9B_V2_Reset(void)
static void EPD_2IN9B_V3_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
@ -50,7 +50,7 @@ function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN9B_V2_SendCommand(UBYTE Reg)
static void EPD_2IN9B_V3_SendCommand(UBYTE Reg)
{
DEV_Digital_Write(EPD_DC_PIN, 0);
DEV_Digital_Write(EPD_CS_PIN, 0);
@ -63,7 +63,7 @@ function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2IN9B_V2_SendData(UBYTE Data)
static void EPD_2IN9B_V3_SendData(UBYTE Data)
{
DEV_Digital_Write(EPD_DC_PIN, 1);
DEV_Digital_Write(EPD_CS_PIN, 0);
@ -75,13 +75,13 @@ static void EPD_2IN9B_V2_SendData(UBYTE Data)
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2IN9B_V2_ReadBusy(void)
void EPD_2IN9B_V3_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
UBYTE busy;
do
{
EPD_2IN9B_V2_SendCommand(0x71);
EPD_2IN9B_V3_SendCommand(0x71);
busy = DEV_Digital_Read(EPD_BUSY_PIN);
busy =!(busy & 0x01);
}
@ -94,24 +94,24 @@ void EPD_2IN9B_V2_ReadBusy(void)
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN9B_V2_Init(void)
void EPD_2IN9B_V3_Init(void)
{
EPD_2IN9B_V2_Reset();
EPD_2IN9B_V3_Reset();
EPD_2IN9B_V2_SendCommand(0x04);
EPD_2IN9B_V2_ReadBusy();//waiting for the electronic paper IC to release the idle signal
EPD_2IN9B_V3_SendCommand(0x04);
EPD_2IN9B_V3_ReadBusy();//waiting for the electronic paper IC to release the idle signal
EPD_2IN9B_V2_SendCommand(0x00);//panel setting
EPD_2IN9B_V2_SendData(0x0f);//LUT from OTP128x296
EPD_2IN9B_V2_SendData(0x89);//Temperature sensor, boost and other related timing settings
EPD_2IN9B_V3_SendCommand(0x00);//panel setting
EPD_2IN9B_V3_SendData(0x0f);//LUT from OTP128x296
EPD_2IN9B_V3_SendData(0x89);//Temperature sensor, boost and other related timing settings
EPD_2IN9B_V2_SendCommand(0x61);//resolution setting
EPD_2IN9B_V2_SendData (0x80);
EPD_2IN9B_V2_SendData (0x01);
EPD_2IN9B_V2_SendData (0x28);
EPD_2IN9B_V3_SendCommand(0x61);//resolution setting
EPD_2IN9B_V3_SendData (0x80);
EPD_2IN9B_V3_SendData (0x01);
EPD_2IN9B_V3_SendData (0x28);
EPD_2IN9B_V2_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
EPD_2IN9B_V2_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
EPD_2IN9B_V3_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
EPD_2IN9B_V3_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
//WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
}
@ -119,71 +119,71 @@ void EPD_2IN9B_V2_Init(void)
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN9B_V2_Clear(void)
void EPD_2IN9B_V3_Clear(void)
{
UWORD Width = (EPD_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1);
UWORD Height = EPD_2IN9B_V2_HEIGHT;
UWORD Width = (EPD_2IN9B_V3_WIDTH % 8 == 0)? (EPD_2IN9B_V3_WIDTH / 8 ): (EPD_2IN9B_V3_WIDTH / 8 + 1);
UWORD Height = EPD_2IN9B_V3_HEIGHT;
//send black data
EPD_2IN9B_V2_SendCommand(0x10);
EPD_2IN9B_V3_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN9B_V2_SendData(0xFF);
EPD_2IN9B_V3_SendData(0xFF);
}
}
//send red data
EPD_2IN9B_V2_SendCommand(0x13);
EPD_2IN9B_V3_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN9B_V2_SendData(0xFF);
EPD_2IN9B_V3_SendData(0xFF);
}
}
EPD_2IN9B_V2_SendCommand(0x12);
EPD_2IN9B_V2_ReadBusy();
EPD_2IN9B_V3_SendCommand(0x12);
EPD_2IN9B_V3_ReadBusy();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN9B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
void EPD_2IN9B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage)
{
UWORD Width, Height;
Width = (EPD_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1);
Height = EPD_2IN9B_V2_HEIGHT;
Width = (EPD_2IN9B_V3_WIDTH % 8 == 0)? (EPD_2IN9B_V3_WIDTH / 8 ): (EPD_2IN9B_V3_WIDTH / 8 + 1);
Height = EPD_2IN9B_V3_HEIGHT;
//send black data
EPD_2IN9B_V2_SendCommand(0x10);
EPD_2IN9B_V3_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN9B_V2_SendData(blackimage[i + j * Width]);
EPD_2IN9B_V3_SendData(blackimage[i + j * Width]);
}
}
EPD_2IN9B_V2_SendCommand(0x92);
EPD_2IN9B_V3_SendCommand(0x92);
//send red data
EPD_2IN9B_V2_SendCommand(0x13);
EPD_2IN9B_V3_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_2IN9B_V2_SendData(ryimage[i + j * Width]);
EPD_2IN9B_V3_SendData(ryimage[i + j * Width]);
}
}
EPD_2IN9B_V2_SendCommand(0x92);
EPD_2IN9B_V3_SendCommand(0x92);
EPD_2IN9B_V2_SendCommand(0x12);
EPD_2IN9B_V2_ReadBusy();
EPD_2IN9B_V3_SendCommand(0x12);
EPD_2IN9B_V3_ReadBusy();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN9B_V2_Sleep(void)
void EPD_2IN9B_V3_Sleep(void)
{
EPD_2IN9B_V2_SendCommand(0x02); // POWER_OFF
EPD_2IN9B_V2_ReadBusy();
EPD_2IN9B_V2_SendCommand(0x07); // DEEP_SLEEP
EPD_2IN9B_V2_SendData(0xA5); // check code
EPD_2IN9B_V3_SendCommand(0x02); // POWER_OFF
EPD_2IN9B_V3_ReadBusy();
EPD_2IN9B_V3_SendCommand(0x07); // DEEP_SLEEP
EPD_2IN9B_V3_SendData(0xA5); // check code
}

View file

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

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(10);
DEV_Delay_ms(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -273,7 +273,7 @@ static void EPD_4IN2_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,184 @@
/*****************************************************************************
* | File : EPD_4in2b_V2.c
* | Author : Waveshare team
* | Function : 4.2inch e-paper b V2
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-11-25
* | 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_4in2b_V2.h"
#include "Debug.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_4IN2B_V2_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(5);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_4IN2B_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_4IN2B_V2_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_4IN2B_V2_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
unsigned char busy;
do{
EPD_4IN2B_V2_SendCommand(0x71);
busy = DEV_Digital_Read(EPD_BUSY_PIN);
busy =!(busy & 0x01);
}while(busy);
Debug("e-Paper busy release\r\n");
DEV_Delay_ms(200);
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_4IN2B_V2_TurnOnDisplay(void)
{
EPD_4IN2B_V2_SendCommand(0x12); // DISPLAY_REFRESH
DEV_Delay_ms(100);
EPD_4IN2B_V2_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_4IN2B_V2_Init(void)
{
EPD_4IN2B_V2_Reset();
EPD_4IN2B_V2_SendCommand(0x04);
EPD_4IN2B_V2_ReadBusy();
EPD_4IN2B_V2_SendCommand(0x00);
EPD_4IN2B_V2_SendData(0x0f);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_4IN2B_V2_Clear(void)
{
UWORD Width, Height;
Width = (EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1);
Height = EPD_4IN2B_V2_HEIGHT;
EPD_4IN2B_V2_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2B_V2_SendData(0xFF);
}
}
EPD_4IN2B_V2_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2B_V2_SendData(0xFF);
}
}
EPD_4IN2B_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_4IN2B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
{
UWORD Width, Height;
Width = (EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1);
Height = EPD_4IN2B_V2_HEIGHT;
EPD_4IN2B_V2_SendCommand(0x10);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2B_V2_SendData(blackimage[i + j * Width]);
}
}
EPD_4IN2B_V2_SendCommand(0x13);
for (UWORD j = 0; j < Height; j++) {
for (UWORD i = 0; i < Width; i++) {
EPD_4IN2B_V2_SendData(ryimage[i + j * Width]);
}
}
EPD_4IN2B_V2_TurnOnDisplay();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_4IN2B_V2_Sleep(void)
{
EPD_4IN2B_V2_SendCommand(0X50);
EPD_4IN2B_V2_SendData(0xf7); //border floating
EPD_4IN2B_V2_SendCommand(0X02); //power off
EPD_4IN2B_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
EPD_4IN2B_V2_SendCommand(0X07); //deep sleep
EPD_4IN2B_V2_SendData(0xA5);
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_2in9b V2.h
* | File : EPD_4in2b_V2.h
* | Author : Waveshare team
* | Function : 2.9inch e-paper b V2
* | Function : 4.2inch e-paper b&c
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-04-12
* | Date : 2020-11-25
* | Info :
* -----------------------------------------------------------------------------
#
@ -28,18 +28,18 @@
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_2IN9B_V2_H_
#define __EPD_2IN9B_V2_H_
#ifndef __EPD_4IN2B_V2_H_
#define __EPD_4IN2B_V2_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_2IN9B_V2_WIDTH 128
#define EPD_2IN9B_V2_HEIGHT 296
#define EPD_4IN2B_V2_WIDTH 400
#define EPD_4IN2B_V2_HEIGHT 300
void EPD_2IN9B_V2_Init(void);
void EPD_2IN9B_V2_Clear(void);
void EPD_2IN9B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage);
void EPD_2IN9B_V2_Sleep(void);
void EPD_4IN2B_V2_Init(void);
void EPD_4IN2B_V2_Clear(void);
void EPD_4IN2B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage);
void EPD_4IN2B_V2_Sleep(void);
#endif

View file

@ -96,7 +96,7 @@ static void EPD_5IN83_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -0,0 +1,196 @@
/*****************************************************************************
* | File : EPD_5in83_V2.c
* | Author : Waveshare team
* | Function : 5.83inch e-paper V2
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | 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_5in83_V2.h"
#include "Debug.h"
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_5in83_V2_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, 0);
DEV_Delay_ms(3);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_5in83_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_5in83_V2_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:
******************************************************************************/
static void EPD_5in83_V2_ReadBusy(void)
{
Debug("e-Paper busy\r\n");
do {
EPD_5in83_V2_SendCommand(0x71);
DEV_Delay_ms(50);
}
while(!DEV_Digital_Read(EPD_BUSY_PIN));
Debug("e-Paper busy release\r\n");
DEV_Delay_ms(50);
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_5in83_V2_TurnOnDisplay(void)
{
EPD_5in83_V2_SendCommand(0x12); //DISPLAY REFRESH
DEV_Delay_ms(100); //!!!The delay here is necessary, 200uS at least!!!
EPD_5in83_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_5in83_V2_Init(void)
{
EPD_5in83_V2_Reset();
EPD_5in83_V2_SendCommand(0x01); //POWER SETTING
EPD_5in83_V2_SendData (0x07);
EPD_5in83_V2_SendData (0x07); //VGH=20V,VGL=-20V
EPD_5in83_V2_SendData (0x3f); //VDH=15V
EPD_5in83_V2_SendData (0x3f); //VDL=-15V
EPD_5in83_V2_SendCommand(0x04); //POWER ON
DEV_Delay_ms(100);
EPD_5in83_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
EPD_5in83_V2_SendCommand(0X00); //PANNEL SETTING
EPD_5in83_V2_SendData(0x1F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
EPD_5in83_V2_SendCommand(0x61); //tres
EPD_5in83_V2_SendData (0x02); //source 648
EPD_5in83_V2_SendData (0x88);
EPD_5in83_V2_SendData (0x01); //gate 480
EPD_5in83_V2_SendData (0xE0);
EPD_5in83_V2_SendCommand(0X15);
EPD_5in83_V2_SendData(0x00);
EPD_5in83_V2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
EPD_5in83_V2_SendData(0x10);
EPD_5in83_V2_SendData(0x07);
EPD_5in83_V2_SendCommand(0X60); //TCON SETTING
EPD_5in83_V2_SendData(0x22);
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_5in83_V2_Clear(void)
{
UWORD Width, Height, i;
Width = (EPD_5in83_V2_WIDTH % 8 == 0)? (EPD_5in83_V2_WIDTH / 8 ): (EPD_5in83_V2_WIDTH / 8 + 1);
Height = EPD_5in83_V2_HEIGHT;
EPD_5in83_V2_SendCommand(0x10);
for(i=0; i<Width*Height; i++) {
EPD_5in83_V2_SendData(0x00);
}
EPD_5in83_V2_SendCommand(0x13);
for(i=0; i<Width*Height; i++) {
EPD_5in83_V2_SendData(0x00);
}
EPD_5in83_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_5in83_V2_Display(UBYTE *Image)
{
UWORD Width, Height, i, j;
Width = (EPD_5in83_V2_WIDTH % 8 == 0)? (EPD_5in83_V2_WIDTH / 8 ): (EPD_5in83_V2_WIDTH / 8 + 1);
Height = EPD_5in83_V2_HEIGHT;
EPD_5in83_V2_SendCommand(0x10);
for(i=0;i<Height;i++) {
for(j=0; j<Width; j++) {
EPD_5in83_V2_SendData(0x00);
}
}
EPD_5in83_V2_SendCommand(0x13);
for(i=0;i<Height;i++) {
for(j=0; j<Width; j++) {
EPD_5in83_V2_SendData(~Image[i*Width + j]);
}
}
EPD_5in83_V2_TurnOnDisplay();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_5in83_V2_Sleep(void)
{
EPD_5in83_V2_SendCommand(0X02); //power off
EPD_5in83_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
EPD_5in83_V2_SendCommand(0X07); //deep sleep
EPD_5in83_V2_SendData(0xA5);
}

View file

@ -0,0 +1,44 @@
/*****************************************************************************
* | File : EPD_5in83_V2.h
* | Author : Waveshare team
* | Function : 5.83inch e-paper V2
* | Info :
*----------------
* | This version: V1.0
* | Date : 2020-12-09
* | 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_5in83_V2_H_
#define __EPD_5in83_V2_H_
#include "DEV_Config.h"
// Display resolution
#define EPD_5in83_V2_WIDTH 648
#define EPD_5in83_V2_HEIGHT 480
void EPD_5in83_V2_Init(void);
void EPD_5in83_V2_Clear(void);
void EPD_5in83_V2_Display(UBYTE *Image);
void EPD_5in83_V2_Sleep(void);
#endif

View file

@ -94,7 +94,7 @@ static void EPD_5IN83BC_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -96,7 +96,7 @@ static void EPD_7IN5_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -39,7 +39,7 @@ static void EPD_7IN5B_HD_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_7IN5B_V2_7in5.c
* | File : EPD_7IN5b_V2.c
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V2.0
* | Date : 2018-11-09
* | This version: V2.1
* | Date : 2020-11-30
* | Info :
******************************************************************************
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -136,12 +136,17 @@ UBYTE EPD_7IN5B_V2_Init(void)
EPD_7IN5B_V2_SendCommand(0X60); //TCON SETTING
EPD_7IN5B_V2_SendData(0x22);
EPD_7IN5B_V2_SendCommand(0X82);
EPD_7IN5B_V2_SendData(0x08);
EPD_7IN5B_V2_SendCommand(0X30);
EPD_7IN5B_V2_SendData(0x06);
EPD_7IN5B_V2_SendCommand(0X82);
EPD_7IN5B_V2_SendData(0x08);
EPD_7IN5B_V2_SendCommand(0X30);
EPD_7IN5B_V2_SendData(0x06);
EPD_7IN5B_V2_SendCommand(0x65); // Resolution setting
EPD_7IN5B_V2_SendData(0x00);
EPD_7IN5B_V2_SendData(0x00);//800*480
EPD_7IN5B_V2_SendData(0x00);
EPD_7IN5B_V2_SendData(0x00);
return 0;
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************
* | File : EPD_7in5.h
* | File : EPD_7in5b_V2.h
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V2.0
* | Date : 2018-11-09
* | This version: V2.1
* | Date : 2020-11-30
* | Info :
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
* 2.Change:EPD_Display(UBYTE *Image)

View file

@ -94,7 +94,7 @@ static void EPD_7IN5BC_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(2);
DEV_Digital_Write(EPD_RST_PIN, 1);
DEV_Delay_ms(200);
}