Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Queue mbed-rtos FXOS8700Q
Fork of Pacemaker by
sense.cpp
00001 #pragma once 00002 #include "mbed.h" 00003 #include "sense.h" 00004 #include "VVI.h" 00005 00006 sense::sense(genData* a): mySense(PTB2){ 00007 myGenData = a; 00008 isSensed = false; 00009 } 00010 00011 sense::~sense(){}; 00012 00013 bool sense::returnedSense(){ 00014 timeout = false; 00015 isSensed = false; 00016 mbed::Timer t; 00017 t.start(); 00018 while(!timeout){ 00019 //Here we check if we should still be sensing or if we should give up 00020 if(myGenData->getHyst()){ //This is the case where hysteresis is enabled, we wait the lrl plus hysteresis 00021 if(t.read_ms() >= (myGenData->getLRL()+myGenData->getHystRL())){ 00022 timeout = true; 00023 } 00024 } 00025 else{ //Here hysteresis isn't enabled, so its just waiting the LRL. 00026 if(t.read_ms() >= myGenData->getLRL()){ 00027 timeout = true; 00028 } 00029 } 00030 //Here we have to check the pin and see if it is above threshold. 00031 if(mySense.read() > 0.995){ 00032 isSensed = true; 00033 timeout = true; 00034 } 00035 } 00036 t.stop(); 00037 return isSensed; 00038 } 00039 00040
Generated on Thu Jul 14 2022 10:20:30 by
1.7.2
