update 2.9d&4.2, fix 5.65f&2.66b
|
|
@ -58,7 +58,7 @@ int EPD_2in13_V3_test(void)
|
|||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
|
@ -68,7 +68,7 @@ int EPD_2in13_V3_test(void)
|
|||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13_2.bmp", 0, 0);
|
||||
GUI_ReadBmp("./pic/2in13_1.bmp", 0, 0);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ int EPD_2in9d_test(void)
|
|||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
UBYTE num = 10;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
|
|
@ -141,17 +141,17 @@ int EPD_2in9d_test(void)
|
|||
EPD_2IN9D_DisplayPart(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
|
||||
#endif
|
||||
printf("Clear...\r\n");
|
||||
// EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9D_Init();
|
||||
EPD_2IN9D_Clear();
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9D_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
DEV_Delay_ms(3000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
|
|
|||
161
RaspberryPi_JetsonNano/c/examples/EPD_4in2_V2_test.c
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_V2_V2_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper V2 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-02-23
|
||||
* | 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_4in2_V2.h"
|
||||
#include <string.h>
|
||||
|
||||
int EPD_4in2_V2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN2_V2_Init();
|
||||
EPD_4IN2_V2_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1)) * EPD_4IN2_V2_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN2_V2_WIDTH, EPD_4IN2_V2_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_4IN2_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in2.bmp", 0, 0);
|
||||
EPD_4IN2_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_4in2);
|
||||
EPD_4IN2_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
// EPD_4IN2_V2_Display(BlackImage);
|
||||
EPD_4IN2_V2_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_NewImage(BlackImage, 200, 50, 0, WHITE);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawTime(20, 10, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
EPD_4IN2_V2_PartialDisplay(BlackImage, 80, 200, 200, 50);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
EPD_4IN2_V2_Init();
|
||||
EPD_4IN2_V2_Clear();
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN2_V2_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ int EPD_4in2_test(void)
|
|||
Paint_NewImage(BlackImage, EPD_4IN2_WIDTH, EPD_4IN2_HEIGHT, 0, WHITE);
|
||||
|
||||
|
||||
#if 0 // show bmp
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ int EPD_7in5b_V2_test(void)
|
|||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 0);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 50, 100);
|
||||
Paint_SelectImage(RYImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 200, 0);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 350, 100);
|
||||
EPD_7IN5B_V2_Display(BlackImage, RYImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ int EPD_3in7_test(void);
|
|||
int EPD_4in01f_test(void);
|
||||
|
||||
int EPD_4in2_test(void);
|
||||
int EPD_4in2_V2_test(void);
|
||||
int EPD_4in2bc_test(void);
|
||||
int EPD_4in2b_V2_test(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ int main(void)
|
|||
// EPD_4in01f_test();
|
||||
|
||||
// EPD_4in2_test();
|
||||
// EPD_4in2_V2_test();
|
||||
// EPD_4in2bc_test();
|
||||
// EPD_4in2b_V2_test();
|
||||
|
||||
|
|
@ -81,14 +82,15 @@ int main(void)
|
|||
// EPD_13in3_test();
|
||||
|
||||
|
||||
/* For Test
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
while(1) {
|
||||
DEV_Delay_ms(10000);
|
||||
}
|
||||
DEV_Module_Exit();
|
||||
*/
|
||||
// For Test
|
||||
// if(DEV_Module_Init()!=0){
|
||||
// return -1;
|
||||
// }
|
||||
// while(1) {
|
||||
// EPD_7in5b_V2_test();
|
||||
// DEV_Delay_ms(10000);
|
||||
// }
|
||||
// DEV_Module_Exit();
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,29 @@
|
|||
#include "EPD_1in54_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char WF_PARTIAL_1IN54[159] =
|
||||
{
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x1,
|
||||
0x1,0x1,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x02,0x17,0x41,0xB0,0x32,0x28,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -78,7 +101,7 @@ static void EPD_1IN54_V2_ReadBusy(void)
|
|||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
|
@ -91,7 +114,7 @@ static void EPD_1IN54_V2_TurnOnDisplay(void)
|
|||
{
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xF7);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +130,37 @@ static void EPD_1IN54_V2_TurnOnDisplayPart(void)
|
|||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetLut(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x32);
|
||||
for(UBYTE i=0; i<153; i++)
|
||||
EPD_1IN54_V2_SendData(WF_PARTIAL_1IN54[i]);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_V2_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_1IN54_V2_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_1IN54_V2_SendData(Yend & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_1IN54_V2_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_1IN54_V2_SendData(Ystart & 0xFF);
|
||||
EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
|
|
@ -127,15 +181,16 @@ void EPD_1IN54_V2_Init(void)
|
|||
EPD_1IN54_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x18); //0x0C-->(18+1)*8=200
|
||||
// EPD_1IN54_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x18); //0x0C-->(18+1)*8=200
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
EPD_1IN54_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
// EPD_1IN54_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SetWindows(0, EPD_1IN54_V2_HEIGHT-1, EPD_1IN54_V2_WIDTH-1, 0);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
|
@ -147,12 +202,13 @@ void EPD_1IN54_V2_Init(void)
|
|||
EPD_1IN54_V2_SendData(0XB1);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
EPD_1IN54_V2_SendData(0xC7);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
// EPD_1IN54_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
// EPD_1IN54_V2_SendData(0xC7);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SetCursor(0, EPD_1IN54_V2_HEIGHT-1);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -241,9 +297,23 @@ void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
|
|||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Delay_ms(5);
|
||||
|
||||
EPD_1IN54_V2_SetLut();
|
||||
EPD_1IN54_V2_SendCommand(0x37);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x40);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54_V2_SendData(0x80);
|
||||
|
||||
|
|
@ -257,6 +327,7 @@ void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
|
|||
}
|
||||
EPD_1IN54_V2_TurnOnDisplayPart();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
|
|
|
|||
|
|
@ -82,9 +82,9 @@ void EPD_2in13_V3_ReadBusy(void)
|
|||
{ //=1 BUSY
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
DEV_Delay_ms(50);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
DEV_Delay_ms(10);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void EPD_2IN9_V2_ReadBusy(void)
|
|||
}
|
||||
|
||||
static void EPD_2IN9_V2_LUT(void)
|
||||
{
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2IN9_V2_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* | Function : 2.9inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2019-06-12
|
||||
* | This version: V3.1
|
||||
* | Date : 2021-03-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
|
|
@ -54,57 +54,6 @@
|
|||
#include "EPD_2in9d.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/**
|
||||
* full screen update LUT
|
||||
**/
|
||||
const unsigned char EPD_2IN9D_lut_vcomDC[] = {
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_ww[] = {
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 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_2IN9D_lut_bw[] = {
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const unsigned char EPD_2IN9D_lut_wb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 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_2IN9D_lut_bb[] = {
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* partial screen update LUT
|
||||
**/
|
||||
|
|
@ -163,11 +112,19 @@ parameter:
|
|||
static void EPD_2IN9D_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -209,56 +166,48 @@ void EPD_2IN9D_ReadBusy(void)
|
|||
busy = DEV_Digital_Read(EPD_BUSY_PIN);
|
||||
busy =!(busy & 0x01);
|
||||
} while(busy);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_SetFullReg(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN9D_SendData(0xb7); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN9D_SendCommand(0x20);
|
||||
for(count=0; count<44; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_vcomDC[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x21);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_ww[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x22);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bw[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x23);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_wb[count]);
|
||||
}
|
||||
|
||||
EPD_2IN9D_SendCommand(0x24);
|
||||
for(count=0; count<42; count++) {
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_lut_bb[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : LUT download
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9D_SetPartReg(void)
|
||||
{
|
||||
EPD_2IN9D_SendCommand(0x82); //vcom_DC setting
|
||||
|
||||
EPD_2IN9D_SendCommand(0x01); //POWER SETTING
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x06); //boost soft start
|
||||
EPD_2IN9D_SendData(0x17); //A
|
||||
EPD_2IN9D_SendData(0x17); //B
|
||||
EPD_2IN9D_SendData(0x17); //C
|
||||
|
||||
EPD_2IN9D_SendCommand(0x04);
|
||||
EPD_2IN9D_ReadBusy();
|
||||
|
||||
EPD_2IN9D_SendCommand(0x00); //panel setting
|
||||
EPD_2IN9D_SendData(0xbf); //LUT from OTP,128x296
|
||||
|
||||
EPD_2IN9D_SendCommand(0x30); //PLL setting
|
||||
EPD_2IN9D_SendData(0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN9D_SendCommand(0x61); //resolution setting
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_WIDTH);
|
||||
EPD_2IN9D_SendData((EPD_2IN9D_HEIGHT >> 8) & 0xff);
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_HEIGHT & 0xff);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN9D_SendData(0x12);
|
||||
|
||||
EPD_2IN9D_SendCommand(0X50);
|
||||
EPD_2IN9D_SendData(0xb7);
|
||||
EPD_2IN9D_SendData(0x97);
|
||||
|
||||
unsigned int count;
|
||||
EPD_2IN9D_SendCommand(0x20);
|
||||
|
|
@ -306,36 +255,20 @@ parameter:
|
|||
void EPD_2IN9D_Init(void)
|
||||
{
|
||||
EPD_2IN9D_Reset();
|
||||
|
||||
EPD_2IN9D_SendCommand(0x04);
|
||||
EPD_2IN9D_ReadBusy();//waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
EPD_2IN9D_SendCommand(0x01); //POWER SETTING
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
EPD_2IN9D_SendData(0x00);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x2b);
|
||||
EPD_2IN9D_SendData(0x03);
|
||||
EPD_2IN9D_SendCommand(0x00); //panel setting
|
||||
EPD_2IN9D_SendData(0x1f); //LUT from OTP,KW-BF KWR-AF BWROTP 0f BWOTP 1f
|
||||
|
||||
EPD_2IN9D_SendCommand(0x06); //boost soft start
|
||||
EPD_2IN9D_SendData(0x17); //A
|
||||
EPD_2IN9D_SendData(0x17); //B
|
||||
EPD_2IN9D_SendData(0x17); //C
|
||||
EPD_2IN9D_SendCommand(0x61); //resolution setting
|
||||
EPD_2IN9D_SendData (0x80);
|
||||
EPD_2IN9D_SendData (0x01);
|
||||
EPD_2IN9D_SendData (0x28);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x04);
|
||||
EPD_2IN9D_ReadBusy();
|
||||
|
||||
EPD_2IN9D_SendCommand(0x00); //panel setting
|
||||
EPD_2IN9D_SendData(0xbf); //LUT from OTP,128x296
|
||||
EPD_2IN9D_SendData(0x0e); //VCOM to 0V fast
|
||||
|
||||
EPD_2IN9D_SendCommand(0x30); //PLL setting
|
||||
EPD_2IN9D_SendData(0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
EPD_2IN9D_SendCommand(0x61); //resolution setting
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_WIDTH);
|
||||
EPD_2IN9D_SendData((EPD_2IN9D_HEIGHT >> 8) & 0xff);
|
||||
EPD_2IN9D_SendData(EPD_2IN9D_HEIGHT & 0xff);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x82); //vcom_DC setting
|
||||
EPD_2IN9D_SendData(0x28);
|
||||
EPD_2IN9D_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
EPD_2IN9D_SendData(0x97); //WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -361,8 +294,6 @@ void EPD_2IN9D_Clear(void)
|
|||
EPD_2IN9D_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_SetFullReg();
|
||||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +313,6 @@ void EPD_2IN9D_Display(UBYTE *Image)
|
|||
EPD_2IN9D_SendData(0x00);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_2IN9D_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
|
|
@ -390,9 +320,7 @@ void EPD_2IN9D_Display(UBYTE *Image)
|
|||
EPD_2IN9D_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
// Dev_Delay_ms(10);
|
||||
|
||||
EPD_SetFullReg();
|
||||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
|
@ -430,7 +358,6 @@ void EPD_2IN9D_DisplayPart(UBYTE *Image)
|
|||
EPD_2IN9D_TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* | Function : 2.9inch e-paper d
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2019-06-12
|
||||
* | This version: V3.1
|
||||
* | Date : 2021-03-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-06-12):
|
||||
|
|
|
|||
|
|
@ -267,11 +267,19 @@ parameter:
|
|||
static void EPD_4IN2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
|||
322
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in2_V2.c
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_V2_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-02-23
|
||||
* | 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_4in2_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
UBYTE WF_PARTIAL_4IN2[76] =
|
||||
{
|
||||
0X00,0x40,0x00,0x00,0x00,0x00,0x00, // L0 0-6 ABCD
|
||||
0X80,0x80,0x00,0x00,0x00,0x00,0x00, // L1 0-6 ABCD
|
||||
0X40,0x40,0x00,0x00,0x00,0x00,0x00, // L2 0-6 ABCD
|
||||
0X00,0x80,0x00,0x00,0x00,0x00,0x00, // L3 0-6 ABCD
|
||||
0X00,0x00,0x00,0x00,0x00,0x00,0x00, // VCOM 0-6 ABCD
|
||||
0x0A,0x00,0x00,0x00,0x02,//0A 0B 0C 0D R
|
||||
0x01,0x00,0x00,0x00,0x00,//1A 0B 0C 0D R
|
||||
0x00,0x00,0x00,0x00,0x00,//2A 0B 0C 0D R
|
||||
0x00,0x00,0x00,0x00,0x00,//3A 0B 0C 0D R
|
||||
0x00,0x00,0x00,0x00,0x00,//4A 0B 0C 0D R
|
||||
0x00,0x00,0x00,0x00,0x00,//5A 0B 0C 0D R
|
||||
0x00,0x00,0x00,0x00,0x00,//6A 0B 0C 0D R
|
||||
0x17,0x41,0x0, 0x32,0x2C,0x0A
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_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_4IN2_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_4IN2_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_4IN2_V2_SendCommand(0x22);
|
||||
EPD_4IN2_V2_SendData(0xC7);
|
||||
EPD_4IN2_V2_SendCommand(0x20);
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_4IN2_V2_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_4IN2_V2_SendCommand(0x22);
|
||||
EPD_4IN2_V2_SendData(0xCF);
|
||||
EPD_4IN2_V2_SendCommand(0x20);
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_V2_SetLut(void)
|
||||
{
|
||||
UWORD count;
|
||||
EPD_4IN2_V2_SendCommand(0x32);
|
||||
for(count=0; count<70; count++) {
|
||||
EPD_4IN2_V2_SendData(WF_PARTIAL_4IN2[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_4IN2_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_4IN2_V2_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_4IN2_V2_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_4IN2_V2_SendData(Ystart & 0xFF);
|
||||
EPD_4IN2_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_4IN2_V2_SendData(Yend & 0xFF);
|
||||
EPD_4IN2_V2_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN2_V2_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_4IN2_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_4IN2_V2_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_4IN2_V2_SendData(Ystart & 0xFF);
|
||||
EPD_4IN2_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_V2_Init(void)
|
||||
{
|
||||
EPD_4IN2_V2_Reset();
|
||||
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
EPD_4IN2_V2_SendCommand(0x12); // soft reset
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x74); // IC analog block control
|
||||
EPD_4IN2_V2_SendData(0x54);
|
||||
EPD_4IN2_V2_SendCommand(0x7E); // IC digital block control
|
||||
EPD_4IN2_V2_SendData(0x3B);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x01); // drive output control
|
||||
EPD_4IN2_V2_SendData(0x2B); // Y low byte
|
||||
EPD_4IN2_V2_SendData(0x01); // Y high byte
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x11); // data entry mode
|
||||
EPD_4IN2_V2_SendData(0x03); // X-mode
|
||||
|
||||
EPD_4IN2_V2_SetWindows(0, 0, EPD_4IN2_V2_WIDTH-1, EPD_4IN2_V2_HEIGHT-1);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x3C); // Border setting
|
||||
EPD_4IN2_V2_SendData(0x01);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x18); // use the internal temperature sensor
|
||||
EPD_4IN2_V2_SendData(0x80);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x22);
|
||||
EPD_4IN2_V2_SendData(0xB1);
|
||||
EPD_4IN2_V2_SendCommand(0x20);
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
|
||||
EPD_4IN2_V2_SetCursor(0, 0);
|
||||
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_V2_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_V2_HEIGHT;
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_V2_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_V2_HEIGHT;
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
// Set Base image for partial refresh
|
||||
void EPD_4IN2_V2_Display_Base(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN2_V2_HEIGHT;
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_4IN2_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
// Send partial data for partial refresh
|
||||
void EPD_4IN2_V2_PartialDisplay(UBYTE *Image, UWORD x, UWORD y, UWORD w, UWORD l)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (w % 8 == 0)? (w / 8 ): (w / 8 + 1);
|
||||
Height = l;
|
||||
|
||||
EPD_4IN2_V2_ReadBusy();
|
||||
EPD_4IN2_V2_SetLut();
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x37);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
EPD_4IN2_V2_SendData(0x40);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
EPD_4IN2_V2_SendData(0x00);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x3C);
|
||||
EPD_4IN2_V2_SendData(0x80);
|
||||
|
||||
EPD_4IN2_V2_SetWindows(x, y, x+w-1, y+l-1);
|
||||
EPD_4IN2_V2_SetCursor(x, y);
|
||||
|
||||
EPD_4IN2_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN2_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN2_V2_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN2_V2_Sleep(void)
|
||||
{
|
||||
EPD_4IN2_V2_SendCommand(0x10); // DEEP_SLEEP
|
||||
EPD_4IN2_V2_SendData(0x01);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
47
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in2_V2.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in2_V2_V2_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.2inch e-paper V2
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-02-23
|
||||
* | 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_4IN2_V2_H_
|
||||
#define _EPD_4IN2_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_4IN2_V2_WIDTH 400
|
||||
#define EPD_4IN2_V2_HEIGHT 300
|
||||
|
||||
void EPD_4IN2_V2_Init(void);
|
||||
void EPD_4IN2_V2_Clear(void);
|
||||
void EPD_4IN2_V2_Display(UBYTE *Image);
|
||||
void EPD_4IN2_V2_Display_Base(UBYTE *Image);
|
||||
void EPD_4IN2_V2_PartialDisplay(UBYTE *Image, UWORD x, UWORD y, UWORD w, UWORD l);
|
||||
void EPD_4IN2_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_5in65f.h"
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
/******************************************************************************
|
||||
function:
|
||||
|
|
@ -103,10 +103,6 @@ void EPD_5IN65F_Init(void)
|
|||
EPD_5IN65F_SendData(0x00);
|
||||
EPD_5IN65F_SendData(0x23);
|
||||
EPD_5IN65F_SendData(0x23);
|
||||
|
||||
EPD_5IN65F_SendCommand(0x82);
|
||||
EPD_5IN65F_SendData(0x1d);
|
||||
|
||||
EPD_5IN65F_SendCommand(0x03);
|
||||
EPD_5IN65F_SendData(0x00);
|
||||
EPD_5IN65F_SendCommand(0x06);
|
||||
|
|
@ -114,8 +110,8 @@ void EPD_5IN65F_Init(void)
|
|||
EPD_5IN65F_SendData(0xC7);
|
||||
EPD_5IN65F_SendData(0x1D);
|
||||
EPD_5IN65F_SendCommand(0x30);
|
||||
EPD_5IN65F_SendData(0x3C);
|
||||
EPD_5IN65F_SendCommand(0x40);
|
||||
EPD_5IN65F_SendData(0x39);
|
||||
EPD_5IN65F_SendCommand(0x41);
|
||||
EPD_5IN65F_SendData(0x00);
|
||||
EPD_5IN65F_SendCommand(0x50);
|
||||
EPD_5IN65F_SendData(0x37);
|
||||
|
|
@ -175,12 +171,14 @@ void EPD_5IN65F_Display(const UBYTE *image)
|
|||
for(i=0; i<EPD_5IN65F_HEIGHT; i++) {
|
||||
for(j=0; j<EPD_5IN65F_WIDTH/2; j++) {
|
||||
EPD_5IN65F_SendData(image[j+((EPD_5IN65F_WIDTH/2)*i)]);
|
||||
// printf("0x%x, ", image[j+((EPD_5IN65F_WIDTH/2)*i)]);
|
||||
// k++;
|
||||
// if(k == 16) {
|
||||
// printf("\n");
|
||||
// k = 0;
|
||||
// }
|
||||
/* print image to array
|
||||
printf("0x%x, ", image[j+((EPD_5IN65F_WIDTH/2)*i)]);
|
||||
k++;
|
||||
if(k == 16) {
|
||||
printf("\n");
|
||||
k = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
EPD_5IN65F_SendCommand(0x04);//0x04
|
||||
|
|
|
|||
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch-2.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch-4.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch-5.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch-6.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch-9.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2.66inch.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2in13_1.bmp
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2in9_1.bmp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/2in9_2.bmp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/3in7_4gray1.bmp
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/3in7_4gray2.bmp
Normal file
|
After Width: | Height: | Size: 66 KiB |