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
Diff: sdcard.cpp
- Revision:
- 4:6bd81bb1790d
- Parent:
- 3:9a06c2bed650
--- a/sdcard.cpp Fri Feb 10 10:39:13 2017 +0000 +++ b/sdcard.cpp Wed Mar 01 18:49:33 2017 +0000 @@ -8,7 +8,7 @@ SDFileSystem sd(PTE1, PTE3, PTE2, PTE4, "sd"); FILE *fp=NULL; - void sd_open_GLCfile(int pid) + void sd_open_GLCfile(int pid) // opening the glc file { char buffer[32]; @@ -17,29 +17,26 @@ epoch_time1=rtc_read(); // strftime(buffer, 32, "GLC_%s", pid); - sprintf(buffer1,"/sd/%d_GLC.csv",pid); + sprintf(buffer1,"/sd/%d_GLC.csv",pid); fp = fopen(buffer1,"a"); - fprintf(fp,"%s\n",ctime(&epoch_time1) ); + fprintf(fp,"%s\n",ctime(&epoch_time1) ); //writing the date, time into the file } - void sd_open_GLCfilee(int pid) + void sd_open_GLCfilee(int pid) // only opening the glc file after entering TEST screen { - 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); + sprintf(buffer1,"/sd/%d_GLC.csv",pid); fp = fopen(buffer1,"a"); fprintf(fp,"PATIENT ID %d\n",pid); } - void sd_open_ECGfile(int pid) + + void sd_open_ECGfile(int pid) { // char buffer[32]; @@ -51,26 +48,21 @@ 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) + void sd_open_ECGfilee(int pid) // only opening the ECG file after entering TEST screen { - // 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); + 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) + + + void sd_open_BPfile(int pid) { char buffer[32]; @@ -84,15 +76,24 @@ fprintf(fp,"%s\n",ctime(&epoch_time1) ); } - +void sd_open_BPfilee(int pid) // only opening the BP file after entering TEST screen + { + - void sd_write (int value) + 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() + void sd_close() //closing the file { fclose(fp); }