class library for a TS Keypad and retrieving multiple keys, then press enter and the values are stored and the keypad disappears.

Files at this revision

API Documentation at this revision

Comitter:
Armand
Date:
Tue Jun 20 12:00:18 2017 +0000
Parent:
0:b3fd90f94e58
Commit message:
Fixed some bugs

Changed in this revision

F7_TSKeypad_MultiKey.cpp Show annotated file Show diff for this revision Revisions of this file
F7_TSKeypad_MultiKey.h Show annotated file Show diff for this revision Revisions of this file
diff -r b3fd90f94e58 -r 483300d6debd F7_TSKeypad_MultiKey.cpp
--- a/F7_TSKeypad_MultiKey.cpp	Wed Jun 07 08:45:35 2017 +0000
+++ b/F7_TSKeypad_MultiKey.cpp	Tue Jun 20 12:00:18 2017 +0000
@@ -5,6 +5,7 @@
 {
     btnsize = 50;
     state = 0;
+    key = 0;
     
     status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
     if (status != TS_OK) 
@@ -209,6 +210,7 @@
                         {   
                             state = 15;
                             correcttouch = 1;
+                            key = button;
                             a = 3;
                             b = 3;
                         }
@@ -222,7 +224,7 @@
             }break;
             case 15:
             {  
-                if(correcttouch == 1)
+                if(button == key && button != 0)
                 {     
                     if(TS_State.touchDetected == 0)
                     {  
@@ -230,7 +232,7 @@
                         state = 20;                
                     }                    
                 }
-                else if(correcttouch == 0 && button == 0)
+                else if(button != key || button == 0)
                 {   
                     state = 30;
                 } 
@@ -405,7 +407,9 @@
                     m++;
                     textx += 12;
                 }             
-    
+                
+                key = 0;
+                
             }break; 
             case 30:
             {
diff -r b3fd90f94e58 -r 483300d6debd F7_TSKeypad_MultiKey.h
--- a/F7_TSKeypad_MultiKey.h	Wed Jun 07 08:45:35 2017 +0000
+++ b/F7_TSKeypad_MultiKey.h	Tue Jun 20 12:00:18 2017 +0000
@@ -93,7 +93,7 @@
     uint8_t state, btnsize;
     int OK; 
     uint32_t Bckclr, Txtclr;
-    uint8_t correcttouch, button;
+    uint8_t correcttouch, button, key;
     uint16_t frstprsx, frstprsy;
     char keypressed;
     int a, b, recv;