Part of the Pacemaker Project; this models the Pacemaker.

Dependencies:   mbed TextLCD mbed-rtos

Revision:
3:44d132582373
Parent:
2:5e9c4d83d038
Child:
4:f04eb7f96f4b
Child:
5:9eee15818b0e
--- a/PacemakerController.cpp	Sat Nov 28 19:34:39 2015 +0000
+++ b/PacemakerController.cpp	Mon Nov 30 03:10:45 2015 +0000
@@ -13,7 +13,13 @@
 
 
 int h_clock;
+int pm_clock;
+int avi_clock; 
 
+int LRI = 1000
+int AVI = 150
+int PVARP = 300
+int VRP = 200
 
 // constants
 int MAX_PM_RT = 180;
@@ -124,19 +130,39 @@
     
 }
 
+void pm_sense() {
+    if (timer_count >= VRP) {
+          //wait for Vget vsense();
+          timer_count = 0;
+    } else 
+}
+
+void pm_response() {
+ if (timer_count >= LRI-AVI) {
+     apace();
+ } else if (timer_count >= AVI) {
+     vsense();
+ }   
+}
 
 
 void apace() {
-    
+    make pin 1
 }
 
 void vpace() {
-    
+    make pin 1
 }
 
+
 int main() {
     // connect the serial device (PC keybd) to the interrupt
     pc.attach(&MODE_SWITCH);
     
-    //Thread t3(PM_ALARM);
+    Thread t3(pm_sense);
+    Thread t4(pm_response);
+
+    Thread t2(PM_ALARM);
+    Thread t5();
+
 }