Onscreen QWERTY keypad for RA8857 based display. Uses the resistive touch panel.

Dependents:   RA8875_KeyPadDemo PUB_RA8875_Keypad IAC_Final_Monil_copy

Revision:
3:402f1126a3ec
Parent:
2:6d05764dfde7
Child:
4:edb5155f1b6f
--- a/Keypad.cpp	Sat Mar 05 16:21:58 2016 +0000
+++ b/Keypad.cpp	Sat Mar 05 16:47:58 2016 +0000
@@ -61,6 +61,7 @@
     if (invert) {
         ra.foreground(back);
         ra.background(fore);
+        ra.SetTextCursorControl(RA8875::NOCURSOR);
     }
     ra.putc(c);
     if (invert) {
@@ -109,7 +110,7 @@
         r.p2.y = ra.height() - 1;   
     else
         r.p2.y = r.p1.y + kbd->height - 1;
-    printf("KeypadRect (%d,%d) - (%d,%d)\r\n", r.p1.x, r.p1.y, r.p2.x, r.p2.y);
+    //printf("KeypadRect (%d,%d) - (%d,%d)\r\n", r.p1.x, r.p1.y, r.p2.x, r.p2.y);
     return r; 
 }
 
@@ -123,7 +124,7 @@
     rect_t r = ComputeKeypadRect();
     rect_t ref = r;
     kW = (ref.p2.x - ref.p1.x) / (kbd->cols+1);
-    printf("DrawKeypad kW=%d from (%d,%d) %d\r\n", kW, ref.p2.x, ref.p1.x, kbd->cols+1);
+    //printf("DrawKeypad kW=%d from (%d,%d) %d\r\n", kW, ref.p2.x, ref.p1.x, kbd->cols+1);
     r.p1.y += kH;
     if (shift)
         p = kbd->keydef2;
@@ -179,8 +180,8 @@
 
 void Keypad::ShowBufferMetrics(void) {
     rect_t r = ComputeKeypadRect();
-    ra.SetTextCursor(r.p2.x-1-ra.fontwidth()*7, r.p1.y+2);
-    ra.printf("%03d/%03d", pNext - pStart, bufSize);            // "001/100"
+    ra.SetTextCursor(r.p2.x-1-ra.fontwidth()*5, r.p1.y+2);
+    ra.printf("%02d/%02d", pNext - pStart, bufSize);            // "001/100"
     //ra.SetTextCursor(ra.width()-1-ra.fontwidth()*7, ra.height()-1-ra.fontheight());
     ra.SetTextCursor(userText.x, userText.y);
     ra.SetTextCursorControl(RA8875::UNDER);
@@ -208,7 +209,7 @@
                 } while (is != no_touch);
                 DrawKey(touchRect, key);
             }
-            printf("Touch %02X at (%d,%d)\r\n", key, point.x, point.y);
+            //printf("Touch %02X at (%d,%d)\r\n", key, point.x, point.y);
             if (key == enter_key) {
                 *pNext = '\0';
                 ra.SetTextCursorControl();
@@ -251,8 +252,3 @@
         }
     }
 }
-
-const Keypad::keyboard_t * Keypad::GetInternalKeypad(void) {
-    return &internalkbd;
-}
-