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.
Fork of Assignment2 by
Revision 6:9b8fee13549c, committed 2016-11-14
- Comitter:
- Judorunner
- Date:
- Mon Nov 14 22:47:00 2016 +0000
- Parent:
- 5:45d58f8a5912
- Commit message:
- ll
Changed in this revision
| PaceHeart.cpp | Show annotated file Show diff for this revision Revisions of this file |
| PaceHeart.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/PaceHeart.cpp Mon Nov 14 21:36:01 2016 +0000
+++ b/PaceHeart.cpp Mon Nov 14 22:47:00 2016 +0000
@@ -11,8 +11,8 @@
p_pacingMode = 0;
int p_hysteresis = 0;
int p_hysteresisInterval = 300;
- int lowrateInterval = 1000;
- int uprateInterval = 500; //upper rate limit
+ double p_lowrateInterval = 1000.0;
+ double p_uprateInterval = 500.0; //upper rate limit
//Ventricle
double p_vPaceAmp = 3500.0;
double p_vPaceWidth = 0.4;
@@ -26,18 +26,18 @@
PaceHeart::PaceHeart(int mode){
p_pacingState = 0;
p_pacingMode = mode;
- int lowrateInterval = 1000; //30-50->5 50-90->1 90-175->5 ppm
- int uprateInterval = 500; //upper rate limit 50-175->5 ppm
- int maxSensorRate = 500; //50-175->5 ppm
+ double p_lowrateInterval = 1000.0; //30-50->5 50-90->1 90-175->5 ppm
+ double p_uprateInterval = 2000.0; //upper rate limit 50-175->5 ppm
+ double p_maxSensorRate = 2000.0; //50-175->5 ppm
//Ventricle
double p_vPaceAmp = 3750.0; //3750 can change to 0, 1250, 2500, 3750, 5000
double p_vPaceWidth = 0.4; //0.05->no change 0.1-1.9 0.1
int p_activityThresh = 4; //1-7 print out string with level ie. Med
- int p_reactionTime = 30; //10-50->10
+ int p_reactionTime = 30; //10-50->10 seconds
int p_responseFactor = 8; //1-16->1
- int p_recoveryTime = 5; //2-16->1
+ int p_recoveryTime = 5; //2-16->1 minutes
}
int PaceHeart::get_p_pacingState()
{
@@ -65,22 +65,67 @@
p_hysteresisInterval = x;
return;
}
-int PaceHeart::get_lowrateInterval()
+double PaceHeart::get_p_lowrateInterval()
{
- return lowrateInterval;
+ return p_lowrateInterval;
}
-void PaceHeart::set_lowrateInterval(int x)
+void PaceHeart::set_p_lowrateInterval(double x)
{
- lowrateInterval = x;
+ if (p_pacingmode == 1) {
+
+ if (x >= 500 && x < 833.33) {
+ p_lowrateInterval = x+83.33;
+ }
+ else if (x >= 833.33 && x < 1000) {
+ p_lowrateInterval = x+16.67;
+ }
+ else if (x >= 1000 && x < 1500) {
+ p_lowrateInterval = x-16.67;
+ }
+ else if (x >= 1500 && x < 2916.67) {
+ p_lowrateInterval = x-83.33;
+ }
+ }
+ else {
+ p_lowrateInterval = x;
+ }
return;
}
-int PaceHeart::get_uprateInterval()
+double PaceHeart::get_p_uprateInterval()
{
- return uprateInterval;
+ return p_uprateInterval;
}
-void PaceHeart::set_uprateInterval(int x)
+void PaceHeart::set_p_uprateInterval(double x)
{
- uprateInterval = x;
+ if (p_pacingmode == 1) {
+ if (x >= 833.33 && x < 2000) {
+ p_uprateInterval = x+83.33;
+ }
+ else if (x >= 2000 && x <= 2916.67) {
+ p_uprateInterval = x-83.33;
+ }
+ }
+ else {
+ p_uprateInterval = x;
+ }
+ return;
+}
+double PaceHeart::get_p_maxSensorRate(){
+ return
+}
+void PaceHeart::set_p_maxSensorRate(double x)
+{
+ if (p_pacingmode == 1) {
+ if (x >= 833.33 && x < 2000) {
+ p_maxSensorRate = x+83.33;
+ }
+ else if (x >= 2000 && x <= 2916.67) {
+ p_maxSensorRate = x-83.33;
+ }
+ }
+ else {
+ p_maxSensorRate = x;
+ }
return;
}
//Ventricle
@@ -201,38 +246,38 @@
pace(mode);
return;
}
-int PaceHeart::get_activityThresh()
+int PaceHeart::get_p_activityThresh()
{
return p_activityThresh;
}
-int PaceHeart::get_reactionTime()
+int PaceHeart::get_p_reactionTime()
{
return p_reactionTime;
}
-int PaceHeart::get_responseFactor()
+int PaceHeart::get_p_responseFactor()
{
return p_responseFactor;
}
-int PaceHeart::get_recoveryTime()
+int PaceHeart::get_p_recoveryTime()
{
return p_recoveryTime;
}
-void PaceHeart::set_activityThresh(int x)
+void PaceHeart::set_p_activityThresh(int x)
{
p_activityThresh=x;
return;
}
-void PaceHeart::set_reactionTime(int x)
+void PaceHeart::set_p_reactionTime(int x)
{
p_reactionTime=x;
return;
}
-void PaceHeart::set_responseFactor(int x)
+void PaceHeart::set_p_responseFactor(int x)
{
p_responseFactor=x;
return;
}
-void PaceHeart::set_recoveryTime(int x)
+void PaceHeart::set_p_recoveryTime(int x)
{
p_recoveryTime=x;
return;
--- a/PaceHeart.h Mon Nov 14 21:36:01 2016 +0000
+++ b/PaceHeart.h Mon Nov 14 22:47:00 2016 +0000
@@ -10,8 +10,9 @@
int p_pacingMode;
int p_hysteresis;
int p_hysteresisInterval;
- int lowrateInterval;
- int uprateInterval; //upper rate limit
+ double p_lowrateInterval;
+ double p_uprateInterval; //upper rate limit
+ double p_maxSensorRate;
//Ventricle
double p_vPaceAmp;
double p_vPaceWidth;
@@ -20,10 +21,10 @@
double p_aPaceAmp;
double p_aPaceWidth;
int p_ARP;
- int activityThresh;
- int reactionTime;
- int responseFactor;
- int recoveryTime;
+ int p_activityThresh;
+ int p_reactionTime;
+ int p_responseFactor;
+ int p_recoveryTime;
public:
PaceHeart();
PaceHeart(int mode);
@@ -39,10 +40,12 @@
void set_p_hysteresis(int x);
int get_p_hysteresisInterval();
void set_p_hysteresisInterval(int x);
-int get_lowrateInterval();
-void set_lowrateInterval(int x);
-int get_uprateInterval();
-void set_uprateInterval(int x);
+double get_p_lowrateInterval();
+void set_p_lowrateInterval(double x);
+double get_p_uprateInterval();
+void set_p_uprateInterval(double x);
+double get_p_maxSensorRate();
+void set_p_maxSensorRate(double x);
double get_p_vPaceAmp();
void set_p_vPaceAmp(double x);
double get_p_vPaceWidth();
@@ -55,13 +58,13 @@
void set_p_aPaceWidth(double x);
int get_p_ARP();
void set_p_ARP(int x);
-int get_activityThresh();
-int get_reactionTime();
-int get_responseFactor();
-int get_recoveryTime();
-void set_activityThresh();
-void set_reactionTime();
-void set_responseFactor();
-void set_recoveryTime();
+int get_p_activityThresh();
+int get_p_reactionTime();
+int get_p_responseFactor();
+int get_p_recoveryTime();
+void set_p_activityThresh(int x);
+void set_p_reactionTime(int x);
+void set_p_responseFactor(int x);
+void set_p_recoveryTime(int x);
};
#endif
\ No newline at end of file
