Test program
Dependencies: mbed_EXG_3_click
main.cpp@0:92cf2b749868, 2021-09-30 (annotated)
- Committer:
- JohnnyK
- Date:
- Thu Sep 30 16:32:35 2021 +0000
- Revision:
- 0:92cf2b749868
- Child:
- 1:fa798aee1f8d
First
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JohnnyK | 0:92cf2b749868 | 1 | #include "mbed.h" |
JohnnyK | 0:92cf2b749868 | 2 | #include "ECG_3_click.h" |
JohnnyK | 0:92cf2b749868 | 3 | |
JohnnyK | 0:92cf2b749868 | 4 | int main(void) |
JohnnyK | 0:92cf2b749868 | 5 | { |
JohnnyK | 0:92cf2b749868 | 6 | DigitalOut led(LED1, 1); |
JohnnyK | 0:92cf2b749868 | 7 | |
JohnnyK | 0:92cf2b749868 | 8 | |
JohnnyK | 0:92cf2b749868 | 9 | SPI spiBus(D4, D5, D6); |
JohnnyK | 0:92cf2b749868 | 10 | ECG_3_click ecg3click(spiBus, D7); |
JohnnyK | 0:92cf2b749868 | 11 | ecg3click.swReset(); |
JohnnyK | 0:92cf2b749868 | 12 | ecg3click.fifoReset(); |
JohnnyK | 0:92cf2b749868 | 13 | thread_sleep_for(100); |
JohnnyK | 0:92cf2b749868 | 14 | ecg3click.init(); |
JohnnyK | 0:92cf2b749868 | 15 | |
JohnnyK | 0:92cf2b749868 | 16 | uint32_t ecgData; |
JohnnyK | 0:92cf2b749868 | 17 | uint16_t outHR, outRR; |
JohnnyK | 0:92cf2b749868 | 18 | |
JohnnyK | 0:92cf2b749868 | 19 | while(1) |
JohnnyK | 0:92cf2b749868 | 20 | { |
JohnnyK | 0:92cf2b749868 | 21 | led = !led; |
JohnnyK | 0:92cf2b749868 | 22 | ecg3click.getECG(&ecgData); |
JohnnyK | 0:92cf2b749868 | 23 | printf("ECG: %zu\n", ecgData); |
JohnnyK | 0:92cf2b749868 | 24 | ecg3click.getRTOR(&outHR, &outRR ); |
JohnnyK | 0:92cf2b749868 | 25 | printf("HeardBeat: %zu, R: %zu\n", ecgData, outRR); |
JohnnyK | 0:92cf2b749868 | 26 | thread_sleep_for(100); |
JohnnyK | 0:92cf2b749868 | 27 | } |
JohnnyK | 0:92cf2b749868 | 28 | } |