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

Revision:
20:7c64e6ecad76
Parent:
19:1650bbc923cc
Child:
21:7ef1b0b40841
--- a/bp.cpp	Fri Jun 09 17:12:21 2017 +0000
+++ b/bp.cpp	Sat Jun 17 09:36:18 2017 +0000
@@ -37,7 +37,7 @@
     
     uint8_t uch_dummy;
     uint32_t ppgdata; 
-
+    uint8_t lead_reg=0;
     //int dummyconcat = 700000;
     int concatenate_value2 = 0;
     unsigned char chk = 1;
@@ -134,7 +134,7 @@
 
     freqset();               // setting the frequency
     setupfunc();              
-    ecgsetupfunc();
+    lead_reg=ecgsetupfunc();    // lead contact // 14/06
         
     maxim_max30102_reset();  // PPG reset
     wait_ms(20);
@@ -155,6 +155,28 @@
         maxim_max30102_read_fifo(&ppgdata); 
             
     }   
+// BP Finger detect Function Added Nidhin 16/6/17 
+// START    
+ uint32_t un_max, un_min; // Declare two VARIABLE FOR MAX AND MIN
+ un_max = 0;
+un_min = 0x3FFF;
+       
+for(int i=0; i<500; i++)    // READS 500 SAMPLES TO SEE MAX AND MIN VAL DIFFERENCE
+{        
+maxim_max30102_read_reg(0,&uch_dummy);
+while(INTR.read()==1); 
+maxim_max30102_read_fifo(&ppgdata); 
+
+if(un_min>ppgdata)
+un_min=ppgdata;    //update signal min
+if(un_max<ppgdata)
+un_max=ppgdata; 
+
+}  
+
+if (((un_max -un_min) > 300) && (lead_reg==0)) // Checking for threshold 300 Added Nidhin 16/6/17
+
+{ //Added Nidhin 16/6/17
 
     sd_open_BPfilee(pid);
     sd_open_BP_ECGfile(pid) ; //   sd_open_BP_ECGfile(123) draft file for testing
@@ -253,7 +275,17 @@
     bpfile_mainfile(pid);
     
     screen_bp1(SBP,DBP);
-    
+  
+  }  //Added Nidhin 16/6/17  
+  
+  else  //Added Nidhin 16/6/17 
+  {     //Added Nidhin 16/6/17 
+    // Add display sequence for Finger detect fail  //Added Nidhin 16/6/17 
+    maxim_max30102_reset();
+    bpr.printf("no finger detect\n");
+      screen_ecg_lead_bp_fingerdetect();
+  }  //Added Nidhin 16/6/17 
+     screen_ecg_bp() ; 
     // Only for testing
- }
- 
\ No newline at end of file
+ //} //Commented Nidhin 16/6/17 
+} 
\ No newline at end of file