Test program
Dependencies: mbed_EXG_3_click
main.cpp@1:fa798aee1f8d, 2021-09-30 (annotated)
- Committer:
- JohnnyK
- Date:
- Thu Sep 30 16:37:45 2021 +0000
- Revision:
- 1:fa798aee1f8d
- Parent:
- 0:92cf2b749868
Delay correction
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 | 1:fa798aee1f8d | 26 | thread_sleep_for(1000); |
JohnnyK | 0:92cf2b749868 | 27 | } |
JohnnyK | 0:92cf2b749868 | 28 | } |