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
ecgg.cpp@4:6bd81bb1790d, 2017-03-01 (annotated)
- Committer:
- nikitateggi
- Date:
- Wed Mar 01 18:49:33 2017 +0000
- Revision:
- 4:6bd81bb1790d
- Parent:
- 3:9a06c2bed650
POC code with eeprom
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikitateggi | 1:8316c23ec6b9 | 1 | /** ECG ADS1291 Test program. |
nikitateggi | 1:8316c23ec6b9 | 2 | ADS1291 is a single channel ECG chip |
nikitateggi | 1:8316c23ec6b9 | 3 | with a 24 bit Sigma-Delta ADC |
nikitateggi | 1:8316c23ec6b9 | 4 | */ |
nikitateggi | 1:8316c23ec6b9 | 5 | |
nikitateggi | 1:8316c23ec6b9 | 6 | #include "mbed.h" |
nikitateggi | 1:8316c23ec6b9 | 7 | #include <string.h> |
nikitateggi | 1:8316c23ec6b9 | 8 | #include <stdio.h> |
nikitateggi | 1:8316c23ec6b9 | 9 | #include "ds3231.h" |
nikitateggi | 1:8316c23ec6b9 | 10 | #include "SDFileSystem.h" |
nikitateggi | 1:8316c23ec6b9 | 11 | #include "ecg_dec.h" |
nikitateggi | 1:8316c23ec6b9 | 12 | #include "rtc.h" |
nikitateggi | 1:8316c23ec6b9 | 13 | #include "sdcard.h" |
nikitateggi | 3:9a06c2bed650 | 14 | #include "ec_bp.h" |
nikitateggi | 3:9a06c2bed650 | 15 | Serial pc(USBTX,USBRX); |
nikitateggi | 1:8316c23ec6b9 | 16 | |
nikitateggi | 1:8316c23ec6b9 | 17 | |
nikitateggi | 1:8316c23ec6b9 | 18 | |
nikitateggi | 3:9a06c2bed650 | 19 | int ecg(int pid) |
nikitateggi | 3:9a06c2bed650 | 20 | { |
nikitateggi | 1:8316c23ec6b9 | 21 | |
nikitateggi | 3:9a06c2bed650 | 22 | int concatenate_value2 = 0; |
nikitateggi | 3:9a06c2bed650 | 23 | int32_t sample_sum; // static int32_t avg[1500]; |
nikitateggi | 3:9a06c2bed650 | 24 | int32_t count = 0; int32_t fs = 500; int32_t w=0,w1=0; |
nikitateggi | 3:9a06c2bed650 | 25 | Timer t; |
nikitateggi | 3:9a06c2bed650 | 26 | unsigned char chk = 1; |
nikitateggi | 3:9a06c2bed650 | 27 | pc.baud(baud_rate); |
nikitateggi | 4:6bd81bb1790d | 28 | freqset(); // setting the frequency |
nikitateggi | 4:6bd81bb1790d | 29 | setupfunc(); |
nikitateggi | 3:9a06c2bed650 | 30 | ecgsetupfunc(); |
nikitateggi | 3:9a06c2bed650 | 31 | chk = 1; |
nikitateggi | 4:6bd81bb1790d | 32 | sd_open_ECGfile(pid); // opening the ecg file |
nikitateggi | 1:8316c23ec6b9 | 33 | |
nikitateggi | 3:9a06c2bed650 | 34 | for(int i=0; i<N_ECG; i++) |
nikitateggi | 3:9a06c2bed650 | 35 | { |
nikitateggi | 3:9a06c2bed650 | 36 | concatenate_value2= readvalue(); |
nikitateggi | 4:6bd81bb1790d | 37 | sd_write(concatenate_value2); // writing into the sd card |
nikitateggi | 3:9a06c2bed650 | 38 | pc.printf( "%d\n", concatenate_value2); |
nikitateggi | 3:9a06c2bed650 | 39 | } |
nikitateggi | 3:9a06c2bed650 | 40 | |
nikitateggi | 4:6bd81bb1790d | 41 | sd_close(); // closing the file |
nikitateggi | 4:6bd81bb1790d | 42 | |
nikitateggi | 3:9a06c2bed650 | 43 | |
nikitateggi | 3:9a06c2bed650 | 44 | |
nikitateggi | 3:9a06c2bed650 | 45 | } // End of main function |