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

Files at this revision

API Documentation at this revision

Comitter:
suhasini
Date:
Thu Mar 30 11:34:04 2017 +0000
Parent:
4:6bd81bb1790d
Commit message:
PID updation possible, Proper screen navigation enabled, Return functionality from BP to main screen-done, date-time format modified, BP data not saved into SD card

Changed in this revision

bp.cpp Show annotated file Show diff for this revision Revisions of this file
bp.h Show annotated file Show diff for this revision Revisions of this file
display_modules.cpp Show annotated file Show diff for this revision Revisions of this file
glc.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
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/bp.cpp	Wed Mar 01 18:49:33 2017 +0000
+++ b/bp.cpp	Thu Mar 30 11:34:04 2017 +0000
@@ -24,10 +24,10 @@
 
  
     
-int bp() {
+void bp() {
  
 //------------------BP ADD------------------------------//{ 
-int location; // BP ADD
+//int location; // BP ADD
 int32_t n_red_buffer_length = 1500;    //data length
 uint32_t aun_red_buffer[1500];    //Red LED sensor data, set to 500
 uint32_t red_value;
@@ -38,12 +38,12 @@
 float SBP, DBP, PWV, delta_t;
 int d = 210;
 
-uint32_t un_min, un_max, un_prev_data, ecg_min, ecg_max ;  //variables to calculate the on-board LED brightness that reflects the heartbeats
-    int i, j;
+uint32_t un_min, un_max, ecg_min, ecg_max ;  //variables to calculate the on-board LED brightness that reflects the heartbeats
+    //int i, j;
     float ecg_location, ppg_location; 
-    int32_t n_brightness;
+    //int32_t n_brightness;
     
-    n_brightness=0;
+   // n_brightness=0;
     un_min=0x3FFFF;
     un_max=0;
     ecg_min = 0xFFFFFF;
@@ -57,8 +57,8 @@
 //uint32_t ecg_buf[1500];
 //int32_t ecg_der[1500];
 //int buff1[15]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-int32_t sample_sum; // static int32_t avg[1500];
- int32_t count = 0; int32_t fs = 500; int32_t w=0,w1=0;
+//int32_t sample_sum; // static int32_t avg[1500];
+ //int32_t count = 0; int32_t fs = 500; int32_t w=0,w1=0;
 
    unsigned char chk = 1;
     bc.baud(baud_rate);
@@ -180,7 +180,7 @@
 
 
 //-----------------WRITE ECG &PPG
-   
+ /*  
 sd_open_BPfile(1);
 for (int w=0; w < 1000; w++)
 {
@@ -195,7 +195,7 @@
 red_value =  aun_red_buffer[w];   
 sd_write(red_value); 
 }
-sd_close();
+sd_close();*/
 
 //----------- FINISHED WRITING ECG & PPG TO SD CARD
 
--- a/bp.h	Wed Mar 01 18:49:33 2017 +0000
+++ b/bp.h	Thu Mar 30 11:34:04 2017 +0000
@@ -2,7 +2,7 @@
 #define BP_H_
 
 
-int bp();
+void bp();
 #endif
 
 
--- a/display_modules.cpp	Wed Mar 01 18:49:33 2017 +0000
+++ b/display_modules.cpp	Thu Mar 30 11:34:04 2017 +0000
@@ -23,7 +23,8 @@
          lcd.ClearScreen();
          lcd.SetFont(&TerminusFont);
          epoch_time=rtc_read();                           // read the time from rtc module
-         sprintf(buff1 ,"%s", ctime(&epoch_time));        // display time on LCD
+        // sprintf(buff1 ,"%s", ctime(&epoch_time));        // display time on LCD
+        strftime(buff1, 32, "%d/%m/%Y         %H:%M",localtime(&epoch_time));
          lcd.Print( buff1,20,100,COLOR_YELLOW,COLOR_BLACK, 0);
             lcd.SetFont(&TerminusBigFont);
             lcd.Print( "SENSESEMI",50,20,COLOR_WHITE,COLOR_BLACK, 0);
@@ -43,7 +44,7 @@
      
      char buff2[10];
         
-                lcd.FillRect(5,10,250,120,COLOR_BLACK); 
+                lcd.FillRect(5,20,250,150,COLOR_BLACK); 
                //lcd.Print( "SenseSmart", CENTER, 95);
                 sprintf(buff2 ,"%d", pid);
                 lcd.Print( "PATIENT ID",20,50,COLOR_YELLOW,COLOR_BLACK, 0);
--- a/glc.cpp	Wed Mar 01 18:49:33 2017 +0000
+++ b/glc.cpp	Thu Mar 30 11:34:04 2017 +0000
@@ -149,7 +149,8 @@
      while((!t_s_d) && (!test_strip))
       {
         
-         // gtc.printf("%d\n", data1n);
+          gtc.printf("%d\n", data1n);
+          gtc.printf("%d\n", data2n);
         if ((daata1 >= THRESHOLD) || (data2 >= THRESHOLD)) 
             { 
                 t_s_d = 1;
--- a/main.cpp	Wed Mar 01 18:49:33 2017 +0000
+++ b/main.cpp	Thu Mar 30 11:34:04 2017 +0000
@@ -84,7 +84,7 @@
                 break;
                 
      case 7: 
-                state1=touch_again();     // determining the touch when readings are taken more than once screen 
+                state1=touch_again_ecg();     // determining the touch when readings are taken more than once screen 
                 state=0;
                 nstate1=state1;
                 break;
@@ -95,14 +95,24 @@
                 nstate1=state1;
                 break;           
                 
-                
+     case 9:    state1=touch_again_glc();  
+                state=0;
+                nstate1=state1;
+                break;            
                 
      case 10 :  DisableTouch();
                  wait_ms(300);
                  EnableTouch();
                  state=nstate;
                   break;
-                
+                  
+                  
+      case 11:   state1=touch_again_bp();            
+                 state=0;
+                 nstate1=state1;
+                 break;
+      
+      
      default :  DisableTouch();
                  wait_ms(300);
                  EnableTouch();
@@ -170,7 +180,7 @@
                {
                   screen_again();    
                  state1=0;
-                 state=7;
+                 state=9;
                  nstate=state;
                  }
             else
@@ -247,7 +257,7 @@
                 EnableTouch();
                  break;*/
         
-     case 11: 
+     case 9: 
                 DisableTouch();
                 screen_bp2();      // bp main screen
                 bp();              // measuring bp   
--- a/touch_modules.cpp	Wed Mar 01 18:49:33 2017 +0000
+++ b/touch_modules.cpp	Thu Mar 30 11:34:04 2017 +0000
@@ -152,7 +152,7 @@
     
                  else if ( ((xt >=70) && (xt<=170)) && ( (yt>=90) && (yt<=140) ) ) // RETURN
                       {
-                         //  state=2;
+                          state=3;
                  } 
                else 
                      state=10;   
@@ -187,12 +187,12 @@
                 if ( ((xt >=70) && (xt<=170)) && ( (yt>= 140) && (yt<= 195) ) ) // START
                        {
                           
-                          state=11;
+                          state=9;
                         }
     
                  else if ( ((xt >=70) && (xt<=170)) && ( (yt>=90) && (yt<=140) ) ) // RETURN
                       {
-                         //  state=2;
+                          state=3;
                  } 
                 else 
                      state=10;
@@ -214,7 +214,7 @@
     
                  else if ( ((xt >=70) && (xt<=170)) && ( (yt>=85) && (yt<=140) ) ) // RETURN
                       {
-                          // state=2;
+                           state=3;
                  }  
             else 
                   state=10;
@@ -224,7 +224,7 @@
       
  
  
- unsigned char touch_again()    //determining the touch for Repeat test 
+ unsigned char touch_again_ecg()    //determining the touch for Repeat test 
 {
     
     unsigned char state;
@@ -245,6 +245,46 @@
     }
  
  
+ unsigned char touch_again_glc()    //determining the touch for Repeat test 
+{
+    
+    unsigned char state;
+        
+                    if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // YES
+                      {
+                                state=7;
+                         
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // NO
+                       {
+                                 state=3;
+                        
+                       }
+                   else 
+                     state=10; 
+         return state;     
+    }
+    
+   unsigned char touch_again_bp()    //determining the touch for Repeat test 
+{
+    
+    unsigned char state;
+        
+                    if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // YES
+                      {
+                                state=9;
+                         
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // NO
+                       {
+                                 state=3;
+                        
+                       }
+                   else 
+                     state=10; 
+         return state;     
+    } 
+ 
  
  
  //TOUCH Functionalities//    
--- a/touch_modules.h	Wed Mar 01 18:49:33 2017 +0000
+++ b/touch_modules.h	Thu Mar 30 11:34:04 2017 +0000
@@ -18,6 +18,8 @@
 unsigned char touch_ecg();
 unsigned char touch_bp();
 unsigned char touch_ret();
- unsigned char touch_again();
+ unsigned char touch_again_ecg();
+ unsigned char touch_again_glc(); 
+  unsigned char touch_again_bp(); 
  void screen_bp2();
 #endif
\ No newline at end of file