A keypad to retrieve a single key and then disipears

Files at this revision

API Documentation at this revision

Comitter:
Armand
Date:
Tue Jun 20 12:01:11 2017 +0000
Parent:
0:85ae7121f6d6
Commit message:
Fixed some bugs

Changed in this revision

F7_Keypad_SingleKey.h Show annotated file Show diff for this revision Revisions of this file
F7_TSKeypad_SingleKey.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/F7_Keypad_SingleKey.h	Tue Jun 06 13:58:55 2017 +0000
+++ b/F7_Keypad_SingleKey.h	Tue Jun 20 12:01:11 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;
--- a/F7_TSKeypad_SingleKey.cpp	Tue Jun 06 13:58:55 2017 +0000
+++ b/F7_TSKeypad_SingleKey.cpp	Tue Jun 20 12:01:11 2017 +0000
@@ -7,6 +7,7 @@
 {
     btnsize = 50;
     state = 0;
+    key = 0;
     
     status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
     if (status != TS_OK) 
@@ -201,6 +202,7 @@
                         {   
                             state = 15;
                             correcttouch = 1;
+                            key = button;
                             a = 3;
                             b = 3;
                         }
@@ -214,14 +216,14 @@
             }break;
             case 15:
             {  
-                if(correcttouch == 1)
+                if(button == key && button != 0)
                 {     
                     if(TS_State.touchDetected== 0)
                     {  
                         state = 20;                
                     }                    
                 }
-                else if(correcttouch == 0 && button == 0)
+                else if(button != key || button == 0)
                 {   
                     state = 30;
                 } 
@@ -373,7 +375,9 @@
                     recv = 0;
                     correcttouch = 0;
                     state = 0;
-                }                
+                }      
+                
+                key = 0;          
     
             }break; 
             case 30: