created separate function for hex to char

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of SS_SensePOC2P0_11Dec2017_USERPID by rashmi v

Revision:
49:3ff80c4bc1be
Parent:
41:1141a75eacc4
Child:
51:1a4693774b60
--- a/touch_modules.cpp	Fri Sep 15 07:38:47 2017 +0000
+++ b/touch_modules.cpp	Fri Sep 15 19:44:48 2017 +0000
@@ -3,6 +3,7 @@
 //#include "ili9325.h"
 #include "display_modules.h"
 #include "touch_modules.h"
+#include "main.h"
 //InterruptIn Touch_D(PTD6);
 InterruptIn Touch_D(PTD2);
 int i;
@@ -15,14 +16,14 @@
  {
             xt = (X_MAX*readTouchX()/TOTAL1);
             yt = (Y_MAX*readTouchY()/TOTAL1);
-            kc.printf("%d\n", xt); 
-              kc.printf("%d\n", yt); 
+            //kc.printf("%d\n", xt); 
+            //  kc.printf("%d\n", yt); 
  }
 
 
 void detect_touch(unsigned char display_state)   // detect the touch //debounce
 {
-kc.printf("display state=%d\n",display_state);
+//kc.printf("display state=%d\n",display_state);
 uint32_t time_ms=0;
 switch (display_state)
 
@@ -98,15 +99,16 @@
                   if ( ((xt >=BT_MAIN_X_MIN) && (xt<=BT_MAIN_X_MAX)) && ( (yt>= BT_MAIN_Y_MIN) && (yt<=BT_MAIN_Y_MAX) ) ) // ble
                        {
                           
-                          state=12;
+                          state = 12;
                         }
-    
-                 else if ( ((xt >=DELETE_MAIN_X_MIN) && (xt<=DELETE_MAIN_X_MAX)) && ( (yt>=DELETE_MAIN_Y_MIN) && (yt<=DELETE_MAIN_Y_MAX) ) ) // DELETE
-                      {
-                          // state=4;
-                        
-                          
-                       }
+                if (read_debug_status()== 1)
+                    {
+                        if ( ((xt >=DELETE_MAIN_X_MIN) && (xt<=DELETE_MAIN_X_MAX)) && ( (yt>=DELETE_MAIN_Y_MIN) && (yt<=DELETE_MAIN_Y_MAX) ) ) // DELETE
+                            {
+                           state=13;
+                            }
+                    }
+                    
                  else if ( ((xt >=PATIENT_INFO_MAIN_X_MIN) && (xt<=PATIENT_INFO_MAIN_X_MAX)) && ( (yt>=PATIENT_INFO_MAIN_Y_MIN) && (yt<=PATIENT_INFO_MAIN_Y_MAX) ) ) // file
                       {
                                 state=11;
@@ -367,63 +369,40 @@
                      state=10;
            
            return state;
-    } 
- 
- //TOUCH Functionalities for old display//    
+}
 
-/*int readTouchY(void)      // read the Y co-ordinate
-{      
-    DigitalOut YD(PTD6);
-     DigitalIn XL(PTD7);
-     DigitalOut YU(PTC0);
-     YU = 1;
-     YD = 0;
-     AnalogIn XR(PTB0);
-     XL.mode(PullNone);
-     return XR.read_u16();
-}
+unsigned char touch_debug()
+{
+    unsigned char state=0;
     
     
-int readTouchX(void)    // // read the X co-ordinate
-{
-    DigitalOut XR(PTB0);
-    DigitalIn YD(PTD6);
-     DigitalOut XL(PTD7);
-     
-     XR = 1;
-     XL = 0;
-     AnalogIn YU(PTC0);
-     YD.mode(PullNone);
-     return YU.read_u16();
-}
-
-void EnableTouch(void)       // Enable touch 
-{
+    if ( ((xt >= SD_DEL_X_MIN) && (xt <= SD_DEL_X_MAX)) && ( (yt >= SD_DEL_Y_MIN) && (yt <= SD_DEL_Y_MAX) ) ) //fasting     // 12/06/17       newly added
+    {
+        state = 14 ; 
+    }
+    
+    else if ( ((xt >= SD_READ_X_MIN) && (xt <= SD_READ_X_MAX)) && ( (yt >= SD_READ_Y_MIN) && (yt <= SD_READ_Y_MAX) ) ) // pp
+    {
+       state = 15;
     
-    DigitalIn YD(PTD6);
-    DigitalOut XL(PTD7);
-    DigitalIn YU(PTC0);
-    DigitalIn XR(PTB0);
-     XL=0;
-      YD.mode(PullUp);
-     YU.mode(PullNone);
-     XR.mode(PullNone);
-    i=1;
-    Touch_D.fall(&touch1);
-    Touch_D.enable_irq();
-   
- }
-
-void DisableTouch (void)    // Disable touch 
-{
-    Touch_D.disable_irq();
-    i=0;
-    DigitalOut YD(PTD6);
-    DigitalOut XL(PTD7);
-    DigitalOut YU(PTC0);
-    DigitalOut XR(PTB0);
+    }
+    else if ( ((xt >= Z_X_MIN) && (xt <= Z_X_MAX)) && ( (yt >= Z_Y_MIN) && (yt <= Z_Y_MAX) ) ) // random
+    {
+        //state = ;
+    }
+    else if ( ((xt >= DEBUG_BACK_X_MIN) && (xt <= DEBUG_BACK_X_MAX)) && ( (yt >= DEBUG_BACK_Y_MIN) && (yt <= DEBUG_BACK_Y_MAX) ) ) // return
+    {
+        state = 2 ;         
     }
- */
+    
+    else 
+        state=10;
+    
+    return state;
+    
+} 
+ 
+ 
  
  
  //TOUCH Functionalities for new display//