eric's fork test

Dependencies:   mbed

Fork of Pacemaker by 3k04 team

Committer:
FiveDollar
Date:
Mon Nov 14 01:27:31 2016 +0000
Revision:
2:fbba2687ddfe
Parent:
0:b2b3955cd77b
nov 13 commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
FiveDollar 0:b2b3955cd77b 1 #pragma once
FiveDollar 0:b2b3955cd77b 2 #include "mbed.h"
FiveDollar 0:b2b3955cd77b 3 #include "chamberData.h"
FiveDollar 0:b2b3955cd77b 4
FiveDollar 0:b2b3955cd77b 5 chamberData::chamberData(){
FiveDollar 0:b2b3955cd77b 6 }
FiveDollar 0:b2b3955cd77b 7
FiveDollar 0:b2b3955cd77b 8 chamberData::chamberData(Serial* inputPC, char chamberType){
FiveDollar 2:fbba2687ddfe 9 p_PaceAmp = 3.75; //decimal value between 0 and 1 which is a factor applied to 3.3V output. ie. 0.5 will give 0.5(3.3) V of output
FiveDollar 2:fbba2687ddfe 10 p_PaceWidth = 0.4;
FiveDollar 0:b2b3955cd77b 11 p_RP = 0;
FiveDollar 0:b2b3955cd77b 12 p_Sensitivity = 0;
FiveDollar 0:b2b3955cd77b 13 mychamber = chamberType;
FiveDollar 0:b2b3955cd77b 14 pc = inputPC;
FiveDollar 0:b2b3955cd77b 15
FiveDollar 0:b2b3955cd77b 16 }
FiveDollar 0:b2b3955cd77b 17 char chamberData::getChamberType(){
FiveDollar 0:b2b3955cd77b 18 return mychamber;
FiveDollar 0:b2b3955cd77b 19 }
FiveDollar 0:b2b3955cd77b 20
FiveDollar 0:b2b3955cd77b 21 void chamberData::chngPaceAmp(double amp){
FiveDollar 0:b2b3955cd77b 22 if(mychamber == 'a'){
FiveDollar 0:b2b3955cd77b 23 if(amp>3.2 || amp<0.5){
FiveDollar 0:b2b3955cd77b 24 pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 25 }else p_PaceAmp = (amp-0)/(7-0);
FiveDollar 0:b2b3955cd77b 26 }else{
FiveDollar 0:b2b3955cd77b 27 if(amp>7 || amp<3.5){
FiveDollar 0:b2b3955cd77b 28 pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 29 }else p_PaceAmp = (amp-0)/(7-0);
FiveDollar 0:b2b3955cd77b 30 }
FiveDollar 0:b2b3955cd77b 31 }
FiveDollar 0:b2b3955cd77b 32
FiveDollar 0:b2b3955cd77b 33 double chamberData::getPaceAmp(){
FiveDollar 0:b2b3955cd77b 34 return p_PaceAmp;
FiveDollar 0:b2b3955cd77b 35 }
FiveDollar 0:b2b3955cd77b 36
FiveDollar 0:b2b3955cd77b 37 void chamberData::chngPaceWidth(double width){
FiveDollar 0:b2b3955cd77b 38 if(mychamber == 'a'){
FiveDollar 0:b2b3955cd77b 39 if(width!=0.05){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 40 }else p_PaceWidth = width;
FiveDollar 0:b2b3955cd77b 41 }else{
FiveDollar 0:b2b3955cd77b 42 if(width>1.9 || width< 0.1){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 43 }else p_PaceWidth = width;
FiveDollar 0:b2b3955cd77b 44 }
FiveDollar 0:b2b3955cd77b 45 }
FiveDollar 0:b2b3955cd77b 46
FiveDollar 0:b2b3955cd77b 47 double chamberData::getPaceWidth(){
FiveDollar 0:b2b3955cd77b 48 return p_PaceWidth;
FiveDollar 0:b2b3955cd77b 49 }
FiveDollar 0:b2b3955cd77b 50
FiveDollar 0:b2b3955cd77b 51 void chamberData::chngRP(double RP){
FiveDollar 0:b2b3955cd77b 52 if(mychamber == 'a'){
FiveDollar 0:b2b3955cd77b 53 if(RP>500 || RP<150){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 54 }else p_RP = RP;
FiveDollar 0:b2b3955cd77b 55 }else{
FiveDollar 0:b2b3955cd77b 56 if(RP>500 || RP< 150){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 57 }else p_RP = RP;
FiveDollar 0:b2b3955cd77b 58 }
FiveDollar 0:b2b3955cd77b 59 }
FiveDollar 0:b2b3955cd77b 60
FiveDollar 0:b2b3955cd77b 61 double chamberData::getRP(){
FiveDollar 0:b2b3955cd77b 62 return p_RP;
FiveDollar 0:b2b3955cd77b 63 }
FiveDollar 0:b2b3955cd77b 64
FiveDollar 0:b2b3955cd77b 65 void chamberData::chngSensitivity(double sensitivity){
FiveDollar 0:b2b3955cd77b 66 if(mychamber == 'a'){
FiveDollar 0:b2b3955cd77b 67 if(sensitivity!=0.05 || sensitivity!= 0.25 || sensitivity!=0.75){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 68 }else p_Sensitivity = sensitivity;
FiveDollar 0:b2b3955cd77b 69 }else{
FiveDollar 0:b2b3955cd77b 70 if(sensitivity>10 || sensitivity< 1){pc->printf("\nThat value is not within range.");
FiveDollar 0:b2b3955cd77b 71 }else p_Sensitivity = sensitivity;
FiveDollar 0:b2b3955cd77b 72 }
FiveDollar 0:b2b3955cd77b 73 }
FiveDollar 0:b2b3955cd77b 74
FiveDollar 0:b2b3955cd77b 75 double chamberData::getSensitivity(){
FiveDollar 0:b2b3955cd77b 76 return p_Sensitivity;
FiveDollar 0:b2b3955cd77b 77 }
FiveDollar 0:b2b3955cd77b 78 chamberData::~chamberData(){}