Pacemaker code Implementation for SFWRENG 3K04
Dependencies: FXOS8700Q Queue mbed-rtos mbed
Fork of Pacemaker by
genData.cpp@20:bfd23a6845bb, 2016-11-24 (annotated)
- Committer:
- FiveDollar
- Date:
- Thu Nov 24 03:26:14 2016 +0000
- Revision:
- 20:bfd23a6845bb
- Parent:
- 1:fbba2687ddfe
All values can now be updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
FiveDollar | 0:b2b3955cd77b | 1 | #pragma once |
FiveDollar | 0:b2b3955cd77b | 2 | #include "mbed.h" |
FiveDollar | 0:b2b3955cd77b | 3 | #include "genData.h" |
FiveDollar | 0:b2b3955cd77b | 4 | |
FiveDollar | 0:b2b3955cd77b | 5 | genData::genData(){ |
FiveDollar | 0:b2b3955cd77b | 6 | p_hysteresis = false; |
FiveDollar | 20:bfd23a6845bb | 7 | p_hysteresisRateLimit = 0; |
FiveDollar | 0:b2b3955cd77b | 8 | p_lowerRateLimit = 0; |
FiveDollar | 0:b2b3955cd77b | 9 | p_upperRateLimit = 0; |
FiveDollar | 0:b2b3955cd77b | 10 | p_AVdelay = 0; |
FiveDollar | 0:b2b3955cd77b | 11 | p_AVdelayOffset = 0; |
FiveDollar | 0:b2b3955cd77b | 12 | p_rateSmoothing = 0; |
FiveDollar | 0:b2b3955cd77b | 13 | p_pacingMode = VVI; |
FiveDollar | 0:b2b3955cd77b | 14 | p_pacingState = PERMANENT; |
FiveDollar | 0:b2b3955cd77b | 15 | } |
FiveDollar | 0:b2b3955cd77b | 16 | |
FiveDollar | 1:fbba2687ddfe | 17 | void genData::chngHyst(bool chng){ |
FiveDollar | 1:fbba2687ddfe | 18 | p_hysteresis = chng; |
FiveDollar | 1:fbba2687ddfe | 19 | } |
FiveDollar | 1:fbba2687ddfe | 20 | |
FiveDollar | 1:fbba2687ddfe | 21 | bool genData::getHyst(){ |
FiveDollar | 1:fbba2687ddfe | 22 | return p_hysteresis; |
FiveDollar | 1:fbba2687ddfe | 23 | } |
FiveDollar | 1:fbba2687ddfe | 24 | |
FiveDollar | 20:bfd23a6845bb | 25 | int genData::chngHystRL(double val){ |
FiveDollar | 20:bfd23a6845bb | 26 | if(val >= 30 && val <= 175){ |
FiveDollar | 20:bfd23a6845bb | 27 | p_hysteresisRateLimit = val; |
FiveDollar | 20:bfd23a6845bb | 28 | return 1; |
FiveDollar | 20:bfd23a6845bb | 29 | }else{ |
FiveDollar | 20:bfd23a6845bb | 30 | return 0; |
FiveDollar | 20:bfd23a6845bb | 31 | } |
FiveDollar | 1:fbba2687ddfe | 32 | } |
FiveDollar | 1:fbba2687ddfe | 33 | |
FiveDollar | 20:bfd23a6845bb | 34 | double genData::getHystRL(){ |
FiveDollar | 20:bfd23a6845bb | 35 | return p_hysteresisRateLimit; |
FiveDollar | 1:fbba2687ddfe | 36 | } |
FiveDollar | 1:fbba2687ddfe | 37 | |
FiveDollar | 20:bfd23a6845bb | 38 | int genData::chngLRL(double val){ |
FiveDollar | 20:bfd23a6845bb | 39 | if(val >= 30 && val <= 175){ |
FiveDollar | 20:bfd23a6845bb | 40 | p_lowerRateLimit = val; |
FiveDollar | 20:bfd23a6845bb | 41 | return 1; |
FiveDollar | 20:bfd23a6845bb | 42 | }else{ |
FiveDollar | 20:bfd23a6845bb | 43 | return 0; |
FiveDollar | 20:bfd23a6845bb | 44 | } |
FiveDollar | 1:fbba2687ddfe | 45 | } |
FiveDollar | 1:fbba2687ddfe | 46 | |
FiveDollar | 1:fbba2687ddfe | 47 | double genData::getLRL(){ |
FiveDollar | 1:fbba2687ddfe | 48 | return p_lowerRateLimit; |
FiveDollar | 1:fbba2687ddfe | 49 | } |
FiveDollar | 1:fbba2687ddfe | 50 | |
FiveDollar | 20:bfd23a6845bb | 51 | int genData::chngURL(double val){ |
FiveDollar | 20:bfd23a6845bb | 52 | if(val >= 50 && val <= 175){ |
FiveDollar | 20:bfd23a6845bb | 53 | p_upperRateLimit = val; |
FiveDollar | 20:bfd23a6845bb | 54 | return 1; |
FiveDollar | 20:bfd23a6845bb | 55 | }else{ |
FiveDollar | 20:bfd23a6845bb | 56 | return 0; |
FiveDollar | 20:bfd23a6845bb | 57 | } |
FiveDollar | 1:fbba2687ddfe | 58 | } |
FiveDollar | 1:fbba2687ddfe | 59 | |
FiveDollar | 1:fbba2687ddfe | 60 | double genData::getURL(){ |
FiveDollar | 1:fbba2687ddfe | 61 | return p_upperRateLimit; |
FiveDollar | 1:fbba2687ddfe | 62 | } |
FiveDollar | 1:fbba2687ddfe | 63 | |
FiveDollar | 20:bfd23a6845bb | 64 | int genData::chngAVdelay(double val){ |
FiveDollar | 20:bfd23a6845bb | 65 | if(val >= 70 && val <= 300){ |
FiveDollar | 20:bfd23a6845bb | 66 | p_AVdelay = val; |
FiveDollar | 20:bfd23a6845bb | 67 | return 1; |
FiveDollar | 20:bfd23a6845bb | 68 | }else{ |
FiveDollar | 20:bfd23a6845bb | 69 | return 0; |
FiveDollar | 20:bfd23a6845bb | 70 | } |
FiveDollar | 1:fbba2687ddfe | 71 | } |
FiveDollar | 1:fbba2687ddfe | 72 | |
FiveDollar | 1:fbba2687ddfe | 73 | double genData::getAVdelay(){ |
FiveDollar | 1:fbba2687ddfe | 74 | return p_AVdelay; |
FiveDollar | 1:fbba2687ddfe | 75 | } |
FiveDollar | 1:fbba2687ddfe | 76 | |
FiveDollar | 20:bfd23a6845bb | 77 | int genData::chngAVdelayOffset(double val){ |
FiveDollar | 20:bfd23a6845bb | 78 | if(val >= -10 && val <= -100){ |
FiveDollar | 20:bfd23a6845bb | 79 | p_AVdelayOffset = val; |
FiveDollar | 20:bfd23a6845bb | 80 | return 1; |
FiveDollar | 20:bfd23a6845bb | 81 | }else{ |
FiveDollar | 20:bfd23a6845bb | 82 | return 0; |
FiveDollar | 20:bfd23a6845bb | 83 | } |
FiveDollar | 1:fbba2687ddfe | 84 | } |
FiveDollar | 1:fbba2687ddfe | 85 | |
FiveDollar | 1:fbba2687ddfe | 86 | double genData::getAVdelayOffset(){ |
FiveDollar | 1:fbba2687ddfe | 87 | return p_AVdelayOffset; |
FiveDollar | 1:fbba2687ddfe | 88 | } |
FiveDollar | 1:fbba2687ddfe | 89 | |
FiveDollar | 20:bfd23a6845bb | 90 | int genData::chngRSmooth(double val){ |
FiveDollar | 20:bfd23a6845bb | 91 | |
FiveDollar | 20:bfd23a6845bb | 92 | if(val >= 3 && val <= 25){ |
FiveDollar | 20:bfd23a6845bb | 93 | p_rateSmoothing = val; |
FiveDollar | 20:bfd23a6845bb | 94 | return 1; |
FiveDollar | 20:bfd23a6845bb | 95 | }else{ |
FiveDollar | 20:bfd23a6845bb | 96 | return 0; |
FiveDollar | 20:bfd23a6845bb | 97 | } |
FiveDollar | 1:fbba2687ddfe | 98 | } |
FiveDollar | 1:fbba2687ddfe | 99 | |
FiveDollar | 1:fbba2687ddfe | 100 | double genData::getRSmooth(){ |
FiveDollar | 1:fbba2687ddfe | 101 | return p_rateSmoothing; |
FiveDollar | 1:fbba2687ddfe | 102 | } |
FiveDollar | 1:fbba2687ddfe | 103 | |
FiveDollar | 0:b2b3955cd77b | 104 | void genData::chngMode(Mode mode){ |
FiveDollar | 0:b2b3955cd77b | 105 | p_pacingMode = mode; |
FiveDollar | 0:b2b3955cd77b | 106 | } |
FiveDollar | 0:b2b3955cd77b | 107 | |
FiveDollar | 0:b2b3955cd77b | 108 | genData::Mode genData::getMode(){ |
FiveDollar | 0:b2b3955cd77b | 109 | return p_pacingMode; |
FiveDollar | 0:b2b3955cd77b | 110 | } |
FiveDollar | 0:b2b3955cd77b | 111 | |
FiveDollar | 0:b2b3955cd77b | 112 | void genData::chngState(State state){ |
FiveDollar | 0:b2b3955cd77b | 113 | p_pacingState = state; |
FiveDollar | 0:b2b3955cd77b | 114 | } |
FiveDollar | 0:b2b3955cd77b | 115 | |
FiveDollar | 0:b2b3955cd77b | 116 | genData::State genData::getState(){ |
FiveDollar | 0:b2b3955cd77b | 117 | return p_pacingState; |
FiveDollar | 0:b2b3955cd77b | 118 | } |
FiveDollar | 0:b2b3955cd77b | 119 | |
FiveDollar | 0:b2b3955cd77b | 120 | |
FiveDollar | 0:b2b3955cd77b | 121 | |
FiveDollar | 0:b2b3955cd77b | 122 | genData::~genData(){} |