Pacemaker code Implementation for SFWRENG 3K04

Dependencies:   mbed Queue mbed-rtos FXOS8700Q

Fork of Pacemaker by Eric dollar

SWFRENG 3K04 Project to design, develop, and document a functional pacemaker.

The project uses the Freescale K64F Microcontroller and C++ mbed library.

Committer:
noahzwiep
Date:
Sun Dec 18 02:29:59 2016 +0000
Revision:
36:b6431cd8ecd6
Parent:
35:fa164704f0ca
All ogre.

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 27:f8deff828a00 8 chamberData::chamberData(char chamberType){
FiveDollar 0:b2b3955cd77b 9 mychamber = chamberType;
noahzwiep 34:701503855d52 10 if(mychamber == 'v'){
noahzwiep 34:701503855d52 11 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
noahzwiep 34:701503855d52 12 p_PaceWidth = 0.4;
noahzwiep 34:701503855d52 13 p_RP = 320;
noahzwiep 34:701503855d52 14 p_Sensitivity = 2.5;
noahzwiep 34:701503855d52 15 }
noahzwiep 34:701503855d52 16 else{
noahzwiep 34:701503855d52 17 p_PaceAmp = 0.5;
noahzwiep 34:701503855d52 18 p_PaceWidth = 0.05;
noahzwiep 34:701503855d52 19 p_RP = 250;
noahzwiep 34:701503855d52 20 p_Sensitivity = 0.75;
noahzwiep 34:701503855d52 21 }
FiveDollar 0:b2b3955cd77b 22 }
FiveDollar 0:b2b3955cd77b 23 char chamberData::getChamberType(){
FiveDollar 0:b2b3955cd77b 24 return mychamber;
FiveDollar 0:b2b3955cd77b 25 }
FiveDollar 0:b2b3955cd77b 26
FiveDollar 20:bfd23a6845bb 27 int chamberData::chngPaceAmp(double amp){
FiveDollar 0:b2b3955cd77b 28 if(mychamber == 'a'){
FiveDollar 0:b2b3955cd77b 29 if(amp>3.2 || amp<0.5){
FiveDollar 20:bfd23a6845bb 30 return 0;
FiveDollar 20:bfd23a6845bb 31 }else{
FiveDollar 20:bfd23a6845bb 32 p_PaceAmp = (amp-0)/(7-0);
FiveDollar 20:bfd23a6845bb 33 return 1;
FiveDollar 20:bfd23a6845bb 34 }
FiveDollar 0:b2b3955cd77b 35 }else{
FiveDollar 0:b2b3955cd77b 36 if(amp>7 || amp<3.5){
FiveDollar 20:bfd23a6845bb 37 return 0;
FiveDollar 20:bfd23a6845bb 38 }else{
FiveDollar 20:bfd23a6845bb 39 p_PaceAmp = (amp-0)/(7-0);
FiveDollar 20:bfd23a6845bb 40 return 1;
FiveDollar 20:bfd23a6845bb 41 }
FiveDollar 0:b2b3955cd77b 42 }
FiveDollar 0:b2b3955cd77b 43 }
FiveDollar 0:b2b3955cd77b 44
FiveDollar 0:b2b3955cd77b 45 double chamberData::getPaceAmp(){
FiveDollar 0:b2b3955cd77b 46 return p_PaceAmp;
FiveDollar 0:b2b3955cd77b 47 }
FiveDollar 0:b2b3955cd77b 48
FiveDollar 20:bfd23a6845bb 49 int chamberData::chngPaceWidth(double width){
FiveDollar 0:b2b3955cd77b 50 if(mychamber == 'a'){
FiveDollar 20:bfd23a6845bb 51 if(width!=0.05){
FiveDollar 20:bfd23a6845bb 52 return 0;
FiveDollar 20:bfd23a6845bb 53 }else{
FiveDollar 20:bfd23a6845bb 54 p_PaceWidth = width;
FiveDollar 20:bfd23a6845bb 55 return 1;
FiveDollar 20:bfd23a6845bb 56 }
FiveDollar 0:b2b3955cd77b 57 }else{
FiveDollar 20:bfd23a6845bb 58 if(width>1.9 || width< 0.1){
FiveDollar 20:bfd23a6845bb 59 return 0;
FiveDollar 20:bfd23a6845bb 60 }else{
FiveDollar 20:bfd23a6845bb 61 p_PaceWidth = width;
FiveDollar 20:bfd23a6845bb 62 return 1;
FiveDollar 20:bfd23a6845bb 63 }
FiveDollar 0:b2b3955cd77b 64 }
FiveDollar 0:b2b3955cd77b 65 }
FiveDollar 0:b2b3955cd77b 66
FiveDollar 0:b2b3955cd77b 67 double chamberData::getPaceWidth(){
FiveDollar 0:b2b3955cd77b 68 return p_PaceWidth;
FiveDollar 0:b2b3955cd77b 69 }
FiveDollar 0:b2b3955cd77b 70
FiveDollar 20:bfd23a6845bb 71 int chamberData::chngRP(double RP){
FiveDollar 0:b2b3955cd77b 72 if(mychamber == 'a'){
FiveDollar 20:bfd23a6845bb 73 if(RP>500 || RP<150){
FiveDollar 20:bfd23a6845bb 74 return 0;
FiveDollar 20:bfd23a6845bb 75 }else{
FiveDollar 20:bfd23a6845bb 76 p_RP = RP;
FiveDollar 20:bfd23a6845bb 77 return 1;
FiveDollar 20:bfd23a6845bb 78 }
FiveDollar 0:b2b3955cd77b 79 }else{
FiveDollar 20:bfd23a6845bb 80 if(RP>500 || RP< 150){
FiveDollar 20:bfd23a6845bb 81 return 0;
FiveDollar 20:bfd23a6845bb 82 }else{
FiveDollar 20:bfd23a6845bb 83 p_RP = RP;
FiveDollar 20:bfd23a6845bb 84 return 1;
FiveDollar 20:bfd23a6845bb 85 }
FiveDollar 0:b2b3955cd77b 86 }
FiveDollar 0:b2b3955cd77b 87 }
FiveDollar 0:b2b3955cd77b 88
FiveDollar 0:b2b3955cd77b 89 double chamberData::getRP(){
FiveDollar 0:b2b3955cd77b 90 return p_RP;
FiveDollar 0:b2b3955cd77b 91 }
FiveDollar 0:b2b3955cd77b 92
FiveDollar 20:bfd23a6845bb 93 int chamberData::chngSensitivity(double sensitivity){
FiveDollar 0:b2b3955cd77b 94 if(mychamber == 'a'){
noahzwiep 34:701503855d52 95 if(sensitivity <0.05 || sensitivity > 0.75){
FiveDollar 20:bfd23a6845bb 96 return 0;
FiveDollar 20:bfd23a6845bb 97 }else{
FiveDollar 20:bfd23a6845bb 98 p_Sensitivity = sensitivity;
FiveDollar 20:bfd23a6845bb 99 return 1;
FiveDollar 20:bfd23a6845bb 100 }
FiveDollar 0:b2b3955cd77b 101 }else{
FiveDollar 20:bfd23a6845bb 102 if(sensitivity>10 || sensitivity< 1){
FiveDollar 20:bfd23a6845bb 103 return 0;
FiveDollar 20:bfd23a6845bb 104 }else{
FiveDollar 20:bfd23a6845bb 105 p_Sensitivity = sensitivity;
FiveDollar 20:bfd23a6845bb 106 return 1;
FiveDollar 20:bfd23a6845bb 107 }
FiveDollar 0:b2b3955cd77b 108 }
FiveDollar 0:b2b3955cd77b 109 }
FiveDollar 0:b2b3955cd77b 110
FiveDollar 0:b2b3955cd77b 111 double chamberData::getSensitivity(){
FiveDollar 0:b2b3955cd77b 112 return p_Sensitivity;
FiveDollar 0:b2b3955cd77b 113 }
noahzwiep 35:fa164704f0ca 114
noahzwiep 35:fa164704f0ca 115 void chamberData::setMarker(char a){
noahzwiep 35:fa164704f0ca 116 f_marker = a;
noahzwiep 35:fa164704f0ca 117 }
noahzwiep 35:fa164704f0ca 118
noahzwiep 35:fa164704f0ca 119 char chamberData::getMarker(){
noahzwiep 35:fa164704f0ca 120 return f_marker;
noahzwiep 35:fa164704f0ca 121 }
FiveDollar 0:b2b3955cd77b 122 chamberData::~chamberData(){}