2020.05.22
This commit is contained in:
parent
8973995e53
commit
853a3a4632
224 changed files with 26246 additions and 3145 deletions
112
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_V2_test.c
Normal file
112
STM32/STM32-F103ZET6/User/Examples/EPD_1in54b_V2_test.c
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch B e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54b_V2.h"
|
||||
|
||||
int EPD_1in54b_V2_test(void)
|
||||
{
|
||||
printf("EPD_1IN54b_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
EPD_1IN54B_V2_Init();
|
||||
EPD_1IN54B_V2_Clear();
|
||||
DEV_Delay_ms(200);
|
||||
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UWORD Imagesize = ((EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1)) * EPD_1IN54B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RedImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
Paint_NewImage(RedImage, EPD_1IN54B_V2_WIDTH, EPD_1IN54B_V2_HEIGHT, 90, WHITE);
|
||||
|
||||
#if 1 //Drawing
|
||||
printf("Drawing------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(170, 85, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 70, "hello world", &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(170, 15, 170, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(150, 35, 190, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(170, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_EN(5, 90, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 120, 123456789, &Font20, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
printf("show image for array------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Black);
|
||||
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_DrawBitMap(gImage_1in54b_Red);
|
||||
|
||||
EPD_1IN54B_V2_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RedImage);
|
||||
BlackImage = NULL;
|
||||
RedImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13b_V2_test.c
Normal file
120
STM32/STM32-F103ZET6/User/Examples/EPD_2in13b_V2_test.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN13B_V2.h"
|
||||
|
||||
int EPD_2in13b_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN13B_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13B_V2_Init();
|
||||
EPD_2IN13B_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN13B_V2_WIDTH % 8 == 0)? (EPD_2IN13B_V2_WIDTH / 8 ): (EPD_2IN13B_V2_WIDTH / 8 + 1)) * EPD_2IN13B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN13B_V2_WIDTH, EPD_2IN13B_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
// EPD_2IN13B_V2_Display(gImage_2in13b_b, gImage_2in13b_r);
|
||||
|
||||
EPD_2IN13B_V2_Display(gImage_2in13c_b, gImage_2in13c_y);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Draw black image\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 70, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 80, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 50, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(50, 70, 20, 100, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(60, 70, 90, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(125, 85, 15, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawString_CN(5, 15, "ÄãºÃabc", &Font12CN, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
printf("Draw red image\r\n");
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(5, 90, RED, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 100, RED, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(125, 70, 125, 100, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(110, 85, 140, 85, RED, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawRectangle(20, 70, 50, 100, RED, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(165, 85, 15, RED, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(5, 0, "waveshare Electronics", &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 50, 987654321, &Font16, WHITE, RED);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN13B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9b_V2_test.c
Normal file
119
STM32/STM32-F103ZET6/User/Examples/EPD_2in9b_V2_test.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9bc_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-12
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2IN9B_V2.h"
|
||||
|
||||
int EPD_2in9b_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN9B_V2_test Demo\r\n");
|
||||
DEV_Module_Init();
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9B_V2_Init();
|
||||
EPD_2IN9B_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage; // Red or Yellow
|
||||
UWORD Imagesize = ((EPD_2IN9B_V2_WIDTH % 8 == 0)? (EPD_2IN9B_V2_WIDTH / 8 ): (EPD_2IN9B_V2_WIDTH / 8 + 1)) * EPD_2IN9B_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage and RYImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9B_V2_WIDTH, EPD_2IN9B_V2_HEIGHT, 270, WHITE);
|
||||
Paint_NewImage(RYImage, EPD_2IN9B_V2_WIDTH, EPD_2IN9B_V2_HEIGHT, 270, WHITE);
|
||||
|
||||
//Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
EPD_2IN9B_V2_Display(gImage_2in9bc_b, gImage_2in9bc_ry);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_2IN9B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9B_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9B_V2_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
117
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_HD_test.c
Normal file
117
STM32/STM32-F103ZET6/User/Examples/EPD_7in5_HD_test.c
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 7.5inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5_HD.h"
|
||||
|
||||
int EPD_7in5_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5_HD_Init();
|
||||
EPD_7IN5_HD_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_7IN5_HD_WIDTH % 8 == 0)? (EPD_7IN5_HD_WIDTH / 8 ): (EPD_7IN5_HD_WIDTH / 8 + 1)) * EPD_7IN5_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5_HD_WIDTH, EPD_7IN5_HD_HEIGHT/2, 0, WHITE);
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
//Paint_DrawBitMap(gImage_7in5_V2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
//The entire image size is EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8
|
||||
//Since the memory problem is transmitted halfway, now the other half is transmitted, so the offset address is required.
|
||||
//Paint_DrawBitMap(gImage_7in5_V2 + EPD_7IN5_HD_WIDTH*EPD_7IN5_HD_HEIGHT/8/2);
|
||||
//EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
|
||||
EPD_7IN5_HD_DisplayImage(gImage_7in5_V2,0,0,800,480);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5_HD_WritePicture(BlackImage, 1);
|
||||
printf("EPD_Display\r\n");
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5_HD_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
118
STM32/STM32-F103ZET6/User/Examples/EPD_7in5b_HD_test.c
Normal file
118
STM32/STM32-F103ZET6/User/Examples/EPD_7in5b_HD_test.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5bc_HD_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.83inch B&C e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2019-06-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_7in5b_HD.h"
|
||||
#include "ImageData.h"
|
||||
|
||||
int EPD_7in5b_HD_test(void)
|
||||
{
|
||||
printf("EPD_7IN5B_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_7IN5B_HD_Init();
|
||||
EPD_7IN5B_HD_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
// EPD_7IN5B_HD_ClearRed();
|
||||
// DEV_Delay_ms(3000);
|
||||
// EPD_7IN5B_HD_ClearBlack();
|
||||
// DEV_Delay_ms(3000);
|
||||
//Create a new image cache named IMAGE_BW and fill it with white
|
||||
UBYTE *BlackImage, *RYImage;
|
||||
UWORD Imagesize = ((EPD_7IN5B_HD_WIDTH % 8 == 0)? (EPD_7IN5B_HD_WIDTH / 8 ): (EPD_7IN5B_HD_WIDTH / 8 + 1)) * EPD_7IN5B_HD_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize/2)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("NewImage:BlackImage \r\n");
|
||||
Paint_NewImage(BlackImage, EPD_7IN5B_HD_WIDTH, EPD_7IN5B_HD_HEIGHT/2 , 0, WHITE);
|
||||
|
||||
//Select Image
|
||||
// Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
#if 1
|
||||
EPD_7IN5B_HD_DisplayImage(gImage_7in5_V2_b,gImage_7in5_V2_ry,16,10,800,480);
|
||||
DEV_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
/*Horizontal screen*/
|
||||
//1.Draw black image
|
||||
printf("Drawing on the image \r\n");
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,0);
|
||||
Paint_Clear(WHITE);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,1);
|
||||
//2.Draw red image
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,2);
|
||||
Paint_Clear(WHITE);
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_7IN5B_HD_DisplayPicture(BlackImage,3);
|
||||
DEV_Delay_ms(5000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_7IN5B_HD_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_7IN5B_HD_Sleep();
|
||||
free(BlackImage);
|
||||
free(RYImage);
|
||||
BlackImage = NULL;
|
||||
RYImage = NULL;
|
||||
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ int EPD_1in02d_test(void);
|
|||
int EPD_1in54_test(void);
|
||||
int EPD_1in54_V2_test(void);
|
||||
int EPD_1in54b_test(void);
|
||||
int EPD_1in54b_V2_test(void);
|
||||
int EPD_1in54c_test(void);
|
||||
|
||||
int EPD_2in7_test(void);
|
||||
|
|
@ -48,11 +49,13 @@ int EPD_2in7b_test(void);
|
|||
|
||||
int EPD_2in9_test(void);
|
||||
int EPD_2in9bc_test(void);
|
||||
int EPD_2in9b_V2_test(void);
|
||||
int EPD_2in9d_test(void);
|
||||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13b_V2_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
|
|
@ -65,4 +68,7 @@ int EPD_7in5_test(void);
|
|||
int EPD_7in5_V2_test(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
int EPD_7in5b_V2_test(void);
|
||||
|
||||
int EPD_7in5_HD_test(void);
|
||||
int EPD_7in5b_HD_test(void);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -838,3 +838,4 @@ void Paint_DrawBitMap_Block(const unsigned char* image_buffer, UBYTE Region)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
194
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b_V2.c
Normal file
194
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b_V2.c
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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_1in54b_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
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_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54B_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_1IN54B_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_1IN54B_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1) {
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN) == 0)
|
||||
break;
|
||||
}
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Init(void)
|
||||
{
|
||||
EPD_1IN54B_V2_Reset();
|
||||
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
EPD_1IN54B_V2_SendCommand(0x12); //SWRESET
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x01); //Driver output control
|
||||
EPD_1IN54B_V2_SendData(0xC7);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x18); //0x18-->(24+1)*8=200
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
EPD_1IN54B_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54B_V2_SendData(0x05);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_1IN54B_V2_SendData(0x80);
|
||||
|
||||
EPD_1IN54B_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
EPD_1IN54B_V2_SendData(0xC7);
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Clear(void)
|
||||
{
|
||||
|
||||
unsigned int i;
|
||||
EPD_1IN54B_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<5000;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(0xff);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<5000;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(0x00);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_1IN54B_V2_SendData(0xF7);
|
||||
EPD_1IN54B_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Display(const UBYTE *blackimage, const UBYTE *redimage)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54B_V2_WIDTH % 8 == 0)? (EPD_1IN54B_V2_WIDTH / 8 ): (EPD_1IN54B_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54B_V2_HEIGHT;
|
||||
|
||||
unsigned int i;
|
||||
EPD_1IN54B_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<Width * Height;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(blackimage[i]);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<Width * Height;i++)
|
||||
{
|
||||
EPD_1IN54B_V2_SendData(~redimage[i]);
|
||||
}
|
||||
EPD_1IN54B_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_1IN54B_V2_SendData(0xF7);
|
||||
EPD_1IN54B_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_1IN54B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54B_V2_Sleep(void)
|
||||
{
|
||||
EPD_1IN54B_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_1IN54B_V2_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b_V2.h
Normal file
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54b_V2.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54b_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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_1IN54B_V2_H_
|
||||
#define __EPD_1IN54B_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54B_V2_WIDTH 200
|
||||
#define EPD_1IN54B_V2_HEIGHT 200
|
||||
|
||||
void EPD_1IN54B_V2_Init(void);
|
||||
void EPD_1IN54B_V2_Clear(void);
|
||||
void EPD_1IN54B_V2_Display(const UBYTE *blackimage, const UBYTE *redimage);
|
||||
void EPD_1IN54B_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -354,6 +354,10 @@ parameter:
|
|||
******************************************************************************/
|
||||
void EPD_2IN13_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN13_V2_SendCommand(0x22); //POWER OFF
|
||||
EPD_2IN13_V2_SendData(0xC3);
|
||||
EPD_2IN13_V2_SendCommand(0x20);
|
||||
|
||||
EPD_2IN13_V2_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2IN13_V2_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
|
|
|
|||
197
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13b_V2.c
Normal file
197
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13b_V2.c
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13b_V2.h"
|
||||
#include "Debug.h"
|
||||
//元太屏
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(1000);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13B_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_2IN13B_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_2IN13B_V2_ReadBusy(void)
|
||||
{
|
||||
UBYTE busy;
|
||||
Debug("e-Paper busy\r\n");
|
||||
do{
|
||||
EPD_2IN13B_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_2IN13B_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13B_V2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(100);
|
||||
EPD_2IN13B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V2_Init(void)
|
||||
{
|
||||
EPD_2IN13B_V2_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_V2_SendCommand(0x00);//panel setting
|
||||
EPD_2IN13B_V2_SendData(0x0f);//LUT from OTP,128x296
|
||||
EPD_2IN13B_V2_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_V2_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN13B_V2_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
|
||||
//WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V2_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;
|
||||
|
||||
//send black data
|
||||
EPD_2IN13B_V2_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_2IN13B_V2_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN13B_V2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_2IN13B_V2_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)
|
||||
{
|
||||
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;
|
||||
|
||||
EPD_2IN13B_V2_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_V2_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_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13B_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN13B_V2_SendCommand(0X50);
|
||||
EPD_2IN13B_V2_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);
|
||||
}
|
||||
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13b_V2.h
Normal file
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in13b_V2.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13b_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2IN13B_V2_H_
|
||||
#define __EPD_2IN13B_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13B_V2_WIDTH 104
|
||||
#define EPD_2IN13B_V2_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);
|
||||
|
||||
#endif
|
||||
188
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9b_V2.c
Normal file
188
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9b_V2.c
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9b_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in9b_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
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_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9B_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_2IN9B_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_2IN9B_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
UBYTE busy;
|
||||
do
|
||||
{
|
||||
EPD_2IN9B_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 : Initialize the e-Paper register
|
||||
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
|
||||
|
||||
EPD_2IN9B_V2_SendCommand(0x00);//panel setting
|
||||
EPD_2IN9B_V2_SendData(0x0f);//LUT from OTP,128x296
|
||||
EPD_2IN9B_V2_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_V2_SendCommand(0X50);//VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN9B_V2_SendData(0x77);//WBmode:VBDF 17|D7 VBDW 97 VBDB 57
|
||||
//WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9B_V2_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;
|
||||
|
||||
//send black data
|
||||
EPD_2IN9B_V2_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9B_V2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//send red data
|
||||
EPD_2IN9B_V2_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN9B_V2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN9B_V2_SendCommand(0x12);
|
||||
EPD_2IN9B_V2_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)
|
||||
{
|
||||
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;
|
||||
|
||||
EPD_2IN9B_V2_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_V2_SendCommand(0x92);
|
||||
|
||||
EPD_2IN9B_V2_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_V2_SendCommand(0x92);
|
||||
|
||||
EPD_2IN9B_V2_SendCommand(0x12);
|
||||
EPD_2IN9B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9B_V2_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
|
||||
}
|
||||
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9b_V2.h
Normal file
45
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9b_V2.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9b V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch e-paper b V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-12
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2IN9B_V2_H_
|
||||
#define __EPD_2IN9B_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN9B_V2_WIDTH 128
|
||||
#define EPD_2IN9B_V2_HEIGHT 296
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
|
@ -159,104 +159,108 @@ static const unsigned char EPD_4IN2_lut_bb[] = {
|
|||
};
|
||||
|
||||
/******************************partial screen update LUT*********************************/
|
||||
const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={
|
||||
0x00 ,0x19 ,0x01 ,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, };
|
||||
const unsigned char EPD_4IN2_Partial_lut_vcom1[] = {
|
||||
0x00 ,0x19 ,0x01 ,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,
|
||||
};
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_ww1[] ={
|
||||
0x00 ,0x19 ,0x01 ,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,};
|
||||
const unsigned char EPD_4IN2_Partial_lut_ww1[] = {
|
||||
0x00 ,0x19 ,0x01 ,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,
|
||||
};
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_bw1[] ={
|
||||
0x80 ,0x19 ,0x01 ,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, };
|
||||
const unsigned char EPD_4IN2_Partial_lut_bw1[] = {
|
||||
0x80 ,0x19 ,0x01 ,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,
|
||||
};
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_wb1[] ={
|
||||
0x40 ,0x19 ,0x01 ,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, };
|
||||
const unsigned char EPD_4IN2_Partial_lut_wb1[] = {
|
||||
0x40 ,0x19 ,0x01 ,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,
|
||||
};
|
||||
|
||||
const unsigned char EPD_4IN2_Partial_lut_bb1[] ={
|
||||
0x00 ,0x19 ,0x01 ,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, };
|
||||
const unsigned char EPD_4IN2_Partial_lut_bb1[] = {
|
||||
0x00 ,0x19 ,0x01 ,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,
|
||||
};
|
||||
|
||||
/******************************gray*********************************/
|
||||
//0~3 gray
|
||||
const unsigned char EPD_4IN2_4Gray_lut_vcom[] =
|
||||
{
|
||||
0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
|
||||
|
||||
const unsigned char EPD_4IN2_4Gray_lut_vcom[] = {
|
||||
0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
|
||||
|
||||
};
|
||||
//R21
|
||||
const unsigned char EPD_4IN2_4Gray_lut_ww[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
const unsigned char EPD_4IN2_4Gray_lut_ww[] = {
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R22H r
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bw[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bw[] = {
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R23H w
|
||||
const unsigned char EPD_4IN2_4Gray_lut_wb[] ={
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
const unsigned char EPD_4IN2_4Gray_lut_wb[] = {
|
||||
0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
//R24H b
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bb[] ={
|
||||
0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
const unsigned char EPD_4IN2_4Gray_lut_bb[] = {
|
||||
0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
|
||||
0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
|
||||
0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
|
||||
0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -307,9 +311,9 @@ parameter:
|
|||
void EPD_4IN2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
EPD_4IN2_SendCommand(0x71);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
|
|
@ -361,57 +365,68 @@ static void EPD_4IN2_SetLut(void)
|
|||
|
||||
static void EPD_4IN2_Partial_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_4IN2_SendCommand(0x20);
|
||||
for(count=0;count<44;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]);}
|
||||
unsigned int count;
|
||||
EPD_4IN2_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x21);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x22);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]);}
|
||||
EPD_4IN2_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x23);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]);}
|
||||
EPD_4IN2_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24);
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);}
|
||||
EPD_4IN2_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);
|
||||
}
|
||||
}
|
||||
|
||||
//LUT download
|
||||
static void EPD_4IN2_4Gray_lut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x20); //vcom
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]);}
|
||||
|
||||
EPD_4IN2_SendCommand(0x21); //red not use
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
|
||||
unsigned int count;
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x20); //vcom
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x22); //bw r
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]);}
|
||||
EPD_4IN2_SendCommand(0x21); //red not use
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x23); //wb w
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]);}
|
||||
EPD_4IN2_SendCommand(0x22); //bw r
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x24); //bb b
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]);}
|
||||
EPD_4IN2_SendCommand(0x23); //wb w
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x25); //vcom
|
||||
for(count=0;count<42;count++)
|
||||
{EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);}
|
||||
}
|
||||
EPD_4IN2_SendCommand(0x24); //bb b
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]);
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x25); //vcom
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
|
|
@ -459,39 +474,39 @@ void EPD_4IN2_Init(void)
|
|||
|
||||
void EPD_4IN2_Init_4Gray(void)
|
||||
{
|
||||
EPD_4IN2_Reset();
|
||||
EPD_4IN2_SendCommand(0x01); //POWER SETTING
|
||||
EPD_4IN2_SendData (0x03);
|
||||
EPD_4IN2_SendData (0x00); //VGH=20V,VGL=-20V
|
||||
EPD_4IN2_SendData (0x2b); //VDH=15V
|
||||
EPD_4IN2_SendData (0x2b); //VDL=-15V
|
||||
EPD_4IN2_SendData (0x13);
|
||||
EPD_4IN2_Reset();
|
||||
EPD_4IN2_SendCommand(0x01); //POWER SETTING
|
||||
EPD_4IN2_SendData (0x03);
|
||||
EPD_4IN2_SendData (0x00); //VGH=20V,VGL=-20V
|
||||
EPD_4IN2_SendData (0x2b); //VDH=15V
|
||||
EPD_4IN2_SendData (0x2b); //VDL=-15V
|
||||
EPD_4IN2_SendData (0x13);
|
||||
|
||||
EPD_4IN2_SendCommand(0x06); //booster soft start
|
||||
EPD_4IN2_SendData (0x17); //A
|
||||
EPD_4IN2_SendData (0x17); //B
|
||||
EPD_4IN2_SendData (0x17); //C
|
||||
EPD_4IN2_SendCommand(0x06); //booster soft start
|
||||
EPD_4IN2_SendData (0x17); //A
|
||||
EPD_4IN2_SendData (0x17); //B
|
||||
EPD_4IN2_SendData (0x17); //C
|
||||
|
||||
EPD_4IN2_SendCommand(0x04);
|
||||
EPD_4IN2_ReadBusy();
|
||||
EPD_4IN2_SendCommand(0x04);
|
||||
EPD_4IN2_ReadBusy();
|
||||
|
||||
EPD_4IN2_SendCommand(0x00); //panel setting
|
||||
EPD_4IN2_SendData(0x3f); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
EPD_4IN2_SendCommand(0x00); //panel setting
|
||||
EPD_4IN2_SendData(0x3f); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
EPD_4IN2_SendCommand(0x30); //PLL setting
|
||||
EPD_4IN2_SendData (0x3c); //100hz
|
||||
EPD_4IN2_SendCommand(0x30); //PLL setting
|
||||
EPD_4IN2_SendData (0x3c); //100hz
|
||||
|
||||
EPD_4IN2_SendCommand(0x61); //resolution setting
|
||||
EPD_4IN2_SendData (0x01); //400
|
||||
EPD_4IN2_SendData (0x90);
|
||||
EPD_4IN2_SendData (0x01); //300
|
||||
EPD_4IN2_SendData (0x2c);
|
||||
EPD_4IN2_SendCommand(0x61); //resolution setting
|
||||
EPD_4IN2_SendData (0x01); //400
|
||||
EPD_4IN2_SendData (0x90);
|
||||
EPD_4IN2_SendData (0x01); //300
|
||||
EPD_4IN2_SendData (0x2c);
|
||||
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x12);
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x12);
|
||||
|
||||
EPD_4IN2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_4IN2_SendData(0x97);
|
||||
EPD_4IN2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_4IN2_SendData(0x97);
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
|
|
@ -516,8 +531,8 @@ void EPD_4IN2_Clear(void)
|
|||
EPD_4IN2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10);
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10);
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
|
@ -537,91 +552,88 @@ void EPD_4IN2_Display(UBYTE *Image)
|
|||
EPD_4IN2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
UWORD Width, Height;
|
||||
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);
|
||||
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0xf7);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x08);
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0x47);
|
||||
EPD_4IN2_Partial_SetLut();
|
||||
EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_4IN2_SendCommand(0x90); //resolution setting
|
||||
EPD_4IN2_SendData ((X_start)/256);
|
||||
EPD_4IN2_SendData ((X_start)%256); //x-start
|
||||
|
||||
EPD_4IN2_SendData ((X_end )/256);
|
||||
EPD_4IN2_SendData ((X_end )%256-1); //x-end
|
||||
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);
|
||||
|
||||
EPD_4IN2_SendData (Y_start/256);
|
||||
EPD_4IN2_SendData (Y_start%256); //y-start
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0xf7);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_4IN2_SendData (Y_end/256);
|
||||
EPD_4IN2_SendData (Y_end%256-1); //y-end
|
||||
EPD_4IN2_SendData (0x28);
|
||||
EPD_4IN2_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_4IN2_SendData (0x08);
|
||||
EPD_4IN2_SendCommand(0X50);
|
||||
EPD_4IN2_SendData(0x47);
|
||||
EPD_4IN2_Partial_SetLut();
|
||||
EPD_4IN2_SendCommand(0x91); //This command makes the display enter partial mode
|
||||
EPD_4IN2_SendCommand(0x90); //resolution setting
|
||||
EPD_4IN2_SendData ((X_start)/256);
|
||||
EPD_4IN2_SendData ((X_start)%256); //x-start
|
||||
|
||||
EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming
|
||||
EPD_4IN2_SendData ((X_end )/256);
|
||||
EPD_4IN2_SendData ((X_end )%256-1); //x-end
|
||||
|
||||
EPD_4IN2_SendData (Y_start/256);
|
||||
EPD_4IN2_SendData (Y_start%256); //y-start
|
||||
|
||||
EPD_4IN2_SendData (Y_end/256);
|
||||
EPD_4IN2_SendData (Y_end%256-1); //y-end
|
||||
EPD_4IN2_SendData (0x28);
|
||||
|
||||
EPD_4IN2_SendCommand(0x10); //writes Old data to SRAM for programming
|
||||
for (UWORD j = 0; j < Y_end - Y_start; j++) {
|
||||
for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
|
||||
EPD_4IN2_SendData(Image[(Y_start + j)*Width + X_start/8 + i]);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_SendCommand(0x13); //writes New data to SRAM.
|
||||
EPD_4IN2_SendCommand(0x13); //writes New data to SRAM.
|
||||
for (UWORD j = 0; j < Y_end - Y_start; j++) {
|
||||
for (UWORD i = 0; i < (X_end - X_start)/8; i++) {
|
||||
EPD_4IN2_SendData(~Image[(Y_start + j)*Width + X_start/8 + i]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10); //The delay here is necessary, 200uS at least!!!
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
EPD_4IN2_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(10); //The delay here is necessary, 200uS at least!!!
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
|
||||
{
|
||||
UDOUBLE i,j,k;
|
||||
UBYTE temp1,temp2,temp3;
|
||||
/****Color display description****
|
||||
white gray1 gray2 black
|
||||
0x10| 01 01 00 00
|
||||
0x13| 01 00 01 00
|
||||
*********************************/
|
||||
EPD_4IN2_SendCommand(0x10);
|
||||
/****Color display description****
|
||||
white gray1 gray2 black
|
||||
0x10| 01 01 00 00
|
||||
0x13| 01 00 01 00
|
||||
*********************************/
|
||||
EPD_4IN2_SendCommand(0x10);
|
||||
|
||||
for(i=0;i<15000;i++) //5808*4 46464
|
||||
{
|
||||
for(i=0; i<15000; i++) { //5808*4 46464
|
||||
temp3=0;
|
||||
for(j=0;j<2;j++)
|
||||
{
|
||||
for(j=0; j<2; j++) {
|
||||
temp1 = Image[i*2+j];
|
||||
for(k=0;k<2;k++)
|
||||
{
|
||||
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)
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x01; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x00; //gray2
|
||||
temp3 <<= 1;
|
||||
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0) //white
|
||||
|
|
@ -631,37 +643,34 @@ void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
|
|||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x01; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x00; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 |= 0x00; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 <<= 1;
|
||||
|
||||
|
||||
temp1 <<= 2;
|
||||
}
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
}
|
||||
// new data
|
||||
EPD_4IN2_SendCommand(0x13);
|
||||
for(i=0;i<15000;i++) //5808*4 46464
|
||||
{
|
||||
EPD_4IN2_SendCommand(0x13);
|
||||
for(i=0; i<15000; i++) { //5808*4 46464
|
||||
temp3=0;
|
||||
for(j=0;j<2;j++)
|
||||
{
|
||||
for(j=0; j<2; j++) {
|
||||
temp1 = Image[i*2+j];
|
||||
for(k=0;k<2;k++)
|
||||
{
|
||||
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)
|
||||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x00; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x01; //gray2
|
||||
temp3 <<= 1;
|
||||
|
||||
temp3 <<= 1;
|
||||
|
||||
temp1 <<= 2;
|
||||
temp2 = temp1&0xC0 ;
|
||||
if(temp2 == 0xC0) //white
|
||||
|
|
@ -671,17 +680,17 @@ void EPD_4IN2_4GrayDisplay(const UBYTE *Image)
|
|||
else if(temp2 == 0x80)
|
||||
temp3 |= 0x00; //gray1
|
||||
else //0x40
|
||||
temp3 |= 0x01; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 |= 0x01; //gray2
|
||||
if(j!=1 || k!=1)
|
||||
temp3 <<= 1;
|
||||
|
||||
|
||||
temp1 <<= 2;
|
||||
}
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
|
||||
}
|
||||
EPD_4IN2_SendData(temp3);
|
||||
}
|
||||
|
||||
|
||||
EPD_4IN2_4Gray_lut();
|
||||
EPD_4IN2_TurnOnDisplay();
|
||||
}
|
||||
|
|
|
|||
293
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5_HD.c
Normal file
293
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5_HD.c
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_HD.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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_7in5_HD.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_HD_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_7IN5_HD_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_7IN5_HD_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_7IN5_HD_WaitUntilIdle(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
do{
|
||||
DEV_Delay_ms(10);
|
||||
}while(DEV_Digital_Read(EPD_BUSY_PIN) == 1);
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_HD_Init(void)
|
||||
{
|
||||
EPD_7IN5_HD_Reset();
|
||||
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
EPD_7IN5_HD_SendCommand(0x12); //SWRESET
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x46); // Auto Write Red RAM
|
||||
EPD_7IN5_HD_SendData(0xf7);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
EPD_7IN5_HD_SendCommand(0x47); // Auto Write B/W RAM
|
||||
EPD_7IN5_HD_SendData(0xf7);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x0C); // Soft start setting
|
||||
EPD_7IN5_HD_SendData(0xAE);
|
||||
EPD_7IN5_HD_SendData(0xC7);
|
||||
EPD_7IN5_HD_SendData(0xC3);
|
||||
EPD_7IN5_HD_SendData(0xC0);
|
||||
EPD_7IN5_HD_SendData(0x40);
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x01); // Set MUX as 527
|
||||
EPD_7IN5_HD_SendData(0xAF);
|
||||
EPD_7IN5_HD_SendData(0x02);
|
||||
EPD_7IN5_HD_SendData(0x01);//0x01
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x11); // Data entry mode
|
||||
EPD_7IN5_HD_SendData(0x01);
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x44);
|
||||
EPD_7IN5_HD_SendData(0x00); // RAM x address start at 0
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x6F);
|
||||
EPD_7IN5_HD_SendData(0x03);
|
||||
EPD_7IN5_HD_SendCommand(0x45);
|
||||
EPD_7IN5_HD_SendData(0xAF);
|
||||
EPD_7IN5_HD_SendData(0x02);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x3C); // VBD
|
||||
EPD_7IN5_HD_SendData(0x05); // LUT1, for white
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x18);
|
||||
EPD_7IN5_HD_SendData(0X80);
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x22);
|
||||
EPD_7IN5_HD_SendData(0XB1); //Load Temperature and waveform setting.
|
||||
EPD_7IN5_HD_SendCommand(0x20);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendCommand(0x4F);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
// return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_HD_Clear(void)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5_HD_WIDTH % 8 == 0)?(EPD_7IN5_HD_WIDTH / 8 ):(EPD_7IN5_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HD_HEIGHT;
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x4F);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendCommand(0x24);
|
||||
UDOUBLE i;
|
||||
for(i=0; i<58080; i++) {
|
||||
EPD_7IN5_HD_SendData(0xff);
|
||||
}
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x26);
|
||||
for(i=0; i<Height*Width; i++){
|
||||
EPD_7IN5_HD_SendData(0xff);
|
||||
}
|
||||
EPD_7IN5_HD_SendCommand(0x22);
|
||||
EPD_7IN5_HD_SendData(0xF7);//Load LUT from MCU(0x32)
|
||||
EPD_7IN5_HD_SendCommand(0x20);
|
||||
DEV_Delay_ms(10);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_HD_Display(const UBYTE *blackimage)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5_HD_WIDTH % 8 == 0)?(EPD_7IN5_HD_WIDTH / 8 ):(EPD_7IN5_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HD_HEIGHT;
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x4F);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendCommand(0x24);
|
||||
|
||||
UDOUBLE i;
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5_HD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x26);
|
||||
for(i=0; i<Height*Width; i++) {
|
||||
EPD_7IN5_HD_SendData(0xff);
|
||||
}
|
||||
EPD_7IN5_HD_SendCommand(0x22);
|
||||
EPD_7IN5_HD_SendData(0xF7);//Load LUT from MCU(0x32)
|
||||
EPD_7IN5_HD_SendCommand(0x20);
|
||||
DEV_Delay_ms(10);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
}
|
||||
void EPD_7IN5_HD_WritePicture(const UBYTE *blackimage, UBYTE Block)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5_HD_WIDTH % 8 == 0)?(EPD_7IN5_HD_WIDTH / 8 ):(EPD_7IN5_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HD_HEIGHT;
|
||||
if(Block == 0){
|
||||
EPD_7IN5_HD_SendCommand(0x4F);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}else if(Block == 1){
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5_HD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_7IN5_HD_SendCommand(0x22);
|
||||
EPD_7IN5_HD_SendData(0xF7);//Load LUT from MCU(0x32)
|
||||
EPD_7IN5_HD_SendCommand(0x20);
|
||||
DEV_Delay_ms(10);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter: image_width and start_X :Must be a multiple of 8
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_HD_DisplayImage(const UBYTE *blackimage,UDOUBLE start_X, UDOUBLE start_Y, UDOUBLE image_width, UDOUBLE image_high)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5_HD_WIDTH % 8 == 0)?(EPD_7IN5_HD_WIDTH / 8 ):(EPD_7IN5_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_HD_HEIGHT;
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x4F);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
EPD_7IN5_HD_SendData(0x00);
|
||||
//send black data
|
||||
|
||||
|
||||
EPD_7IN5_HD_SendCommand(0x24);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
if((i>=start_X/8) && (i<(start_X+image_width)/8) && (j>=start_Y) && (j<(start_Y+image_high))){
|
||||
EPD_7IN5_HD_SendData(~blackimage[i-start_X/8 + (j - start_Y) * image_width/8]);
|
||||
}else{
|
||||
EPD_7IN5_HD_SendData(0xff);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
EPD_7IN5_HD_SendCommand(0x22);
|
||||
EPD_7IN5_HD_SendData(0xF7);//Load LUT from MCU(0x32)
|
||||
EPD_7IN5_HD_SendCommand(0x20);
|
||||
DEV_Delay_ms(10);
|
||||
EPD_7IN5_HD_WaitUntilIdle();
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5_HD_Sleep(void)
|
||||
{
|
||||
EPD_7IN5_HD_SendCommand(0x10);
|
||||
EPD_7IN5_HD_SendData(0x01);
|
||||
}
|
||||
48
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5_HD.h
Normal file
48
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5_HD.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_HD.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-04-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.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef _EPD_7IN5_HD_H_
|
||||
#define _EPD_7IN5_HD_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
|
||||
// Display resolution
|
||||
#define EPD_7IN5_HD_WIDTH 880
|
||||
#define EPD_7IN5_HD_HEIGHT 528
|
||||
|
||||
void EPD_7IN5_HD_Init(void);
|
||||
void EPD_7IN5_HD_Clear(void);
|
||||
void EPD_7IN5_HD_ClearBlack(void);
|
||||
void EPD_7IN5_HD_Display(const UBYTE *blackimage);
|
||||
void EPD_7IN5_HD_Sleep(void);
|
||||
void EPD_7IN5_HD_WritePicture(const UBYTE *blackimage, UBYTE Block);
|
||||
void EPD_7IN5_HD_DisplayImage(const UBYTE *blackimage,UDOUBLE start_X, UDOUBLE start_Y, UDOUBLE image_width, UDOUBLE image_high);
|
||||
#endif
|
||||
363
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5b_HD.c
Normal file
363
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5b_HD.c
Normal file
|
|
@ -0,0 +1,363 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7IN5B_HD_7in5.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: HD.0
|
||||
* | Date : 2018-11-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_7in5b_HD.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
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_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5B_HD_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_7IN5B_HD_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_7IN5B_HD_WaitUntilIdle(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN)){
|
||||
//DEV_Delay_ms(10);
|
||||
}
|
||||
DEV_Delay_ms(200);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5B_HD_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_7IN5B_HD_SendCommand(0x22);
|
||||
EPD_7IN5B_HD_SendData(0xC7); //Load LUT from MCU(0x32)
|
||||
EPD_7IN5B_HD_SendCommand(0x20);
|
||||
DEV_Delay_ms(200); //!!!The delay here is necessary, 200uS at least!!!
|
||||
EPD_7IN5B_HD_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
UBYTE EPD_7IN5B_HD_Init(void)
|
||||
{
|
||||
EPD_7IN5B_HD_Reset();
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x12); //SWRESET
|
||||
EPD_7IN5B_HD_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x46); // Auto Write RAM
|
||||
EPD_7IN5B_HD_SendData(0xF7);
|
||||
EPD_7IN5B_HD_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x47); // Auto Write RAM
|
||||
EPD_7IN5B_HD_SendData(0xF7);
|
||||
EPD_7IN5B_HD_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x0C); // Soft start setting
|
||||
EPD_7IN5B_HD_SendData(0xAE);
|
||||
EPD_7IN5B_HD_SendData(0xC7);
|
||||
EPD_7IN5B_HD_SendData(0xC3);
|
||||
EPD_7IN5B_HD_SendData(0xC0);
|
||||
EPD_7IN5B_HD_SendData(0x40);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x01); // Set MUX as 527
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
EPD_7IN5B_HD_SendData(0x01);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x11); // Data entry mode
|
||||
EPD_7IN5B_HD_SendData(0x01);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x44);
|
||||
EPD_7IN5B_HD_SendData(0x00); // RAM x address start at 0
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
EPD_7IN5B_HD_SendData(0x6F); // RAM x address end at 36Fh -> 879
|
||||
EPD_7IN5B_HD_SendData(0x03);
|
||||
EPD_7IN5B_HD_SendCommand(0x45);
|
||||
EPD_7IN5B_HD_SendData(0xAF); // RAM y address start at 20Fh;
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
EPD_7IN5B_HD_SendData(0x00); // RAM y address end at 00h;
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x3C); // VBD
|
||||
EPD_7IN5B_HD_SendData(0x01); // LUT1, for white
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x18);
|
||||
EPD_7IN5B_HD_SendData(0X80);
|
||||
EPD_7IN5B_HD_SendCommand(0x22);
|
||||
EPD_7IN5B_HD_SendData(0XB1); //Load Temperature and waveform setting.
|
||||
EPD_7IN5B_HD_SendCommand(0x20);
|
||||
EPD_7IN5B_HD_WaitUntilIdle(); //waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x4E);
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5B_HD_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAf);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
UWORD i;
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0xff);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_7IN5B_HD_ClearRed(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
|
||||
UWORD i;
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0xff);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0xff);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_7IN5B_HD_ClearBlack(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
|
||||
UWORD i;
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5B_HD_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
//send black data
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//send red data
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(~ryimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
void EPD_7IN5B_HD_DisplayPicture(const UBYTE *blackimage,UBYTE Block)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
|
||||
if(Block == 0){
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
}else if(Block == 1){
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
}else if(Block == 2){
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(~blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
}else if(Block == 3){
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_7IN5B_HD_SendData(~blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
}
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter: image_width and start_X :Must be a multiple of 8
|
||||
******************************************************************************/
|
||||
void EPD_7IN5B_HD_DisplayImage(const UBYTE *blackimage, const UBYTE *ryimage,UDOUBLE start_X, UDOUBLE start_Y, UDOUBLE image_width, UDOUBLE image_high)
|
||||
{
|
||||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5B_HD_WIDTH % 8 == 0)?(EPD_7IN5B_HD_WIDTH / 8 ):(EPD_7IN5B_HD_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5B_HD_HEIGHT;
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x4F);
|
||||
EPD_7IN5B_HD_SendData(0xAF);
|
||||
EPD_7IN5B_HD_SendData(0x02);
|
||||
//send black data
|
||||
|
||||
|
||||
EPD_7IN5B_HD_SendCommand(0x24);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
if((i>=start_X/8) && (i<(start_X+image_width)/8) && (j>=start_Y) && (j<(start_Y+image_high))){
|
||||
EPD_7IN5B_HD_SendData(blackimage[i-start_X/8 + (j - start_Y) * image_width/8]);
|
||||
}else{
|
||||
EPD_7IN5B_HD_SendData(0xff);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//send red data
|
||||
EPD_7IN5B_HD_SendCommand(0x26);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
if((i>=start_X/8) && (i<(start_X+image_width)/8) && (j>=start_Y) && (j<(start_Y+image_high))){
|
||||
EPD_7IN5B_HD_SendData(~ryimage[i-start_X/8 + (j - start_Y) * image_width/8]);
|
||||
}else{
|
||||
EPD_7IN5B_HD_SendData(0x00);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
EPD_7IN5B_HD_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_7IN5B_HD_Sleep(void)
|
||||
{
|
||||
EPD_7IN5B_HD_SendCommand(0x10); //deep sleep
|
||||
EPD_7IN5B_HD_SendData(0x01);
|
||||
}
|
||||
51
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5b_HD.h
Normal file
51
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5b_HD.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_7in5_HD.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Electronic paper driver
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: EPD_7in5_HD.0
|
||||
* | Date : 2020-04-27
|
||||
* | Info :
|
||||
* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
|
||||
* 2.Change:EPD_Display(UBYTE *Image)
|
||||
* Need to pass parameters: pointer to cached data
|
||||
#
|
||||
# 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_7IN5B_HD_H_
|
||||
#define _EPD_7IN5B_HD_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
|
||||
// Display resolution
|
||||
#define EPD_7IN5B_HD_WIDTH 880
|
||||
#define EPD_7IN5B_HD_HEIGHT 528
|
||||
|
||||
UBYTE EPD_7IN5B_HD_Init(void);
|
||||
void EPD_7IN5B_HD_Clear(void);
|
||||
void EPD_7IN5B_HD_ClearRed(void);
|
||||
void EPD_7IN5B_HD_ClearBlack(void);
|
||||
void EPD_7IN5B_HD_Display(const UBYTE *blackimage, const UBYTE *ryimage);
|
||||
void EPD_7IN5B_HD_Sleep(void);
|
||||
void EPD_7IN5B_HD_DisplayPicture(const UBYTE *blackimage,UBYTE Block);
|
||||
void EPD_7IN5B_HD_DisplayImage(const UBYTE *blackimage, const UBYTE *ryimage,UDOUBLE start_X, UDOUBLE start_Y, UDOUBLE image_width, UDOUBLE image_high);
|
||||
#endif
|
||||
|
|
@ -136,6 +136,12 @@ 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);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue