fork the master

Dependencies:   TextLCD mbed-rtos mbed

Fork of Pacemaker by pacemaker team

Revision:
8:ce2565cfe709
Parent:
5:376358077dc8
Child:
9:5021d78ed4a0
--- a/main.cpp	Sat Nov 29 21:21:59 2014 +0000
+++ b/main.cpp	Mon Dec 01 00:13:25 2014 +0000
@@ -2,7 +2,8 @@
  * Pacemaker MBED code
  *
  * CIS541 Embedded Systems for Life Critical Applications
- * Author: Jing
+ * Author: Jing Qiu
+ *         Michael Frederick
  * 
  */
 
@@ -26,6 +27,7 @@
 int LRI_h = 1666;
 int LRI_l = 666;
 int observation_interval=10000;   //ms
+bool setObservation = false;
 
 Serial pc(USBTX, USBRX);
 TextLCD myPanel(p15,p16,p17,p18,p19,p20,TextLCD::LCD16x2);
@@ -67,7 +69,7 @@
     setGPIO(a_pace);
     wait_us(PULSE_WIDTH_A);
     clearGPIO(a_pace); 
-    led = 0;   
+    led1 = 0;   
     
 }
 
@@ -156,6 +158,7 @@
 
 void button_handler(void const *args)
 {
+    int observation_temp=0;
     while(1)
     {
       char buffer;
@@ -173,12 +176,21 @@
             apace();
         else if (buffer == 'V' && mode == 'M')
             vpace();
-        //else if (buffer == 'O');
-            //setobervation
-        //else if (buffer == '\n');
+        else if (buffer == 'O') {
+            setObservation = true;
+            observation_temp = 0;
+        }
+        else if (buffer == '\n')
+        {
+            observation_interval = observation_temp*1000;
+            setObservation = false;
+        }
+        else if (setObservation)
+        {
+            observation_temp *= 10;
+            observation_temp += (int) buffer;
         
-        //else 
-        
+        }
       }
     }
 }