Changes done in ECG and BT

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of merged_code2_20sept_2017_4th_oct_2017 by nikita teggi

Files at this revision

API Documentation at this revision

Comitter:
nikitateggi
Date:
Wed Sep 20 11:02:08 2017 +0000
Parent:
52:7d9ff7781bdc
Child:
54:f2a413d5dffd
Commit message:
Merged code 2. Includes debug option(sd read, sd erase), lpf, modifications on bluetooth part and PID tracking (as suggested on saturday )

Changed in this revision

display_modules.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
sdcard.cpp Show annotated file Show diff for this revision Revisions of this file
touch_modules.cpp Show annotated file Show diff for this revision Revisions of this file
touch_modules.h Show annotated file Show diff for this revision Revisions of this file
--- a/display_modules.cpp	Wed Sep 20 10:33:17 2017 +0000
+++ b/display_modules.cpp	Wed Sep 20 11:02:08 2017 +0000
@@ -119,21 +119,24 @@
     TFT.foreground(Black);
     TFT.fillrect( 10,130,100,200,GreenYellow);
     TFT.locate(38,160) ;                                                              //changed from 30 to 38 //rashmi 24/7/17            //changed from 40 to 30 //rashmi 22/7/17     
-    TFT.printf("BT") ;                                                              ////changed from BLE to BT //rashmi 24/7/17
+    TFT.printf("BT") ; 
+TFT.fillrect( 130,130,220,200,GreenYellow); 
+    TFT.locate(140,160) ;                               //changed from 135 to 145 //rashmi 22/7/17 //
+    TFT.printf("P-Inf") ; 
+   TFT.fillrect( 10,215,100,285,GreenYellow);
+    TFT.locate(10,245) ;                                //changed from 26 to 22 //rashmi 24/7/17            //changed from 30 to 26 //rashmi 22/7/17
+    TFT.printf("HOME") ;   
+    
+                                                                 ////changed from BLE to BT //rashmi 24/7/17
     if ((read_debug_status()== 1) && get_timer_debug()<TIMER_ENABLE_DEBUG_MODE)     // checking for the debug status and timer 
     {
-        TFT.fillrect( 130,130,220,200,GreenYellow);
-        TFT.locate(150,140) ;                                                        //changed from 135 to 145 //rashmi 22/7/17 //
+         TFT.fillrect(130,215,220,285,GreenYellow);
+        TFT.locate(150,230) ;        
         TFT.printf("DE-") ; 
-        TFT.locate(145,170) ;                                                       //changed from 135 to 145 //rashmi 22/7/17 //
-        TFT.printf("BUG");                                                          //changed from ERASE to DEL //rashmi 22/7/17
+        TFT.locate(145,260) ;        
+        TFT.printf("BUG") ;                                                        //changed from ERASE to DEL //rashmi 22/7/17
     }    
-    TFT.fillrect( 10,215,100,285,GreenYellow);
-    TFT.locate(22,245) ;                                                            //changed from 26 to 22 //rashmi 24/7/17            //changed from 30 to 26 //rashmi 22/7/17
-    TFT.printf("P-Inf") ;    
-    TFT.fillrect(130,215,220,285,GreenYellow);
-    TFT.locate(130,245) ;        
-    TFT.printf("HOME") ;    
+   
     TFT.BusEnable(false) ;
     backlight = 1 ;
  }                  
--- a/main.cpp	Wed Sep 20 10:33:17 2017 +0000
+++ b/main.cpp	Wed Sep 20 11:02:08 2017 +0000
@@ -31,8 +31,7 @@
 uint8_t display(uint8_t state1);                                            //  display state
 
 static uint8_t nstate=0;
-static uint8_t nstate1=0;
-static uint32_t pid = 0;                                                    // patient ID
+static uint8_t nstate1=0;                                                  
 static bool file_created_status = false;                                  //initialise file created to 0
 static uint32_t filepid_btpid[2] = {};
 Timer timer_bt;                                                         // timer for bluetooth 
@@ -58,7 +57,6 @@
     gc.baud(115200);
     blue1.baud(115200);
     init_screen();                                                              //initialize lcd
-    pid = get_filepid();
     screen_main();                                                              // display of main screen 
     battery_monitor();                                                          // monitor battery at the start only
     battery_status_display();                                                   // display of main screen
@@ -319,7 +317,7 @@
     static uint8_t ecg_flag=0;                                  // ecg_flag to indicate the ecg test is already done for the same pid
     static uint8_t glc_flag=0;                                  // glc_flag to indicate the glc test is already done for the same pid
     uint16_t heart_rate=0; 
