Просмотр исходного кода

fix: 墨水屏busy检测应该有个超时时间,先设置成10秒吧

chenxuuu 3 лет назад
Родитель
Сommit
03083854ac
35 измененных файлов с 288 добавлено и 22 удалено
  1. 6 1
      components/epaper/EPD_1in02d.c
  2. 8 1
      components/epaper/EPD_1in54.c
  3. 8 1
      components/epaper/EPD_1in54_V2.c
  4. 8 0
      components/epaper/EPD_1in54b.c
  5. 8 0
      components/epaper/EPD_1in54b_V2.c
  6. 6 1
      components/epaper/EPD_1in54c.c
  7. 8 1
      components/epaper/EPD_2in13.c
  8. 8 1
      components/epaper/EPD_2in13_V2.c
  9. 8 0
      components/epaper/EPD_2in13b_V3.c
  10. 8 1
      components/epaper/EPD_2in13bc.c
  11. 8 0
      components/epaper/EPD_2in13d.c
  12. 8 1
      components/epaper/EPD_2in66.c
  13. 8 1
      components/epaper/EPD_2in66b.c
  14. 8 0
      components/epaper/EPD_2in7.c
  15. 8 1
      components/epaper/EPD_2in7b.c
  16. 8 1
      components/epaper/EPD_2in9.c
  17. 8 1
      components/epaper/EPD_2in9_V2.c
  18. 8 0
      components/epaper/EPD_2in9b_V3.c
  19. 8 1
      components/epaper/EPD_2in9bc.c
  20. 8 0
      components/epaper/EPD_2in9d.c
  21. 8 0
      components/epaper/EPD_3in7.c
  22. 8 1
      components/epaper/EPD_4in2.c
  23. 8 0
      components/epaper/EPD_4in2b_V2.c
  24. 8 1
      components/epaper/EPD_4in2bc.c
  25. 20 2
      components/epaper/EPD_5in65f.c
  26. 8 1
      components/epaper/EPD_5in83.c
  27. 8 1
      components/epaper/EPD_5in83_V2.c
  28. 8 0
      components/epaper/EPD_5in83b_V2.c
  29. 8 0
      components/epaper/EPD_5in83bc.c
  30. 8 1
      components/epaper/EPD_7in5.c
  31. 8 1
      components/epaper/EPD_7in5_HD.c
  32. 8 0
      components/epaper/EPD_7in5_V2.c
  33. 8 1
      components/epaper/EPD_7in5b_HD.c
  34. 8 0
      components/epaper/EPD_7in5b_V2.c
  35. 8 0
      components/epaper/EPD_7in5bc.c

+ 6 - 1
components/epaper/EPD_1in02d.c

