2
0
Эх сурвалжийг харах

default lib is bcm2835, A few minor fixes

SSYYL 4 жил өмнө
parent
commit
74e3e40f5c

+ 2 - 2
RaspberryPi_JetsonNano/c/Makefile

@@ -13,8 +13,8 @@ JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.
 
 DEBUG = -D DEBUG
 
-# USELIB_RPI = USE_BCM2835_LIB
-USELIB_RPI = USE_WIRINGPI_LIB
+ USELIB_RPI = USE_BCM2835_LIB
+# USELIB_RPI = USE_WIRINGPI_LIB
 # USELIB_RPI = USE_DEV_LIB
 
 LIB_RPI=-Wl,--gc-sections

+ 10 - 3
RaspberryPi_JetsonNano/c/examples/EPD_2in13_V2_test.c

@@ -29,6 +29,7 @@
 ******************************************************************************/
 #include "EPD_Test.h"
 #include "EPD_2in13_V2.h"
+#include <time.h> 
 
 int EPD_2in13_V2_test(void)
 {
@@ -39,7 +40,13 @@ int EPD_2in13_V2_test(void)
 
     printf("e-Paper Init and Clear...\r\n");
     EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
+	
+	struct timespec start={0,0}, finish={0,0}; 
+    clock_gettime(CLOCK_REALTIME,&start);
     EPD_2IN13_V2_Clear();
+	clock_gettime(CLOCK_REALTIME,&finish);
+    printf("%ld S\r\n",finish.tv_sec-start.tv_sec);	
+    
     DEV_Delay_ms(500);
 
     //Create a new image cache
@@ -107,8 +114,8 @@ int EPD_2in13_V2_test(void)
     Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
     Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
 
-    Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
-    Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
+    Paint_DrawString_CN(140, 60, "���abc", &Font12CN, BLACK, WHITE);
+    Paint_DrawString_CN(5, 65, "΢ѩ����", &Font24CN, WHITE, BLACK);
 
     EPD_2IN13_V2_Display(BlackImage);
     DEV_Delay_ms(2000);
@@ -147,7 +154,7 @@ int EPD_2in13_V2_test(void)
     Paint_DrawLine(9, 	114,9,	9,		BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
 
     Paint_DrawString_EN(60, 25, "waveshare", &Font16, BLACK, WHITE);
-    Paint_DrawString_CN(60, 55, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
+    Paint_DrawString_CN(60, 55, "΢ѩ����", &Font24CN, WHITE, BLACK);
 
     EPD_2IN13_V2_Display(BlackImage);
     DEV_Delay_ms(2000);

+ 176 - 0
RaspberryPi_JetsonNano/c/examples/EPD_2in7_V2_test.c

@@ -0,0 +1,176 @@
+/*****************************************************************************
+* | File      	:   EPD_2in7_V2.c
+* | Author      :   Waveshare team
+* | Function    :   2.7inch V2 e-paper
+* | Info        :
+*----------------
+* |	This version:   V1.0
+* | Date        :   2021-04-22
+* | Info        :
+* -----------------------------------------------------------------------------
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documnetation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to  whom the Software is
+# furished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+******************************************************************************/
+#include "EPD_Test.h"
+#include "EPD_2in7_V2.h"
+#include <time.h> 
+
+int EPD_2in7_V2_test(void)
+{
+    printf("EPD_2IN7_V2_test Demo\r\n");
+    if(DEV_Module_Init()!=0){
+        return -1;
+    }
+
+    printf("e-Paper Init and Clear...\r\n");
+	EPD_2IN7_V2_Init();
+
+	struct timespec start={0,0}, finish={0,0}; 
+    clock_gettime(CLOCK_REALTIME,&start);
+    EPD_2IN7_V2_Clear();
+	clock_gettime(CLOCK_REALTIME,&finish);
+    printf("%ld S\r\n",finish.tv_sec-start.tv_sec);	
+
+    //Create a new image cache
+    UBYTE *BlackImage;
+    UWORD Imagesize = ((EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1)) * EPD_2IN7_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_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
+	Paint_Clear(WHITE);
+	
+#if 1   // show bmp
+	Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
+    printf("show window BMP-----------------\r\n");
+    Paint_SelectImage(BlackImage);
+    GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
+    EPD_2IN7_V2_Display(BlackImage);
+    DEV_Delay_ms(3000);
+
+    printf("show bmp------------------------\r\n");
+    Paint_SelectImage(BlackImage);
+    GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
+    EPD_2IN7_V2_Display(BlackImage);
+    DEV_Delay_ms(3000);
+#endif
+
+#if 1  //show image for array  
+    Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);  
+    printf("show image for array\r\n");
+    Paint_SelectImage(BlackImage);
+    Paint_Clear(WHITE);
+    Paint_DrawBitMap(gImage_2in7);
+
+    EPD_2IN7_V2_Display(BlackImage);
+    DEV_Delay_ms(3000);
+#endif
+
+#if 1  // Drawing on the image
+	Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);  	
+    printf("Drawing\r\n");
+    //1.Select Image
+    Paint_SelectImage(BlackImage);
+    Paint_Clear(WHITE);
+	
+    // 2.Drawing on the image
+    printf("Drawing:BlackImage\r\n");
+    Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
+    Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
+    Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
+
+    Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
+    Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
+
+    Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
+    Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
+
+    Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
+    Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
+
+    Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
+    Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
+
+    Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
+    Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
+
+    Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
+    Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
+
+    Paint_DrawString_CN(130, 0,"你好abc", &Font12CN, BLACK, WHITE);
+    Paint_DrawString_CN(130, 20, "微雪电子", &Font24CN, WHITE, BLACK);
+
+    EPD_2IN7_V2_Display_Base(BlackImage);
+    DEV_Delay_ms(3000);
+#endif
+
+#if 1   //Partial refresh, example shows time    		
+	Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);  
+    printf("Partial refresh\r\n");
+    Paint_SelectImage(BlackImage);
+	
+    PAINT_TIME sPaint_time;
+    sPaint_time.Hour = 12;
+    sPaint_time.Min = 34;
+    sPaint_time.Sec = 56;
+    UBYTE num = 10;
+    for (;;) {
+        sPaint_time.Sec = sPaint_time.Sec + 1;
+        if (sPaint_time.Sec == 60) {
+            sPaint_time.Min = sPaint_time.Min + 1;
+            sPaint_time.Sec = 0;
+            if (sPaint_time.Min == 60) {
+                sPaint_time.Hour =  sPaint_time.Hour + 1;
+                sPaint_time.Min = 0;
+                if (sPaint_time.Hour == 24) {
+                    sPaint_time.Hour = 0;
+                    sPaint_time.Min = 0;
+                    sPaint_time.Sec = 0;
+                }
+            }
+        }
+        Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
+        Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
+
+        num = num - 1;
+        if(num == 0) {
+            break;
+        }
+		EPD_2IN7_V2_Display_Partial(BlackImage);
+        DEV_Delay_ms(500);//Analog clock 1s
+    }
+#endif
+
+	printf("Clear...\r\n");
+	EPD_2IN7_V2_Init();
+    EPD_2IN7_V2_Clear();
+	
+    printf("Goto Sleep...\r\n");
+    EPD_2IN7_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;
+}

