local timers
Dependencies: TextLCD mbed-rtos mbed
Fork of pacemaker_FINAL_v2 by
constants.h@4:584d9e2e4fae, 2014-12-04 (annotated)
- Committer:
- jfields
- Date:
- Thu Dec 04 03:03:56 2014 +0000
- Revision:
- 4:584d9e2e4fae
single global timer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jfields | 4:584d9e2e4fae | 1 | #include "mbed.h" |
jfields | 4:584d9e2e4fae | 2 | #include "rtos.h" |
jfields | 4:584d9e2e4fae | 3 | #include "TextLCD.h" |
jfields | 4:584d9e2e4fae | 4 | #include <stdio.h> |
jfields | 4:584d9e2e4fae | 5 | #include <stdlib.h> |
jfields | 4:584d9e2e4fae | 6 | |
jfields | 4:584d9e2e4fae | 7 | #define RUN 0x1 |
jfields | 4:584d9e2e4fae | 8 | |
jfields | 4:584d9e2e4fae | 9 | TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); |
jfields | 4:584d9e2e4fae | 10 | Serial pc (USBTX, USBRX); |
jfields | 4:584d9e2e4fae | 11 | |
jfields | 4:584d9e2e4fae | 12 | // ports |
jfields | 4:584d9e2e4fae | 13 | DigitalIn VGet(p11); |
jfields | 4:584d9e2e4fae | 14 | DigitalIn AGet(p12); |
jfields | 4:584d9e2e4fae | 15 | DigitalOut VPace(p13); |
jfields | 4:584d9e2e4fae | 16 | DigitalOut APace(p14); |
jfields | 4:584d9e2e4fae | 17 | PwmOut speaker(p21); |
jfields | 4:584d9e2e4fae | 18 | |
jfields | 4:584d9e2e4fae | 19 | // LEDs |
jfields | 4:584d9e2e4fae | 20 | DigitalOut leds[] = {LED1, LED2, LED3, LED4}; |
jfields | 4:584d9e2e4fae | 21 | // 1 = VP |
jfields | 4:584d9e2e4fae | 22 | // 2 = AP |
jfields | 4:584d9e2e4fae | 23 | // 3 = VS |
jfields | 4:584d9e2e4fae | 24 | // 4 = AS |
jfields | 4:584d9e2e4fae | 25 | |
jfields | 4:584d9e2e4fae | 26 | // input stuff |
jfields | 4:584d9e2e4fae | 27 | char input; |
jfields | 4:584d9e2e4fae | 28 | |
jfields | 4:584d9e2e4fae | 29 | // heart rate global vars |
jfields | 4:584d9e2e4fae | 30 | int HR = 0; |
jfields | 4:584d9e2e4fae | 31 | int beats = 0; |
jfields | 4:584d9e2e4fae | 32 | int sampleRate = 10000; // default 10 seconds |
jfields | 4:584d9e2e4fae | 33 | int firstSample = 1; |
jfields | 4:584d9e2e4fae | 34 | int Omode = 0; |
jfields | 4:584d9e2e4fae | 35 | |
jfields | 4:584d9e2e4fae | 36 | // Normal Values |
jfields | 4:584d9e2e4fae | 37 | const int N_PVARP = 325; // ms |
jfields | 4:584d9e2e4fae | 38 | const int N_VRP = 300; // ms |
jfields | 4:584d9e2e4fae | 39 | const int N_LRI = 857; // ms (= about 70ppm) |
jfields | 4:584d9e2e4fae | 40 | const int N_AVI = 65; // ms |
jfields | 4:584d9e2e4fae | 41 | const int N_UB = 100; // 100ppm |
jfields | 4:584d9e2e4fae | 42 | const int N_LB = 40; // 40ppm |
jfields | 4:584d9e2e4fae | 43 | |
jfields | 4:584d9e2e4fae | 44 | // Exercise Values |
jfields | 4:584d9e2e4fae | 45 | const int E_PVARP = 175; // ms |
jfields | 4:584d9e2e4fae | 46 | const int E_VRP = 150; // ms |
jfields | 4:584d9e2e4fae | 47 | const int E_LRI = 428; // ms (= about 140ppm) |
jfields | 4:584d9e2e4fae | 48 | const int E_AVI = 30; // ms |
jfields | 4:584d9e2e4fae | 49 | const int E_UB = 175; // 175ppm |
jfields | 4:584d9e2e4fae | 50 | const int E_LB = 100; // 100ppm |
jfields | 4:584d9e2e4fae | 51 | |
jfields | 4:584d9e2e4fae | 52 | // Sleep Values |
jfields | 4:584d9e2e4fae | 53 | const int S_PVARP = 500; // ms |
jfields | 4:584d9e2e4fae | 54 | const int S_VRP = 475; // ms |
jfields | 4:584d9e2e4fae | 55 | const int S_LRI = 1333; // ms (= about 45ppm) |
jfields | 4:584d9e2e4fae | 56 | const int S_AVI = 100; // ms |
jfields | 4:584d9e2e4fae | 57 | const int S_UB = 60; // 60ppm |
jfields | 4:584d9e2e4fae | 58 | const int S_LB = 30; // 30ppm |
jfields | 4:584d9e2e4fae | 59 | |
jfields | 4:584d9e2e4fae | 60 | // Heart Values - Normal Mode is default |
jfields | 4:584d9e2e4fae | 61 | int PVARP = N_PVARP; |
jfields | 4:584d9e2e4fae | 62 | int VRP = N_VRP; |
jfields | 4:584d9e2e4fae | 63 | int LRI = N_LRI; |
jfields | 4:584d9e2e4fae | 64 | int AVI = N_AVI; |
jfields | 4:584d9e2e4fae | 65 | int UB = N_UB; |
jfields | 4:584d9e2e4fae | 66 | int LB = N_LB; |
jfields | 4:584d9e2e4fae | 67 | |
jfields | 4:584d9e2e4fae | 68 | // status flags |
jfields | 4:584d9e2e4fae | 69 | int isVRP = 0; |
jfields | 4:584d9e2e4fae | 70 | int isPVARP = 0; |
jfields | 4:584d9e2e4fae | 71 | int inManual = 0; |
jfields | 4:584d9e2e4fae | 72 |