Harry Chen / EPD_GDEW075T8

Dependents:   EInkTest

Revision:
2:73f957691c31
Parent:
1:6ae4383194a1
Child:
3:8129e159831b
--- a/GDEW075T8.cpp	Mon Oct 15 03:53:22 2018 +0000
+++ b/GDEW075T8.cpp	Mon Oct 15 03:56:16 2018 +0000
@@ -55,6 +55,12 @@
 
 }
 
+static void refresh() {
+    sendCommand(0x12);
+    wait(0.1);
+    waitForReady();
+}
+
 #define PIXEL_WHITE 0x02
 #define PIXEL_BLACK 0x00
 #define PIXEL(p) ((p) ? (PIXEL_BLACK) : (PIXEL_WHITE))
@@ -66,7 +72,9 @@
     
     source.init();
     
-    while (source.hasNext()) {
+    int i = 0;
+    
+    while (i++ < GDE::BUFFER_SIZE && source.hasNext()) {
         unsigned char p = source.nextPixelGroup();
         // transmit 2 pixels each time
         for (int j = 0; j < 4; ++j) {
@@ -81,7 +89,7 @@
     waitForReady();
 
     // display refresh
-    GDE::refresh();
+    refresh();
 
     wait(1);
 }
@@ -145,12 +153,6 @@
     
     }
     
-    void refresh() {
-        sendCommand(0x12);
-        wait(0.1);
-        waitForReady();
-    }
-    
     void showPixels(PixelSource &source, bool needRefresh) {
         if (needRefresh) {
             PixelSource fullBlackSource = PixelSource();