CIS541 / Mbed 2 deprecated CIS541PM

Dependencies:   mbed mbed-rtos TextLCD

Files at this revision

API Documentation at this revision

Comitter:
shibulal
Date:
Mon Nov 30 20:29:58 2015 +0000
Parent:
3:ac2e5aceb324
Child:
5:a74776e6504f
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Nov 30 17:59:05 2015 +0000
+++ b/main.cpp	Mon Nov 30 20:29:58 2015 +0000
@@ -45,10 +45,13 @@
 const int sportsModeLRI = 600;
 const int manualModeURI = 343;
 const int manualModeLRI = 2000;
+int low[4] = {30,40,100,30};
+int high[4] = {60,100,175,175};
 int pulses = 0;
 int pacemakerInterval = 10;
+int newpacemakerInterval;
 int heartInterval = 10;
-int pacemakerRate = 0;
+int paceMakerRate = 0;
 int heartRate = 0;
 int LRI = normalModeLRI;
 int URI = normalModeURI;
@@ -92,6 +95,10 @@
                 }
             else if (input=='O'){
                 mode='O';
+                input=pc.getc();
+                newpacemakerInterval=10*(int)input;
+                input=pc.getc();
+                newpacemakerInterval=newpacemakerInterval+(int)input;
                 Pmm.signal_set(0x1);
                 Thread::signal_wait(0x1);
                 }
@@ -139,7 +146,7 @@
             Pmki.signal_set(0x1);
             }
         else if (mode=='O'){
-            //not sure what to do here
+            pacemakerInterval=newpacemakerInterval;
             Pmki.signal_set(0x1);
             }
         else if (mode=='M'){
@@ -234,7 +241,7 @@
     }   
 void updatePacemaker(){
     int temp = 60/pacemakerInterval;
-    pacemakerRate = pacemakerRate + temp;
+    paceMakerRate = paceMakerRate + temp;
 }
 void PaceMakerDisplay(void const *args){
     osEvent evt;
@@ -262,16 +269,16 @@
             updatePacemaker();
             }
         else {
-            if (pacemakerRate < low[mode]){
+            if (paceMakerRate < low[mode]){
                 r.reset();
                 paceMakerRate=0;
                 }
-            else if (pacemakerRate  >= low[mode]  && pacemakerRate  <= high[mode]){
+            else if (paceMakerRate  >= low[mode]  && paceMakerRate  <= high[mode]){
                 //high alarm
                 r.reset();
                 paceMakerRate=0;
                 }
-            else if (pacemakerRate  > high[mode]){
+            else if (paceMakerRate  > high[mode]){
                 //low alarm
                 r.reset();
                 paceMakerRate=0;
@@ -538,7 +545,7 @@
             VpaceLED=0;
             }
         lcd.cls();
-        lcd.printf("%d", pacemakerRate);
+        lcd.printf("%d", paceMakerRate);
         Thread::wait(15);
         };
 }