a

Dependencies:   mbed

Fork of HelloWorld by Vincent Cheung

Revision:
4:fb75731983cd
Parent:
3:641eefd1110b
Child:
5:402ac8c92d76
diff -r 641eefd1110b -r fb75731983cd PaceHeart.cpp
--- a/PaceHeart.cpp	Wed Oct 26 21:17:17 2016 +0000
+++ b/PaceHeart.cpp	Sat Oct 29 21:12:09 2016 +0000
@@ -6,8 +6,8 @@
 
 
 PaceHeart::PaceHeart(){
-    p_pacingState = 0;
-    p_pacingMode = 0;
+    int p_pacingState = 0;
+    int p_pacingMode = 0;
     int p_hysteresis = 0;
     int p_hysteresisInterval = 300;
     int lowrateInterval = 1000;
@@ -76,7 +76,7 @@
     p_vPaceAmp = x;
     return;
 }
- 
+
 double PaceHeart::get_p_vPaceWidth()
 {
     return p_vPaceWidth;
@@ -86,7 +86,7 @@
     p_vPaceWidth = x;
     return;
 }
- 
+
 int PaceHeart::get_p_VRP()
 {
     return p_VRP;
@@ -106,7 +106,7 @@
     p_aPaceAmp = x;
     return;
 }
- 
+
 double PaceHeart::get_p_aPaceWidth()
 {
     return p_aPaceWidth;
@@ -116,7 +116,7 @@
     p_aPaceWidth = x;
     return;
 }
- 
+
 int PaceHeart::get_p_ARP()
 {
     return p_ARP;
@@ -130,12 +130,12 @@
 
 
 void PaceHeart::pace_A(double amp, double wid,int pin)
-{   
+{
     output_pin_A = !output_pin_A ;
     wait(1);
-   
-    
-   
+
+
+
     return;
 }
 
@@ -153,7 +153,7 @@
 {
     output_pin_V = !output_pin_V ;
     wait(2);
-   
+
     return;
 }
 
@@ -184,3 +184,39 @@
     pace(mode);
     return;
 }
+
+bool PaceHeart::amp_inRange(double x)
+{
+    if (x>=500 && x<=7000)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+bool PaceHeart::dur_inRange(double x)
+{
+    if (x>=0.1 && x<=1.9)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+bool PaceHeart::width_inRange(int x)
+{
+    if (x>=150 && x<=500)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}