-  
+    static uint32_t pid = 0;                                                    // patient ID
     
     switch(state1)                                              // state for display screens
     {
@@ -334,9 +332,8 @@
                 ecg_flag=0;                                     // ecg, glc flag to determine whether the readings are taken more than once
                 glc_flag=0;
                 clear_filecreated_status();
-                pid = get_filepid();
                 battery_status_display();                          //Display battery status on LCD
-              //  debug_mode = 0;
+                pid = get_filepid() + 1;
                 EnableTouch();
                 break;
       
--- a/sdcard.cpp	Wed Sep 20 10:33:17 2017 +0000
+++ b/sdcard.cpp	Wed Sep 20 11:02:08 2017 +0000
@@ -541,7 +541,7 @@
 void sd_read(uint32_t  *pid_btpid)          //reading the data from the openend file
  {
     FILE *fp;
-    uint32_t pid[2]={1,1};
+    uint32_t pid[2]={0,0};
     fp= fopen("/sd/pid_info.txt","r");
      if (fp==NULL)
     {
@@ -569,7 +569,7 @@
 void delete_sdcard(void)
 {
     FILE *fp;
-    uint32_t pid[2] = {1,1};
+    uint32_t pid[2] = {0,0};
     fp= fopen("/sd/pid_info.txt","w");
     fwrite(&pid, sizeof(uint32_t),2,fp);
     fclose(fp);
--- a/touch_modules.cpp	Wed Sep 20 10:33:17 2017 +0000
+++ b/touch_modules.cpp	Wed Sep 20 11:02:08 2017 +0000
@@ -102,26 +102,27 @@
                           state = 12;
                         }
                         
+                    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;
+                         
+                       }
+                else if ( ((xt >= HOME_SYS_CONFIG_X_MIN) && (xt <= HOME_SYS_CONFIG_X_MAX)) && ( (yt >= HOME_SYS_CONFIG_Y_MIN) && (yt <= HOME_SYS_CONFIG_Y_MAX) ) ) // home
+                       {
+                                 state=1;       
                         
+                       }
+                           
                 else if ((read_debug_status()== 1) && get_timer_debug()<TIMER_ENABLE_DEBUG_MODE)                                                                              // checking for the debug status and timer 
                     {
-                        if ( ((xt >=DELETE_MAIN_X_MIN) && (xt<=DELETE_MAIN_X_MAX)) && ( (yt>=DELETE_MAIN_Y_MIN) && (yt<=DELETE_MAIN_Y_MAX) ) )                          // DELETE
+                        if ( ((xt >= DEBUG_MAIN_X_MIN) && (xt <= DEBUG_MAIN_X_MAX)) && ( (yt >= DEBUG_MAIN_Y_MIN) && (yt <= DEBUG_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;
-                         
-                       }
-                 else if ( ((xt >=HOME_MAIN_X_MIN) && (xt<=HOME_MAIN_X_MAX)) && ( (yt>=HOME_MAIN_Y_MIN) && (yt<=HOME_MAIN_Y_MAX) ) ) // home
-                       {
-                                 state=1;       
-                        
-                       }
+                 
                    else 
                      state=10; 
                      
--- a/touch_modules.h	Wed Sep 20 10:33:17 2017 +0000
+++ b/touch_modules.h	Wed Sep 20 11:02:08 2017 +0000
@@ -21,21 +21,26 @@
 #define BT_MAIN_Y_MIN 50
 #define BT_MAIN_Y_MAX 130
 
-#define DELETE_MAIN_X_MIN 110           //ERASE_MAIN CHANGED TO DELETE_MAIN 21/07/17
-#define DELETE_MAIN_X_MAX 145
-#define DELETE_MAIN_Y_MIN 180
-#define DELETE_MAIN_Y_MAX 260
+#define PATIENT_INFO_MAIN_X_MIN  110                                            //ERASE_MAIN CHANGED TO DELETE_MAIN 21/07/17
+#define PATIENT_INFO_MAIN_X_MAX 145
+#define PATIENT_INFO_MAIN_Y_MIN 180
+#define PATIENT_INFO_MAIN_Y_MAX 260
 
-#define PATIENT_INFO_MAIN_X_MIN 60     //FILE CHANGED TO PATIENT_INFO 21/07/17
-#define PATIENT_INFO_MAIN_X_MAX 90
-#define PATIENT_INFO_MAIN_Y_MIN 50
-#define PATIENT_INFO_MAIN_Y_MAX 130
+#define HOME_SYS_CONFIG_X_MIN 60                                                     
+#define HOME_SYS_CONFIG_X_MAX 90
+#define HOME_SYS_CONFIG_Y_MIN 50
+#define HOME_SYS_CONFIG_Y_MAX 130
 
 #define HOME_MAIN_X_MIN 60
 #define HOME_MAIN_X_MAX 90
 #define HOME_MAIN_Y_MIN 180
 #define HOME_MAIN_Y_MAX 260
 
+#define DEBUG_MAIN_X_MIN 60
+#define DEBUG_MAIN_X_MAX 90
+#define DEBUG_MAIN_Y_MIN 180
+#define DEBUG_MAIN_Y_MAX 260
+
 #define BG_MAIN_X_MIN 110
 #define BG_MAIN_X_MAX 140
 #define BG_MAIN_Y_MIN 50