Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
ecgg.cpp@3:9a06c2bed650, 2017-02-10 (annotated)
- Committer:
- nikitateggi
- Date:
- Fri Feb 10 10:39:13 2017 +0000
- Revision:
- 3:9a06c2bed650
- Parent:
- 1:8316c23ec6b9
- Child:
- 4:6bd81bb1790d
Peak detect to 400 samples
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 | 3:9a06c2bed650 | 28 | freqset(); |
nikitateggi | 3:9a06c2bed650 | 29 | setupfunc(); |
nikitateggi | 3:9a06c2bed650 | 30 | ecgsetupfunc(); |
nikitateggi | 3:9a06c2bed650 | 31 | chk = 1; |
nikitateggi | 3:9a06c2bed650 | 32 | // t.start(); |
nikitateggi | 3:9a06c2bed650 | 33 | sd_open_ECGfile(pid); |
nikitateggi | 1:8316c23ec6b9 | 34 | |
nikitateggi | 3:9a06c2bed650 | 35 | for(int i=0; i<N_ECG; i++) |
nikitateggi | 3:9a06c2bed650 | 36 | { |
nikitateggi | 3:9a06c2bed650 | 37 | concatenate_value2= readvalue(); |
nikitateggi | 3:9a06c2bed650 | 38 | sd_write(concatenate_value2); |
nikitateggi | 3:9a06c2bed650 | 39 | pc.printf( "%d\n", concatenate_value2); |
nikitateggi | 3:9a06c2bed650 | 40 | } |
nikitateggi | 3:9a06c2bed650 | 41 | |
nikitateggi | 3:9a06c2bed650 | 42 | sd_close(); |
nikitateggi | 3:9a06c2bed650 | 43 | // t.stop(); |
nikitateggi | 3:9a06c2bed650 | 44 | // printf( "%f\n", t.read()); |
nikitateggi | 3:9a06c2bed650 | 45 | |
nikitateggi | 3:9a06c2bed650 | 46 | |
nikitateggi | 3:9a06c2bed650 | 47 | } // End of main function |