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

Committer:
nikitateggi
Date:
Mon Jan 30 07:45:41 2017 +0000
Revision:
1:8316c23ec6b9
Child:
2:3b7b71bfc941
POC code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nikitateggi 1:8316c23ec6b9 1 #include "mbed.h"
nikitateggi 1:8316c23ec6b9 2 #include <stdio.h>
nikitateggi 1:8316c23ec6b9 3 #include "SDFileSystem.h"
nikitateggi 1:8316c23ec6b9 4 #include "sdcard.h"
nikitateggi 1:8316c23ec6b9 5 #include "rtc.h"
nikitateggi 1:8316c23ec6b9 6 #include "main.h"
nikitateggi 1:8316c23ec6b9 7
nikitateggi 1:8316c23ec6b9 8 SDFileSystem sd(PTE1, PTE3, PTE2, PTE4, "sd");
nikitateggi 1:8316c23ec6b9 9 FILE *fp=NULL;
nikitateggi 1:8316c23ec6b9 10
nikitateggi 1:8316c23ec6b9 11 void sd_open_GLCfile(int pid)
nikitateggi 1:8316c23ec6b9 12 {
nikitateggi 1:8316c23ec6b9 13
nikitateggi 1:8316c23ec6b9 14 char buffer[32];
nikitateggi 1:8316c23ec6b9 15 char buffer1[32];
nikitateggi 1:8316c23ec6b9 16 time_t epoch_time1;
nikitateggi 1:8316c23ec6b9 17 epoch_time1=rtc_read();
nikitateggi 1:8316c23ec6b9 18 // strftime(buffer, 32, "GLC_%s", pid);
nikitateggi 1:8316c23ec6b9 19
nikitateggi 1:8316c23ec6b9 20 sprintf(buffer1,"/sd/GLC_%d.csv",pid);
nikitateggi 1:8316c23ec6b9 21 fp = fopen(buffer1,"a");
nikitateggi 1:8316c23ec6b9 22 fprintf(fp,"%s\n",ctime(&epoch_time1) );
nikitateggi 1:8316c23ec6b9 23
nikitateggi 1:8316c23ec6b9 24
nikitateggi 1:8316c23ec6b9 25 }
nikitateggi 1:8316c23ec6b9 26
nikitateggi 1:8316c23ec6b9 27 void sd_open_ECGfile(int pid)
nikitateggi 1:8316c23ec6b9 28 {
nikitateggi 1:8316c23ec6b9 29
nikitateggi 1:8316c23ec6b9 30 // char buffer[32];
nikitateggi 1:8316c23ec6b9 31 char buffer1[32];
nikitateggi 1:8316c23ec6b9 32 time_t epoch_time1;
nikitateggi 1:8316c23ec6b9 33 epoch_time1=rtc_read();
nikitateggi 1:8316c23ec6b9 34 // strftime(buffer, 32, "ECG_%d", pid);
nikitateggi 1:8316c23ec6b9 35
nikitateggi 1:8316c23ec6b9 36 sprintf(buffer1,"/sd/ECG_%d.csv",pid);
nikitateggi 1:8316c23ec6b9 37 fp = fopen(buffer1,"a");
nikitateggi 1:8316c23ec6b9 38 fprintf(fp,"%s\n",ctime(&epoch_time1) );
nikitateggi 1:8316c23ec6b9 39 // strftime(buffer, 32, "ECG_%d-%m-%Y_%H_%M",localtime(&epoch_time1));
nikitateggi 1:8316c23ec6b9 40 // fprintf(fp,"%d\n",buffer );
nikitateggi 1:8316c23ec6b9 41 }
nikitateggi 1:8316c23ec6b9 42
nikitateggi 1:8316c23ec6b9 43 void sd_open_BPfile(int pid)
nikitateggi 1:8316c23ec6b9 44 {
nikitateggi 1:8316c23ec6b9 45
nikitateggi 1:8316c23ec6b9 46 char buffer[32];
nikitateggi 1:8316c23ec6b9 47 char buffer1[32];
nikitateggi 1:8316c23ec6b9 48 time_t epoch_time1;
nikitateggi 1:8316c23ec6b9 49 epoch_time1=rtc_read();
nikitateggi 1:8316c23ec6b9 50 // strftime(buffer, 32, "ECG_%d", pid);
nikitateggi 1:8316c23ec6b9 51
nikitateggi 1:8316c23ec6b9 52 sprintf(buffer1,"/sd/BP_%d.csv",pid);
nikitateggi 1:8316c23ec6b9 53 fp = fopen(buffer1,"a");
nikitateggi 1:8316c23ec6b9 54 fprintf(fp,"%s\n",ctime(&epoch_time1) );
nikitateggi 1:8316c23ec6b9 55 }
nikitateggi 1:8316c23ec6b9 56
nikitateggi 1:8316c23ec6b9 57
nikitateggi 1:8316c23ec6b9 58
nikitateggi 1:8316c23ec6b9 59 void sd_write (int value)
nikitateggi 1:8316c23ec6b9 60 {
nikitateggi 1:8316c23ec6b9 61
nikitateggi 1:8316c23ec6b9 62 fprintf(fp,"%d\n", value);
nikitateggi 1:8316c23ec6b9 63 }
nikitateggi 1:8316c23ec6b9 64
nikitateggi 1:8316c23ec6b9 65 void sd_close()
nikitateggi 1:8316c23ec6b9 66 {
nikitateggi 1:8316c23ec6b9 67 fclose(fp);
nikitateggi 1:8316c23ec6b9 68 }
nikitateggi 1:8316c23ec6b9 69
nikitateggi 1:8316c23ec6b9 70