Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   mbed Queue mbed-rtos FXOS8700Q

Fork of Pacemaker by Eric dollar

SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.

The project uses the Freescale K64F Microcontroller and C++ mbed library.

Revision:
34:701503855d52
Parent:
5:253c33930e91
Child:
36:b6431cd8ecd6
--- a/sense.cpp	Mon Dec 12 03:31:55 2016 +0000
+++ b/sense.cpp	Tue Dec 13 03:46:34 2016 +0000
@@ -1,8 +1,39 @@
 #pragma once
 #include "mbed.h"
 #include "sense.h"
+#include "VVI.h"
 
-sense::sense(){
+sense::sense(genData* a){
+    myGenData = a; 
+    isSensed = false; 
     }
     
-sense::~sense(){};
\ No newline at end of file
+sense::~sense(){};
+
+bool sense::returnedSense(){
+    timeout = false;
+    mbed::Timer t;
+    t.start();
+    while(!timeout){
+        //Here we check if we should still be sensing or if we should give up
+        if(myGenData->getHyst()){       //This is the case where hysteresis is enabled, we wait the lrl plus hysteresis
+            if(t.read_ms() >= (myGenData->getLRL()+myGenData->getHystRL())){
+                timeout = true; 
+            }
+        }
+        else{   //Here hysteresis isn't enabled, so its just waiting the LRL. 
+            if(t.read_ms() >= myGenData->getLRL()){
+                timeout = true; 
+            }
+        }
+        //Here we have to check the pin and see if it is above threshold. 
+/*        if(PINNAME.read() == 1){
+            isSensed = true;
+            timeout = true;
+        }*/
+    }
+    t.stop();
+    return isSensed; 
+}      
+        
+        
\ No newline at end of file