Pacemaker code Implementation for SFWRENG 3K04
Dependencies: mbed Queue mbed-rtos FXOS8700Q
Fork of Pacemaker by
SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.
The project uses the Freescale K64F Microcontroller and C++ mbed library.
sense.cpp
- Committer:
- noahzwiep
- Date:
- 2016-12-13
- Revision:
- 34:701503855d52
- Parent:
- 5:253c33930e91
- Child:
- 36:b6431cd8ecd6
File content as of revision 34:701503855d52:
#pragma once #include "mbed.h" #include "sense.h" #include "VVI.h" sense::sense(genData* a){ myGenData = a; isSensed = false; } 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; }