@@ -159,11 +159,16 @@ function :	Wait until the busy_pin goes LOW
 void EPD_1IN02_WaitUntilIdle(void)
 {
 	unsigned char busy;
+    unsigned char count = 100;
 	do
 	{
 		EPD_1IN02_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
-		busy =!(busy & 0x01);        
+		busy =!(busy & 0x01);
+		if(!(count--))
+            break;
+        else
+            DEV_Delay_ms(100);
 	}
 	while(busy);
 	DEV_Delay_ms(800);                       

+ 8 - 1
components/epaper/EPD_1in54.c

@@ -147,9 +147,16 @@ parameter:
 ******************************************************************************/
 void EPD_1IN54_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_1in54_V2.c

@@ -76,6 +76,7 @@ parameter:
 ******************************************************************************/
 static void EPD_1IN54_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     // UBYTE busy;
     // do {
@@ -85,7 +86,13 @@ static void EPD_1IN54_V2_ReadBusy(void)
     // } while(busy);
     // DEV_Delay_ms(200);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 0
components/epaper/EPD_1in54b.c

@@ -149,10 +149,18 @@ parameter:
 ******************************************************************************/
 static void EPD_1IN54B_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(1) {
         if(DEV_Digital_Read(EPD_BUSY_PIN) == 1)
             break;
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_1in54b_V2.c

@@ -77,10 +77,18 @@ parameter:
 ******************************************************************************/
 static void EPD_1IN54B_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(1) {
         if(DEV_Digital_Read(EPD_BUSY_PIN) == 0)
             break;
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 6 - 1
components/epaper/EPD_1in54c.c

@@ -128,10 +128,15 @@ parameter:
 static void EPD_1IN54C_ReadBusy(void)
 {
     unsigned char busy;
+    unsigned char count = 100;
     do {
         EPD_1IN54C_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+		if(!(count--))
+            break;
+        else
+            DEV_Delay_ms(100);
     }	while(busy);
     DEV_Delay_ms(200);
 }
@@ -153,7 +158,7 @@ void EPD_1IN54C_Init(void)
     EPD_1IN54C_ReadBusy();
 
     EPD_1IN54C_SendCommand(0x00); //panel setting
-    EPD_1IN54C_SendData(0x0f); //LUT from OTP£¬160x296
+    EPD_1IN54C_SendData(0x0f); //LUT from OTP��160x296
     EPD_1IN54C_SendData(0x0d); //VCOM to 0V fast
 
     EPD_1IN54C_SendCommand(0x61); //resolution setting

+ 8 - 1
components/epaper/EPD_2in13.c

@@ -110,9 +110,16 @@ parameter:
 ******************************************************************************/
 void EPD_2IN13_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_2in13_V2.c

@@ -134,9 +134,16 @@ parameter:
 ******************************************************************************/
 void EPD_2IN13_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 0
components/epaper/EPD_2in13b_V3.c

@@ -80,12 +80,20 @@ parameter:
 ******************************************************************************/
 void EPD_2IN13B_V3_ReadBusy(void)
 {
+    unsigned char count = 100;
     UBYTE busy;
     Debug("e-Paper busy\r\n");
     do{
         EPD_2IN13B_V3_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }while(busy);
     Debug("e-Paper busy release\r\n");
     DEV_Delay_ms(200);

+ 8 - 1
components/epaper/EPD_2in13bc.c

@@ -129,9 +129,16 @@ parameter:
 ******************************************************************************/
 void EPD_2IN13BC_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 0
components/epaper/EPD_2in13d.c

@@ -211,12 +211,20 @@ parameter:
 ******************************************************************************/
 static void EPD_2IN13D_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     UBYTE busy;
     do {
         EPD_2IN13D_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_2in66.c

@@ -96,10 +96,17 @@ parameter:
 ******************************************************************************/
 void EPD_2IN66_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     DEV_Delay_ms(100);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     DEV_Delay_ms(100);
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_2in66b.c

@@ -76,10 +76,17 @@ parameter:
 ******************************************************************************/
 static void EPD_2IN66B_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     DEV_Delay_ms(50);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(10);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     DEV_Delay_ms(50);
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_2in7.c

@@ -239,12 +239,20 @@ parameter:
 ******************************************************************************/
 static void EPD_2in7_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     UBYTE busy;
     do {
         EPD_2in7_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_2in7b.c

@@ -190,9 +190,16 @@ parameter:
 ******************************************************************************/
 static void EPD_2IN7B_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //0: busy, 1: idle
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }    
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_2in9.c

@@ -141,9 +141,16 @@ parameter:
 ******************************************************************************/
 void EPD_2IN9_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_2in9_V2.c

@@ -100,12 +100,19 @@ parameter:
 ******************************************************************************/
 void EPD_2IN9_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
 	while(1)
 	{	 //=1 BUSY
 		if(DEV_Digital_Read(EPD_BUSY_PIN)==0) 
 			break;
-		DEV_Delay_ms(50);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}
 	DEV_Delay_ms(50);
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_2in9b_V3.c

@@ -77,6 +77,7 @@ parameter:
 ******************************************************************************/
 void EPD_2IN9B_V3_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     UBYTE busy;
 	do
@@ -84,6 +85,13 @@ void EPD_2IN9B_V3_ReadBusy(void)
 		EPD_2IN9B_V3_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
 		busy =!(busy & 0x01);        
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}
 	while(busy); 
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_2in9bc.c

@@ -130,9 +130,16 @@ parameter:
 ******************************************************************************/
 void EPD_2IN9BC_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 0
components/epaper/EPD_2in9d.c

@@ -202,12 +202,20 @@ parameter:
 ******************************************************************************/
 void EPD_2IN9D_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     UBYTE busy;
     do {
         EPD_2IN9D_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_3in7.c

@@ -133,10 +133,18 @@ static void EPD_3IN7_SendData(UBYTE Data)
 
 static void EPD_3IN7_ReadBusy_HIGH(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     UBYTE busy;
     do {
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     DEV_Delay_ms(200);
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_4in2.c

@@ -310,11 +310,18 @@ parameter:
 ******************************************************************************/
 void EPD_4IN2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     EPD_4IN2_SendCommand(0x71);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //LOW: idle, HIGH: busy
         EPD_4IN2_SendCommand(0x71);
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 0
components/epaper/EPD_4in2b_V2.c

@@ -77,12 +77,20 @@ parameter:
 ******************************************************************************/
 void EPD_4IN2B_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     unsigned char busy;
     do{
         EPD_4IN2B_V2_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
 		busy =!(busy & 0x01); 
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }while(busy);
     Debug("e-Paper busy release\r\n");
     DEV_Delay_ms(200);

+ 8 - 1
components/epaper/EPD_4in2bc.c

@@ -130,9 +130,16 @@ parameter:
 ******************************************************************************/
 void EPD_4IN2BC_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //0: busy, 1: idle
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 20 - 2
components/epaper/EPD_5in65f.c

@@ -73,12 +73,30 @@ static void EPD_5IN65F_SendData(UBYTE Data)
 
 static void EPD_5IN65F_BusyHigh(void)// If BUSYN=0 then waiting
 {
-    while(!(DEV_Digital_Read(EPD_BUSY_PIN)));
+    unsigned char count = 100;
+    while(!(DEV_Digital_Read(EPD_BUSY_PIN))){
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
+    }
 }
 
 static void EPD_5IN65F_BusyLow(void)// If BUSYN=1 then waiting
 {
-    while(DEV_Digital_Read(EPD_BUSY_PIN));
+    unsigned char count = 100;
+    while(DEV_Digital_Read(EPD_BUSY_PIN)){
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
+    }
 }
 
 /******************************************************************************

+ 8 - 1
components/epaper/EPD_5in83.c

@@ -133,9 +133,16 @@ parameter:
 ******************************************************************************/
 static void EPD_5IN83_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_5in83_V2.c

@@ -77,10 +77,17 @@ parameter:
 ******************************************************************************/
 static void EPD_5in83_V2_ReadBusy(void)
 {
+    unsigned char count = 100;
 	Debug("e-Paper busy\r\n");
 	do {
 		EPD_5in83_V2_SendCommand(0x71);
-		DEV_Delay_ms(50);    
+		if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}
 	while(!DEV_Digital_Read(EPD_BUSY_PIN));   
 	Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_5in83b_V2.c

@@ -76,6 +76,7 @@ parameter:
 ******************************************************************************/
 void EPD_5IN83B_V2_WaitUntilIdle(void)
 {
+    unsigned char count = 100;
   Debug("e-Paper busy\r\n");
 	UBYTE busy;
 	do
@@ -83,6 +84,13 @@ void EPD_5IN83B_V2_WaitUntilIdle(void)
 		EPD_5IN83B_V2_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
 		busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}
 	while(busy);   
 	DEV_Delay_ms(200);     

+ 8 - 0
components/epaper/EPD_5in83bc.c

@@ -131,12 +131,20 @@ parameter:
 ******************************************************************************/
 void EPD_5IN83BC_ReadBusy(void)
 {
+    unsigned char count = 100;
     UBYTE busy;
     Debug("e-Paper busy\r\n");
     do {
         EPD_5IN83BC_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_7in5.c

@@ -133,9 +133,16 @@ parameter:
 ******************************************************************************/
 void EPD_7IN5_ReadBusy(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     Debug("e-Paper busy release\r\n");
 }

+ 8 - 1
components/epaper/EPD_7in5_HD.c

@@ -77,9 +77,16 @@ parameter:
 ******************************************************************************/
 static void EPD_7IN5_HD_WaitUntilIdle(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     do{
-        DEV_Delay_ms(10);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }while(DEV_Digital_Read(EPD_BUSY_PIN) == 1);   
     DEV_Delay_ms(200);      
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_7in5_V2.c

@@ -77,12 +77,20 @@ parameter:
 ******************************************************************************/
 static void EPD_WaitUntilIdle(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     unsigned char busy;
 	do{
 		EPD_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
 		busy =!(busy & 0x01);        
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}while(busy);   
 	DEV_Delay_ms(200);      
     Debug("e-Paper busy release\r\n");

+ 8 - 1
components/epaper/EPD_7in5b_HD.c

@@ -77,9 +77,16 @@ parameter:
 ******************************************************************************/
 void EPD_7IN5B_HD_WaitUntilIdle(void)
 {
+    unsigned char count = 100;
     Debug("e-Paper busy\r\n");
     while(DEV_Digital_Read(EPD_BUSY_PIN)){
-        //DEV_Delay_ms(10);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     }
     DEV_Delay_ms(200);      
     Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_7in5b_V2.c

@@ -76,12 +76,20 @@ parameter:
 ******************************************************************************/
 void EPD_7IN5B_V2_WaitUntilIdle(void)
 {
+    unsigned char count = 100;
 	Debug("e-Paper busy\r\n");
 	unsigned char busy;
 	do	{
 		EPD_7IN5B_V2_SendCommand(0x71);
 		busy = DEV_Digital_Read(EPD_BUSY_PIN);
 		busy =!(busy & 0x01);        
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
 	}while(busy);
 	DEV_Delay_ms(200);      
 	Debug("e-Paper busy release\r\n");

+ 8 - 0
components/epaper/EPD_7in5bc.c

@@ -131,12 +131,20 @@ parameter:
 ******************************************************************************/
 void EPD_7IN5BC_ReadBusy(void)
 {
+    unsigned char count = 100;
     UBYTE busy;
     Debug("e-Paper busy\r\n");
     do {
         EPD_7IN5BC_SendCommand(0x71);
         busy = DEV_Digital_Read(EPD_BUSY_PIN);
         busy =!(busy & 0x01);
+        if(!(count--))
+        {
+            Debug("error: e-Paper busy timeout!!!\r\n");
+            break;
+        }
+        else
+            DEV_Delay_ms(100);
     } while(busy);
     Debug("e-Paper busy release\r\n");
 }