+ 1 - 0
RaspberryPi_JetsonNano/c/examples/EPD_Test.h

@@ -52,6 +52,7 @@ int EPD_1in54c_test(void);
 int EPD_2in66_test(void);
 int	EPD_2in66b_test(void); 
 int EPD_2in7_test(void);
+int EPD_2in7_V2_test(void);
 int EPD_2in7b_test(void);
 int EPD_2in7b_V2_test(void);
 

+ 2 - 1
RaspberryPi_JetsonNano/c/examples/main.c

@@ -23,7 +23,7 @@ int main(void)
     // EPD_1in02d_test();
 
     // EPD_1in54_test();
-	// EPD_1in54_V2_test();
+    // EPD_1in54_V2_test();
     // EPD_1in54b_test();
 	// EPD_1in54b_V2_test();
     // EPD_1in54c_test();
@@ -32,6 +32,7 @@ int main(void)
 	// EPD_2in66b_test();
 
     // EPD_2in7_test();
+	// EPD_2in7_V2_test();
     // EPD_2in7b_test();
 	// EPD_2in7b_V2_test();
 

+ 1 - 1
RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c

@@ -114,7 +114,7 @@ void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len)
 #ifdef RPI
 #ifdef USE_BCM2835_LIB
 	char rData[Len];
-	bcm2835_spi_transfernb(pData,rData,Len);
+	bcm2835_spi_transfernb((char *)pData,rData,Len);
 #elif USE_WIRINGPI_LIB
 	wiringPiSPIDataRW(0, pData, Len);
 #elif USE_DEV_LIB

+ 2 - 2
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in66.c

@@ -97,11 +97,11 @@ parameter:
 static void EPD_2IN66_ReadBusy(void)
 {
     Debug("e-Paper busy\r\n");
-    DEV_Delay_ms(200);
+    DEV_Delay_ms(20);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
         DEV_Delay_ms(5);
     }
-    DEV_Delay_ms(100);
+    DEV_Delay_ms(10);
     Debug("e-Paper busy release\r\n");
 }
 

+ 315 - 0
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in7_V2.c

@@ -0,0 +1,315 @@
+/*****************************************************************************
+* | File      	:   EPD_2in7_V2.c
+* | Author      :   Waveshare team
+* | Function    :   2.7inch V2 e-paper
+* | Info        :
+*----------------
+* |	This version:   V1.0
+* | Date        :   2021-04-22
+* | 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_2in7_V2.h"
+#include "Debug.h"
+
+UBYTE WF_PARTIAL_2in7_V2[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,
+0x22,0x17,0x41,0xB0,0x32,0x32,
+};
+
+/******************************************************************************
+function :	Software reset
+parameter:
+******************************************************************************/
+static void EPD_2IN7_V2_Reset(void)
+{
+    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);
+}
+
+/******************************************************************************
+function :	send command
+parameter:
+     Reg : Command register
+******************************************************************************/
+static void EPD_2IN7_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_2IN7_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_2IN7_V2_ReadBusy(void)
+{
+    Debug("e-Paper busy\r\n");
+    do {
+        if(DEV_Digital_Read(EPD_BUSY_PIN) == 0)
+			break;
+    } while(1);
+    DEV_Delay_ms(20);
+    Debug("e-Paper busy release\r\n");
+}
+
+/******************************************************************************
+function :	Turn on display
+parameter:
+******************************************************************************/
+static void EPD_2IN7_V2_TurnOnDisplay(void)
+{
+	EPD_2IN7_V2_SendCommand(0x20);
+    EPD_2IN7_V2_ReadBusy();
+}
+
+static void EPD_2IN7_V2_TurnOnDisplay_Partial(void)
+{
+    EPD_2IN7_V2_SendCommand(0x22);
+    EPD_2IN7_V2_SendData(0x0f);
+	EPD_2IN7_V2_SendCommand(0x20);
+    EPD_2IN7_V2_ReadBusy();
+}
+
+/******************************************************************************
+function :	set the look-up tables
+parameter:
+******************************************************************************/
+static void EPD_2IN7_V2_SetLut(void)
+{
+    unsigned int count;
+    EPD_2IN7_V2_SendCommand(0x32); //vcom
+    for(count = 0; count < 153; count++) {
+        EPD_2IN7_V2_SendData(WF_PARTIAL_2in7_V2[count]);
+    }
+}
+
+/******************************************************************************
+function :	Setting the display window
+parameter:
+******************************************************************************/
+static void EPD_2IN7_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
+{
+    EPD_2IN7_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
+    EPD_2IN7_V2_SendData((Xstart>>3) & 0xFF);
+    EPD_2IN7_V2_SendData((Xend>>3) & 0xFF);
+	
+    EPD_2IN7_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+    EPD_2IN7_V2_SendData(Ystart & 0xFF);
+    EPD_2IN7_V2_SendData((Ystart >> 8) & 0xFF);
+    EPD_2IN7_V2_SendData(Yend & 0xFF);
+    EPD_2IN7_V2_SendData((Yend >> 8) & 0xFF);
+}
+
+/******************************************************************************
+function :	Set Cursor
+parameter:
+******************************************************************************/
+static void EPD_2IN7_V2_SetCursor(UWORD Xstart, UWORD Ystart)
+{
+    EPD_2IN7_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
+    EPD_2IN7_V2_SendData(Xstart & 0xFF);
+
+    EPD_2IN7_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
+    EPD_2IN7_V2_SendData(Ystart & 0xFF);
+    EPD_2IN7_V2_SendData((Ystart >> 8) & 0xFF);
+}
+
+/******************************************************************************
+function :	Initialize the e-Paper register
+parameter:
+******************************************************************************/
+void EPD_2IN7_V2_Init(void)
+{
+    EPD_2IN7_V2_Reset();
+	EPD_2IN7_V2_ReadBusy();
+	
+	EPD_2IN7_V2_SendCommand(0x12);
+	EPD_2IN7_V2_ReadBusy();
+
+	EPD_2IN7_V2_SendCommand(0x01); //Driver output control      
+	EPD_2IN7_V2_SendData(0x27);
+	EPD_2IN7_V2_SendData(0x01);
+	EPD_2IN7_V2_SendData(0x00);
+	
+	EPD_2IN7_V2_SendCommand(0x11); //data entry mode       
+	EPD_2IN7_V2_SendData(0x03);
+	
+	EPD_2IN7_V2_SetWindows(0, 0, EPD_2IN7_V2_WIDTH-1, EPD_2IN7_V2_HEIGHT-1);
+	EPD_2IN7_V2_SetCursor(0, 0);
+}
+
+/******************************************************************************
+function :	Clear screen
+parameter:
+******************************************************************************/
+void EPD_2IN7_V2_Clear(void)
+{
+    UWORD Width, Height;
+    Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
+    Height = EPD_2IN7_V2_HEIGHT;
+
+    EPD_2IN7_V2_SendCommand(0x24);
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(0XFF);
+        }
+    }
+
+    EPD_2IN7_V2_SendCommand(0x26);
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(0X00);
+        }
+    }
+	EPD_2IN7_V2_TurnOnDisplay();
+}
+
+/******************************************************************************
+function :	Sends the image buffer in RAM to e-Paper and displays
+parameter:
+******************************************************************************/
+void EPD_2IN7_V2_Display(UBYTE *Image)
+{
+    UWORD Width, Height;
+    Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
+    Height = EPD_2IN7_V2_HEIGHT;
+	
+    EPD_2IN7_V2_SendCommand(0x24);
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(Image[i + j * Width]);
+        }
+    }
+	
+	EPD_2IN7_V2_TurnOnDisplay();
+}
+
+void EPD_2IN7_V2_Display_Base(UBYTE *Image)
+{
+    UWORD Width, Height;
+    Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
+    Height = EPD_2IN7_V2_HEIGHT;
+
+	EPD_2IN7_V2_SendCommand(0x24);   //Write Black and White image to RAM
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(Image[i + j * Width]);
+        }
+    }
+	EPD_2IN7_V2_SendCommand(0x26);   //Write Black and White image to RAM
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(Image[i + j * Width]);
+        }
+    }
+	EPD_2IN7_V2_TurnOnDisplay();	
+}
+
+void EPD_2IN7_V2_Display_Partial(UBYTE *Image)
+{
+    UWORD Width, Height;
+    Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
+    Height = EPD_2IN7_V2_HEIGHT;
+
+    DEV_Digital_Write(EPD_RST_PIN, 0);
+    DEV_Delay_ms(1);
+    DEV_Digital_Write(EPD_RST_PIN, 1);
+	
+	EPD_2IN7_V2_ReadBusy();
+	EPD_2IN7_V2_SetLut();
+	EPD_2IN7_V2_SendCommand(0x37);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x40);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+	EPD_2IN7_V2_SendData(0x00);
+
+	EPD_2IN7_V2_SendCommand(0x3c);
+	EPD_2IN7_V2_SendData(0x80);
+	
+	EPD_2IN7_V2_SendCommand(0x22);
+	EPD_2IN7_V2_SendData(0xc0);
+	EPD_2IN7_V2_SendCommand(0x20);
+	EPD_2IN7_V2_ReadBusy();
+
+    EPD_2IN7_V2_SendCommand(0x24);
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_2IN7_V2_SendData(Image[i + j * Width]);
+        }
+    }
+	
+	EPD_2IN7_V2_TurnOnDisplay_Partial();
+}
+
+/******************************************************************************
+function :	Enter sleep mode
+parameter:
+******************************************************************************/
+void EPD_2IN7_V2_Sleep(void)
+{
+    EPD_2IN7_V2_SendCommand(0X10);
+    EPD_2IN7_V2_SendData(0x01);
+}

