Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TextLCD mbed-rtos mbed
Fork of mbed_PM by
Diff: main.cpp
- Revision:
- 1:e4a204ef28bc
- Parent:
- 0:093bb69f95f0
--- a/main.cpp Mon Nov 30 21:13:56 2015 +0000
+++ b/main.cpp Tue Dec 01 00:53:34 2015 +0000
@@ -1,5 +1,88 @@
#include "mbed.h"
#include "rtos.h"
+#include "TextLCD.h"
+
+Serial keyboard(USBTX, USBRX);
+
+int PacemakerA, PacemakerV = 0;
+DigitalOut Apace(), Vpace();
+DigitalIn Aget(), Vget();
+
+int PacemakerModeGuard = 0;
+
+void PacemakerSense() {
+
+}
+
+void PacemakerKeyboard() {
+ while(1) {
+ char c = keyboard.getc();
+ switch(c) {
+ case 'n':
+ case 'N':
+ PacemakerModeGuard = 0;
+ break;
+ case 's':
+ case 'S':
+ PacemakerModeGuard = 1;
+ break;
+ case 'e':
+ case 'E':
+ PacemakerModeGuard = 2;
+ break;
+ case 'm':
+ case 'M':
+ PacemakerModeGuard = 3;
+ break;
+ case 'a':
+ case 'A':
+ if(PacemakerModeGuard == 3) {
+ PacemakerA = 1;
+ Thread::wait(10);
+ PacemakerA = 0;
+ }
+ break;
+ case 'v':
+ case 'V':
+ }
+ }
+}
-DigitalOut Apace, Vpace;
-DigitalIn Aget, Vget;
\ No newline at end of file
+
+Timer obsInt;
+int observationInterval = 10; //observation interval in seconds
+float vget_count = 0.; // A counter that increments every time a ventricular pulse has been detected
+Semaphore heartBeat(1);
+float DisplayMe;
+void PacemakerDisplay() {
+ if (obsInt.read_ms()/1000 >= observationInterval) { //reporting interval exceeded
+ obsInt.stop();
+ heartBeat.wait(); //DONT LET ANY OTHER CODE RUN RIGHT NOW
+ DisplayMe = vget_count*(60/observationInterval);
+ lcd.printf("HR = %s\n", DisplayMe); // multiplies the number of counted Vgets by the number of observation periods in one minute,
+ PacemakerAlarm(DisplayMe);
+ vget_count = 0;
+ obsInt.reset();
+ heartBeat.release(); //OTHER CODE CAN RUN AGAIN
+ }
+}
+void PacemakerAlarm(int HeartRate) { //Takes the heart rate and returns an appropriate message; runs whenever display is updated
+ if HeartRate > LRI {
+ lcd.printf("HR TOO FAST\n");
+ } else if HeartRate < URI{
+ lcd.printf("HR TOO SLOW\n");
+ } else{
+ lcd.printf(" \n");
+ }
+}
+
+void PacemakerLED() {
+
+}
+
+
+
+int main() {
+
+}
+
\ No newline at end of file
