version with updated libs

Dependencies:   F7_Ethernet mbed MbedJSONValue LCD_DISCO_F746NG mbed-rtos BSP_DISCO_F746NG CANMsg NetworkAPI SDFileSystem_Warning_Fixed GroveStreamsmodified LcdDiscoF746NgTracer JSON

Branch:
jpa
Revision:
5:ceefd0cfa233
Parent:
3:2de8e4771674
Child:
10:41aff2b7acc6
--- a/touchScreenJPA.cpp	Wed Sep 02 14:43:31 2020 +0000
+++ b/touchScreenJPA.cpp	Wed Sep 02 17:07:55 2020 +0000
@@ -4,6 +4,7 @@
 #include "mbed.h"
 #include "GroveStreams.h"
 #include "MbedJSONValue.h"
+Timer    timer_touch[16];
 
 int initDisplayTemp();
 
@@ -43,7 +44,10 @@
         BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
         //BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE);
         }  
-    
+    int tt = 0;
+    for (tt=0;tt<16;tt++) 
+        {if(timer_touch[tt].read_ms() > 500) 
+            {timer_touch[tt].stop();timer_touch[tt].reset();}}
     return 0;   
     }
 
@@ -121,7 +125,10 @@
     static uint8_t cleared = 0;
     uint8_t prev_nb_touches = 0;
     
-     
+        int tt = 0;
+        for (tt=0;tt<16;tt++) 
+            {if(timer_touch[tt].read_ms() > 200) 
+                {timer_touch[tt].stop();timer_touch[tt].reset();}}
         //touch screen
         BSP_TS_GetState(&TS_State);
         if (TS_State.touchDetected) {
@@ -150,10 +157,14 @@
             if ((TS_State.touchY[0] > 160) && (TS_State.touchY[0] < (160+80)))
                 {
                 int numTouche = 0;
-                if ((TS_State.touchX[0] > 10) && (TS_State.touchX[0]  < (10+100)))  {numTouche = 1;}
-                if ((TS_State.touchX[0] > 130) && (TS_State.touchX[0] < (130+100))) {numTouche = 2;}
-                if ((TS_State.touchX[0] > 250) && (TS_State.touchX[0] < (250+100))) {numTouche = 3;}
-                if ((TS_State.touchX[0] > 370) && (TS_State.touchX[0] < (370+100))) {numTouche = 4;}
+                if ((TS_State.touchX[0] > 10) && (TS_State.touchX[0]  < (10+100)))  
+                    {if(timer_touch[0].read_ms() == 0) {numTouche = 1;timer_touch[0].start();}}
+                if ((TS_State.touchX[0] > 130) && (TS_State.touchX[0] < (130+100))) 
+                    {if(timer_touch[1].read_ms() == 0) {numTouche = 2;timer_touch[1].start();}}
+                if ((TS_State.touchX[0] > 250) && (TS_State.touchX[0] < (250+100))) 
+                    {if(timer_touch[2].read_ms() == 0) {numTouche = 3;timer_touch[2].start();}}
+                if ((TS_State.touchX[0] > 370) && (TS_State.touchX[0] < (370+100))) 
+                    {if(timer_touch[3].read_ms() == 0) {numTouche = 4;timer_touch[3].start();}}
                 if (numTouche >0) 
                     {
                     printf("Touche : %d", numTouche);