+ 48 - 0
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in7_V2.h

@@ -0,0 +1,48 @@
+/*****************************************************************************
+* | File      	:   EPD_2in7_V2.h
+* | Author      :   Waveshare team
+* | Function    :   2.7inch V2 e-paper
+* | Info        :
+*----------------
+* |	This version:   V1.0
+* | Date        :   2021-04-22
+* | 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_2IN7_V2_H_
+#define __EPD_2IN7_V2_H_
+
+#include "DEV_Config.h"
+
+// Display resolution
+#define EPD_2IN7_V2_WIDTH       176
+#define EPD_2IN7_V2_HEIGHT      264
+
+void EPD_2IN7_V2_Init(void);
+void EPD_2IN7_V2_Clear(void);
+void EPD_2IN7_V2_Display(UBYTE *Image);
+void EPD_2IN7_V2_Sleep(void);
+
+void EPD_2IN7_V2_Display_Base(UBYTE *Image);
+void EPD_2IN7_V2_Display_Partial(UBYTE *Image);
+
+#endif

+ 2 - 2
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_3in7.c

@@ -200,7 +200,7 @@ void EPD_3IN7_4Gray_Init(void)
     EPD_3IN7_SendData(0x03);
 
     EPD_3IN7_SendCommand(0x3C); // set border 
-    EPD_3IN7_SendData(0x00);
+    EPD_3IN7_SendData(0x03);
 
     EPD_3IN7_SendCommand(0x0C); // set booster strength
     EPD_3IN7_SendData(0xAE);
@@ -278,7 +278,7 @@ void EPD_3IN7_1Gray_Init(void)
     EPD_3IN7_SendData(0x03);
 
     EPD_3IN7_SendCommand(0x3C); // set border 
-    EPD_3IN7_SendData(0x00);
+    EPD_3IN7_SendData(0x03);
 
     EPD_3IN7_SendCommand(0x0C); // set booster strength
     EPD_3IN7_SendData(0xAE);

BIN
RaspberryPi_JetsonNano/c/pic/7in5_V2_0.bmp


BIN
RaspberryPi_JetsonNano/c/pic/Color7.bmp


BIN
RaspberryPi_JetsonNano/c/pic/Pico_3in7.bmp


+ 7 - 0
RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd7in5_V2.py

@@ -79,6 +79,7 @@ class EPD:
             self.send_command(0x71)
             busy = epdconfig.digital_read(self.busy_pin)
         epdconfig.delay_ms(200)
+        logging.debug("e-Paper busy release")
         
     def init(self):
         if (epdconfig.module_init() != 0):
@@ -86,6 +87,12 @@ class EPD:
         # EPD hardware init start
         self.reset()
         
+        self.send_command(0x06)     # btst
+        self.send_data(0x17)
+        self.send_data(0x17)
+        self.send_data(0x28)        # If an exception is displayed, try using 0x38
+        self.send_data(0x17)
+        
         self.send_command(0x01)			#POWER SETTING
         self.send_data(0x07)
         self.send_data(0x07)    #VGH=20V,VGL=-20V

+ 8 - 1
RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd7in5b_V2.py

@@ -73,13 +73,20 @@ class EPD:
             self.send_command(0x71)
             busy = epdconfig.digital_read(self.busy_pin)
         epdconfig.delay_ms(200)
-            
+        logging.debug("e-Paper busy release")
+        
     def init(self):
         if (epdconfig.module_init() != 0):
             return -1
             
         self.reset()
         
+        # self.send_command(0x06)     # btst
+        # self.send_data(0x17)
+        # self.send_data(0x17)
+        # self.send_data(0x38)        # If an exception is displayed, try using 0x38
+        # self.send_data(0x17)
+
         self.send_command(0x01);			#POWER SETTING
         self.send_data(0x07);
         self.send_data(0x07);    #VGH=20V,VGL=-20V

BIN
RaspberryPi_JetsonNano/python/pic/2in13d_1.bmp


BIN
RaspberryPi_JetsonNano/python/pic/Color7.bmp


BIN
RaspberryPi_JetsonNano/python/pic/Pico_3in7.bmp


BIN
RaspberryPi_JetsonNano/python/pic/image_black.bmp


BIN
RaspberryPi_JetsonNano/python/pic/image_red.bmp