KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
123:2f45e80fec5f
Parent:
111:efe436c43aba
Child:
124:1690a7ae871c
--- a/RA8875.cpp	Tue May 17 22:33:06 2016 +0000
+++ b/RA8875.cpp	Mon Jul 25 10:55:58 2016 +0000
@@ -100,6 +100,7 @@
     c_callback = NULL;
     obj_callback = NULL;
     method_callback = NULL;
+    idle_callback = NULL;
 }
 
 //RA8875::~RA8875()
@@ -324,10 +325,15 @@
     static uint8_t count = 0;
     uint8_t col, row;
     uint8_t key;
-
+    
     while (!readable()) {
         wait_us(POLLWAITuSec);
         // COUNTIDLETIME(POLLWAITuSec);     // As it is voluntary to call the getc and pend. Don't tally it.
+        if (idle_callback) {
+            if (external_abort == (*idle_callback)(getc_wait)) {
+                return 0;
+            }
+        }
     }
     // read the key press number
     uint8_t keyNumReg = ReadCommand(0xC1) & 0x03;
@@ -544,6 +550,11 @@
     while (i-- && ReadStatus() & mask) {
         wait_us(POLLWAITuSec);
         COUNTIDLETIME(POLLWAITuSec);
+        if (idle_callback) {
+            if (external_abort == (*idle_callback)(status_wait)) {
+                return false;
+            }
+        }
     }
     if (i)
         return true;
@@ -561,6 +572,11 @@
     while (i-- && ReadCommand(reg) & mask) {
         wait_us(POLLWAITuSec);
         COUNTIDLETIME(POLLWAITuSec);
+        if (idle_callback) {
+            if (external_abort == (*idle_callback)(command_wait)) {
+                return false;
+            }
+        }
     }
     if (i)
         return true;