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:
nidhinvarghese
Date:
Wed May 03 05:32:37 2017 +0000
Parent:
9:d0ecb61d219e
Child:
11:9a6545c2eb5d
Commit message:
May2_2017(Nidhin); Stores 2 file data to 1 bp file and delete 2 Temp File.; BP value rounded Result displayed as int.

Changed in this revision

bp.cpp 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
sdcard.cpp Show annotated file Show diff for this revision Revisions of this file
sdcard.h Show annotated file Show diff for this revision Revisions of this file
--- a/bp.cpp	Fri Apr 28 10:40:36 2017 +0000
+++ b/bp.cpp	Wed May 03 05:32:37 2017 +0000
@@ -356,5 +356,7 @@
     DBP = (0.0494*PWV + 17.480)+10;
     
     screen_bp1(SBP,DBP);
+    
+    create_single_BPfile(pid);
  
  }
\ No newline at end of file
--- a/display_modules.cpp	Fri Apr 28 10:40:36 2017 +0000
+++ b/display_modules.cpp	Wed May 03 05:32:37 2017 +0000
@@ -212,10 +212,10 @@
         char buf[10];  
         TFT.fillrect(3,130,200,200,White);
          TFT.fillrect(60,230,180,300,White);
-        sprintf (buf, "SBP: %.2f   ",SBP);          // changed to display 2 digits after decimal point
+        sprintf (buf, "SBP: %.0f   ",SBP);          // changed to display 2 digits after decimal point, 2May'17 Changed to Integer
         TFT.locate(5,100) ;
     TFT.printf(buf) ; 
-         sprintf (buf, "DBP: %.2f",DBP);           // changed to display 2 digits after decimal point
+         sprintf (buf, "DBP: %.0f",DBP);           // changed to display 2 digits after decimal point, 2May'17, Changed to integer
           TFT.locate(5,150) ;
         TFT.printf(buf) ;
         TFT.fillrect(60,230,180,300,Green);
--- a/sdcard.cpp	Fri Apr 28 10:40:36 2017 +0000
+++ b/sdcard.cpp	Wed May 03 05:32:37 2017 +0000
@@ -370,7 +370,68 @@
     fclose (fpppg);
     return ppgloc;
  } 
-
+ 
 //fread(buffer, 1, size, fp)
 //fwrite(&buffer, ,   
- //----------------------------------------------------28/4/2017---------------------------------
\ No newline at end of file
+ //----------------------------------------------------28/4/2017---------------------------------
+ //----------------------------------------------------------------------------------------------
+ 
+ 
+ 
+  //------- FUNCTION TO CREATE SINGLE BP FILE --------2/5/2017 (NIDHIN)---------------//
+ void create_single_BPfile(int pid)
+{
+    
+    //int ecgbuf[64] = {0};
+    //uint32_t ppgbuf[64] = {0};
+    
+    char buffer3[32];
+    sprintf(buffer3, "/sd/%d_BP.csv", pid);
+    fp = fopen(buffer3, "a");
+
+    //buffer1[32] = ""; 
+    sprintf(buffer3, "/sd/%d_BP_ECG.csv", pid);
+    fpecg = fopen(buffer3, "r");
+
+    //char buffer1[32] = "";
+    sprintf(buffer3, "/sd/%d_BP_PPG.csv", pid);
+    fpppg = fopen(buffer3, "r");
+
+    for(int i=0; i<16; i++)
+    {
+    int ecgbuf[64] = {0} ;
+    fread(ecgbuf, sizeof(int), 64, fpecg);
+    fwrite(ecgbuf, sizeof(int), 64, fp);
+    }
+
+    for(int i=0; i<26; i++)
+    {
+    int ppgbuf[64] = {0} ;
+    fread(ppgbuf, sizeof(int), 64, fpppg);
+    fwrite(ppgbuf, sizeof(int), 64, fp);
+    }
+
+    fclose(fpecg);
+    fclose(fpppg);
+    fclose(fp);
+
+    //char buffer1[32] = "";
+    int status = 0 ;
+    sprintf(buffer3, "/sd/%d_BP_ECG.csv", pid);
+    status = remove(buffer3);
+
+    if( status == 0 )
+        snd.printf("\nECG file delete : Successful");
+    else 
+        snd.printf("\nECG file delete : UnSuccessful");
+
+    //char buffer1[32] = "";
+    status = 0 ;
+    sprintf(buffer3, "/sd/%d_BP_PPG.csv", pid);
+    status = remove(buffer3);
+
+    if( status == 0 )
+        snd.printf("\nPPG file delete : Successful");
+    else 
+        snd.printf("\nPPG file delete : UnSuccessful");
+}
\ No newline at end of file
--- a/sdcard.h	Fri Apr 28 10:40:36 2017 +0000
+++ b/sdcard.h	Wed May 03 05:32:37 2017 +0000
@@ -41,6 +41,8 @@
 int sd_BP_PPGMAX(int pid);
 //void sd_close1();
 
+void create_single_BPfile(int pid); //Function to create 1 file from 2 temp BP file (ECG &PPG)
+
 #endif 
 
 //----------------------------------------------------28/4/2017------------------------ 
\ No newline at end of file