Fix all the following issues which we faced during 01st April internal demo 1) Display hang and jump issue 2) Sequencing issue 3) Issue with BP code

Dependencies:   SDFileSystem ds3231 program mbed testUniGraphic_150217

Fork of Int_Demo_01Apr2017_newdisplaycode_bp_nikita by nikita teggi

sdcard.cpp

Committer:
nikitateggi
Date:
2017-02-10
Revision:
3:9a06c2bed650
Parent:
2:3b7b71bfc941
Child:
4:6bd81bb1790d

File content as of revision 3:9a06c2bed650:

 #include "mbed.h"
 #include <stdio.h>
 #include "SDFileSystem.h"
 #include "sdcard.h"
  #include "rtc.h"
  

  SDFileSystem sd(PTE1, PTE3, PTE2, PTE4, "sd");
  FILE *fp=NULL;

 void sd_open_GLCfile(int pid)
 {
     
  char buffer[32];
  char buffer1[32];
  time_t  epoch_time1;
  epoch_time1=rtc_read();
 // strftime(buffer, 32, "GLC_%s", pid);
  
 sprintf(buffer1,"/sd/%d_GLC.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"%s\n",ctime(&epoch_time1) );
  
 
 }   
 
  void sd_open_GLCfilee(int pid)
 {
     
  char buffer[32];
  char buffer1[32];
  time_t  epoch_time1;
  epoch_time1=rtc_read();
 // strftime(buffer, 32, "GLC_%s", pid);
  
 sprintf(buffer1,"/sd/%d_GLC.csv",pid);
  fp = fopen(buffer1,"a"); 
   fprintf(fp,"PATIENT ID %d\n",pid);
  
 
 } 
  void sd_open_ECGfile(int pid)
 {
     
 // char buffer[32];
  char buffer1[32];
  time_t  epoch_time1;
  epoch_time1=rtc_read();
  // strftime(buffer, 32, "ECG_%d", pid);
  
  sprintf(buffer1,"/sd/%d_ECG.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"%s\n",ctime(&epoch_time1) );
 // strftime(buffer, 32, "ECG_%d-%m-%Y_%H_%M",localtime(&epoch_time1));
 //  fprintf(fp,"%d\n",buffer ); 
 } 
 
  void sd_open_ECGfilee(int pid)
 {
     
 // char buffer[32];
  char buffer1[32];
  time_t  epoch_time1;
  epoch_time1=rtc_read();
  // strftime(buffer, 32, "ECG_%d", pid);
  
  sprintf(buffer1,"/sd/%d_ECG.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"PATIENT ID %d\n",pid );
 // strftime(buffer, 32, "ECG_%d-%m-%Y_%H_%M",localtime(&epoch_time1));
 //  fprintf(fp,"%d\n",buffer ); 
 } 
  void sd_open_BPfile(int pid)
 {
     
  char buffer[32];
  char buffer1[32];
  time_t  epoch_time1;
  epoch_time1=rtc_read();
  // strftime(buffer, 32, "ECG_%d", pid);
  
  sprintf(buffer1,"/sd/%d_BP.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"%s\n",ctime(&epoch_time1) );
 } 


 
 void sd_write (int value)
 {
  
  fprintf(fp,"%d\n", value); 
  }
  
  void sd_close()
  {
   fclose(fp);
   }