a

Dependencies:   mbed

Fork of Assignment2_ver2 by weeb grammers

Revision:
8:b262d40e9bd8
Parent:
7:6dc42e1a2a81
--- a/PaceHeart.cpp	Tue Nov 29 20:21:45 2016 +0000
+++ b/PaceHeart.cpp	Sun Dec 04 22:27:42 2016 +0000
@@ -1,10 +1,11 @@
 #include "PaceHeart.h"
 #include "mbed.h"
 #include "Hardware.h"
+
+
 using namespace std;
 
 
-
 PaceHeart::PaceHeart(){
     
     p_pacingState = 0;
@@ -38,6 +39,13 @@
     p_reactionTime = 30000; //10-50->10 seconds
     p_responseFactor = 8; //1-16->1
     p_recoveryTime = 300000; //2-16->1 minutes
+    //acc stuff
+    int numCount;
+    int const MAX_NUM_COUNTS = 3;
+    int const TIMING_PERIOD = 20; // Sensor polling interval
+    
+    uint8_t motion_exceeded_threshold = 0;
+
 }
 int PaceHeart::get_p_pacingState()
 {
@@ -122,7 +130,7 @@
 }
 void PaceHeart::set_p_uprateInterval(double x)
 {
-    if (p_pacingMode == 1) {
+    /*if (p_pacingMode == 1) {
         if (dir ==1) // Change values to take into account for user inputs
         {
             if (p_uprateInterval >=833.33 && p_uprateInterval<=2833.33)
@@ -148,7 +156,8 @@
     }
     else {
         p_uprateInterval = x;
-    }
+    } */
+    p_uprateInterval = x;
     return;
 }
 double PaceHeart::get_p_maxSensorRate(){
@@ -156,7 +165,7 @@
 }
 void PaceHeart::set_p_maxSensorRate(double x)
 {
-    if (p_pacingMode == 1) {
+    /*if (p_pacingMode == 1) {
         if (dir ==1) // Change values to take into account for user inputs
         {
             if (p_maxSensorRate >=833.33 && p_maxSensorRate<=2833.33)
@@ -182,7 +191,9 @@
     }
     else {
         p_maxSensorRate = x;
-    }
+    } */
+    
+    p_maxSensorRate = x;
     return;
 }
 //Ventricle
@@ -190,9 +201,9 @@
 {
     return p_vPaceAmp;
 }
-void PaceHeart::set_p_vPaceAmp(double x)
+void PaceHeart::set_p_vPaceAmp(double x) 
 {
-    if (p_pacingMode == 1) {
+    /*if (p_pacingMode == 1) {
             
        if (dir ==1) // Change values to take into account for user inputs
         {
@@ -227,7 +238,9 @@
     }
     else {
     p_vPaceAmp = x;
-    }
+    } */
+    
+    p_vPaceAmp= x;
     return;
 }
  
@@ -237,7 +250,7 @@
 }
 void PaceHeart::set_p_vPaceWidth(double x)
 {
-    if (p_pacingMode == 1) {
+   /* if (p_pacingMode == 1) {
         if (p_vPaceWidth == 0.05) {
             p_vPaceWidth = 0.4;   
         }
@@ -260,7 +273,9 @@
     }
     else {
         p_vPaceWidth = x;
-    }
+    } */
+    
+    p_vPaceWidth = x;
     return;
 }
  
@@ -327,7 +342,7 @@
     return;
 }
 
-void PaceHeart::pace_V()
+void PaceHeart::pace_V() 
 {
     double amplitude = get_p_vPaceAmp();
     double width = get_p_vPaceWidth();
@@ -335,24 +350,24 @@
     return;
 }
 
-
+/*
 void PaceHeart::pace(int mode)
 {
     switch(mode){
     case 1:  //VOOR
            pace_V();
-    case 0:  //VOO
+    case 0:  //VVI
            pace_V();
     }
     return;
-}
-
+} */
+/*
 void PaceHeart::pace()
 {
     int mode = get_p_pacingMode();
     pace(mode);
     return;
-}
+} */
 int PaceHeart::get_p_activityThresh()
 {
     return p_activityThresh;
@@ -371,17 +386,18 @@
 }
 void PaceHeart::set_p_activityThresh(int x)
 {
-    if (p_pacingMode == 1) {
+   /* if (p_pacingMode == 1) {
         p_activityThresh=x; //no increment set at beginning
     }
     else {
         p_activityThresh=x;
-    }
+    } */
+    p_activityThresh = x;
     return;
 }
 void PaceHeart::set_p_reactionTime(int x)
 {
-    if (p_pacingMode == 1) {
+   /* if (p_pacingMode == 1) {
         
         if (dir ==1){
             if (p_reactionTime >= 10000 && p_reactionTime <= 40000) {
@@ -406,12 +422,13 @@
     }
     else {
         p_reactionTime = x;
-    }
+    } */
+    p_reactionTime = x;
     return;
 }
 void PaceHeart::set_p_responseFactor(int x)
 {
-    if (p_pacingMode == 1) {
+   /* if (p_pacingMode == 1) {
             
         if (dir ==1){
             if (p_responseFactor >= 1 && p_responseFactor <= 15) {
@@ -436,12 +453,13 @@
     }
     else {
         p_responseFactor=x;
-    }
+    } */
+    p_responseFactor=x;
     return;
 }
 void PaceHeart::set_p_recoveryTime(int x)
 {
-    if (p_pacingMode == 1) {
+   /* if (p_pacingMode == 1) {
             
         if (dir ==1){
             if (p_recoveryTime >= 120000 && p_recoveryTime <= 900000) {
@@ -466,7 +484,8 @@
     }
     else {
         p_recoveryTime=x;
-    }
+    } */
+    p_recoveryTime=x;
     return;
 }
 void PaceHeart::set_dir(int x)