Part of the Pacemaker Project; this models the Pacemaker.

Dependencies:   mbed TextLCD mbed-rtos

Revision:
4:f04eb7f96f4b
Parent:
3:44d132582373
Child:
6:d9c0ce333d71
--- a/PacemakerController.cpp	Mon Nov 30 03:10:45 2015 +0000
+++ b/PacemakerController.cpp	Mon Nov 30 03:31:29 2015 +0000
@@ -16,10 +16,10 @@
 int pm_clock;
 int avi_clock; 
 
-int LRI = 1000
-int AVI = 150
-int PVARP = 300
-int VRP = 200
+int LRI = 1000;
+int AVI = 150;
+int PVARP = 300;
+int VRP = 200;
 
 // constants
 int MAX_PM_RT = 180;
@@ -131,27 +131,47 @@
 }
 
 void pm_sense() {
-    if (timer_count >= VRP) {
-          //wait for Vget vsense();
-          timer_count = 0;
-    } else 
+    
+    while(1) {
+        
+        if (timer_count >= VRP) {
+              //wait for Vget;
+              timer_count = 0;
+              // do something with Vsense!
+        } else if (timer_count < VRP) {
+            // wait for Vget
+        }
+        
+        if (timer_count < PVARP) {
+            // wait for Aget?
+        } else if (timer_count >= PVARP) {
+            // wait for Aget?
+            // do something with Asense!
+        }
+        
+    }
 }
 
 void pm_response() {
- if (timer_count >= LRI-AVI) {
-     apace();
- } else if (timer_count >= AVI) {
-     vsense();
- }   
+ 
+    while(1) {
+         if (timer_count >= LRI-AVI) {
+             // PM_A!
+             // avi_clk = 0
+             //apace();
+         } else if (timer_count >= AVI) {
+             //vsense();
+         }  
+    } 
 }
 
 
 void apace() {
-    make pin 1
+    // make pin 1
 }
 
 void vpace() {
-    make pin 1
+    // make pin 1
 }