Part of the Pacemaker Project; this models the Pacemaker.

Dependencies:   mbed TextLCD mbed-rtos

Revision:
20:dc272bfaa276
Parent:
19:f3615321b5c4
Child:
21:f7f50bbeba5e
Child:
24:81cd9ef5c4f6
--- a/PacemakerController.cpp	Mon Nov 30 21:14:51 2015 +0000
+++ b/PacemakerController.cpp	Mon Nov 30 21:38:54 2015 +0000
@@ -42,8 +42,10 @@
 DigitalOut Asense(LED3);
 DigitalOut Vsense(LED4);
 
-DigitalOut apace(p22):
-    DigitalOut vpace(p21):
+DigitalIn  aget(p24);
+DigitalIn  vget(p23);
+DigitalOut apace(p22);
+DigitalOut vpace(p21);
 
 // hardware interrupt handler, adapted from code in piazza post by Dagaen
     extern "C" void TIMER0_IRQHandler (void)
@@ -139,7 +141,6 @@
         // do nothing for invalid char
     }
 
-
 }
 
 void pm_sense()
@@ -147,18 +148,21 @@
 
     while(1) {
 
-        if (timer_count >= VRP) {
-            //wait for Vget;
+        if (timer_count >= VRP && vget == 1) {
+             // Valid_V state
+             
             timer_count = 0;
             // do something with Vsense!
-        } else if (timer_count < VRP) {
-            // wait for Vget
+            
+        } else if (timer_count < VRP  && vget == 1) {
+            // Invalid_V state
         }
 
-        if (timer_count < PVARP) {
-            // wait for Aget?
-        } else if (timer_count >= PVARP) {
-            // wait for Aget?
+        if (timer_count < PVARP && aget == 1) {
+            // Invalid_A state
+        } else if (timer_count >= PVARP && aget == 1) {
+            // Valid_A state
+            
             // do something with Asense!
         }