Updated with option to return from BP screen to main screen, resolved screen navigation issues

Dependencies:   SDFileSystem TFTLCD_8bit ds3231 program mbed

Fork of poc_dis_5 by SenseSemi

Revision:
1:8316c23ec6b9
Parent:
0:c47fb0c1bbf6
Child:
3:9a06c2bed650
--- a/touch_modules.cpp	Tue Dec 27 10:30:48 2016 +0000
+++ b/touch_modules.cpp	Mon Jan 30 07:45:41 2017 +0000
@@ -7,13 +7,16 @@
 int i;
 unsigned int xt;
 unsigned int yt;
-
+Serial kc(USBTX, USBRX);
 
 
 void touch1()  //determining the touch co-ordinates
 {
    xt = (X_MAX*readTouchX()/TOTAL1);
             yt = (Y_MAX*readTouchY()/TOTAL1);
+            kc.printf("%d\n", xt);
+              kc.printf("%d\n", yt);
+            
     }
 
 
@@ -31,9 +34,12 @@
              break;
             }
          DisableTouch(); 
-               
+          //kc.printf("touch");
+           
          }
  }
+ 
+  
   }
 
 
@@ -43,65 +49,134 @@
     
     unsigned char state;
         
+                  if ( ((xt >=70) && (xt<=170)) && ( (yt>= 140) && (yt<= 195) ) ) // system configuration
+                       {
+                          
+                          state=2;
+                        }
+    
+                 else if ( ((xt >=70) && (xt<=170)) && ( (yt>=80) && (yt<=140) ) ) // test
+                      {
+                           state=3;
+                 }   
+                 else 
+                     state=10;   
+                          
+         return state;     
+    }
+   
+   
+unsigned char touch_main_1()    //determining the touch for home screen
+{
+    
+    unsigned char state;
+        
+                  if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) // ble
+                       {
+                          
+                         // state=3;
+                        }
+    
+                 else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) // erase
+                      {
+                          // state=4;
+                        
+                          
+                       }
+                 else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // file
+                      {
+                               // state=5;
+                         
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // home
+                       {
+                                 //state=6;
+                        
+                       }
+                   else 
+                     state=10;     
+                   
+         return state;     
+    }
+
+unsigned char touch_main_2()    //determining the touch for home screen
+{
+    
+    unsigned char state;
+        
                   if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) // GLC
                        {
                           
-                          state=1;
+                          state=4;
                         }
     
                  else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) // ECG
                       {
-                           state=2;
+                           state=5;
                         
                           
                        }
                  else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // BP
                       {
-                                state=3;
+                                //state=5;
                          
                        }
-                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // SET
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // Home
                        {
-                                 state=4;
+                                 state=1;
                         
                        }
                    
+                else 
+                     state=10;
+                   
          return state;     
     }
-   
-   
+
+
+
+
+
 
 unsigned char touch_ecg()     // determining the touch for ecg screen
 {
       
       unsigned char state;
-if ( ((xt >=28) && (xt<=125)) && ( (yt>= 225) && (yt<= 285) ) ) // home screen 
-                            {
-                                
-                                state=5;
-                            }
-         
-                      if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) // SET
-                            {
-                               state=6;
-                               
-                            }
-         
-                    else if ( ((xt >=150) && (xt<=195)) && ( (yt>= 80) && (yt<= 190) ) ) // start
-                            {
-                                 state=7;
-                             }
-      
-                    else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // history
-                            {
-                              state=8;
-      
-                             }
-                
+                 if ( ((xt >=70) && (xt<=170)) && ( (yt>= 140) && (yt<= 195) ) ) // GLC
+                       {
+                          
+                          state=8;
+                        }
+    
+                 else if ( ((xt >=70) && (xt<=170)) && ( (yt>=90) && (yt<=140) ) ) // ECG
+                      {
+                         //  state=2;
+                 } 
+               else 
+                     state=10;   
+                                   
            return state;
     }
     
 
+unsigned char touch_ret()     // determining the touch for ecg screen
+{
+      
+      unsigned char state;
+                 
+    
+            if ( ((xt >=70) && (xt<=170)) && ( (yt>=85) && (yt<=140) ) ) // ECG
+                      {
+                           state=3;
+                 } 
+              
+              else 
+                     state=10;                      
+           return state;
+    }
+    
+
+
 
 unsigned char touch_bp()   // //determining the touch for bp screen
 
@@ -136,7 +211,8 @@
                                  state=5;
                         
                        }
-    
+                 else 
+                     state=10;
            
            return state;
     }
@@ -146,41 +222,49 @@
 unsigned char touch_glc()        ////determining the touch for home screen
     {
         unsigned char state;
-if ( ((xt >=28) && (xt<=125)) && ( (yt>= 225) && (yt<= 285) ) ) 
-                       {
-                          state=1;
-                        }
-         
-                 else if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) 
+
+                if ( ((xt >=70) && (xt<=170)) && ( (yt>= 140) && (yt<= 195) ) ) // GLC
                        {
                           
-                          state=2;
-                      
+                          state=7;
                         }
     
-                 else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) 
-                      {
-                           state=3;
-                       
-                          
-                       }
-                 else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) )
+                 else if ( ((xt >=70) && (xt<=170)) && ( (yt>=85) && (yt<=140) ) ) // ECG
                       {
-                                state=4;
-                      
-                       }
-                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // SET
-                       {
-                                 state=5;
-                         
-                       }
-    
+                          // state=2;
+                 }  
+            else 
+                  state=10;
            
            return state;
     } 
       
-
-
+ 
+ 
+ unsigned char touch_again()    //determining the touch for home screen
+{
+    
+    unsigned char state;
+        
+                    if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // BP
+                      {
+                                state=8;
+                         
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // SET
+                       {
+                                 state=3;
+                        
+                       }
+                   else 
+                     state=10; 
+         return state;     
+    }
+ 
+ 
+ 
+ 
+     
 
 int readTouchY(void) {
     DigitalOut YD(PTD6);