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

sdcard.cpp

Committer:
nikitateggi
Date:
2017-03-01
Revision:
4:6bd81bb1790d
Parent:
3:9a06c2bed650

File content as of revision 4:6bd81bb1790d:

 #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)     // opening the glc file
 {
     
  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) );  //writing the date, time into the file
  
 
 }   
 
  void sd_open_GLCfilee(int pid)    // only opening the glc file after entering TEST screen
 {
     

  char buffer1[32];
  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) );
 
 } 
 
  void sd_open_ECGfilee(int pid)          // only opening the ECG file after entering TEST screen
 {
     
  char buffer1[32];
   sprintf(buffer1,"/sd/%d_ECG.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"PATIENT ID %d\n",pid );
 
 } 
 
 
  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_open_BPfilee(int pid)          // only opening the BP file after entering TEST screen
 {
     
 
  char buffer1[32];
  sprintf(buffer1,"/sd/%d_BP.csv",pid);
  fp = fopen(buffer1,"a"); 
  fprintf(fp,"PATIENT ID %d\n",pid );
 
 } 
  
 void sd_write (int value)      // writing data into the file
 {
  
  fprintf(fp,"%d\n", value); 
  }
  
  void sd_close()            //closing the file
  {
   fclose(fp);
   }