![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Part of the Pacemaker Project; this models the Pacemaker.
Dependencies: mbed TextLCD mbed-rtos
PacemakerController.cpp@40:e401b1cb71c0, 2015-12-02 (annotated)
- Committer:
- chadnach1
- Date:
- Wed Dec 02 05:23:52 2015 +0000
- Revision:
- 40:e401b1cb71c0
- Parent:
- 38:ceabf8f1dfa0
- Parent:
- 39:51c4ec84f6fd
- Child:
- 42:2e4ed3a53c64
merged i think;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chadnach1 | 0:d92e0b71c6b5 | 1 | #include "mbed.h" |
lucastai | 2:5e9c4d83d038 | 2 | #include "LPC17xx.h" |
lucastai | 2:5e9c4d83d038 | 3 | #include "TextLCD.h" |
lucastai | 2:5e9c4d83d038 | 4 | #include "rtos.h" |
lucastai | 2:5e9c4d83d038 | 5 | #include "Thread.h" |
lucastai | 2:5e9c4d83d038 | 6 | using namespace rtos; |
chadnach1 | 0:d92e0b71c6b5 | 7 | |
chadnach1 | 0:d92e0b71c6b5 | 8 | // This is for the pacemaker |
lucastai | 2:5e9c4d83d038 | 9 | volatile unsigned short timer_count; |
lucastai | 2:5e9c4d83d038 | 10 | Serial pc(USBTX, USBRX); |
lucastai | 2:5e9c4d83d038 | 11 | TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7 |
lucastai | 2:5e9c4d83d038 | 12 | |
mhowar | 5:9eee15818b0e | 13 | int keyboard_needs_numeric = 0; // boolean - is in middle of interval input? |
chadnach1 | 0:d92e0b71c6b5 | 14 | |
chadnach1 | 0:d92e0b71c6b5 | 15 | int h_clock; |
amiche | 3:44d132582373 | 16 | int pm_clock; |
chadnach1 | 27:2c5aefcf3000 | 17 | Timer avi_clk; |
chadnach1 | 32:c58b6651336c | 18 | Timer t_count; |
chadnach1 | 0:d92e0b71c6b5 | 19 | |
amiche | 38:ceabf8f1dfa0 | 20 | int LRI = 100; |
amiche | 38:ceabf8f1dfa0 | 21 | int AVI = 30; |
amiche | 38:ceabf8f1dfa0 | 22 | int PVARP = 150; |
amiche | 38:ceabf8f1dfa0 | 23 | int VRP = 100; |
lucastai | 2:5e9c4d83d038 | 24 | |
lucastai | 2:5e9c4d83d038 | 25 | // constants |
lucastai | 2:5e9c4d83d038 | 26 | int MAX_PM_RT = 180; |
lucastai | 2:5e9c4d83d038 | 27 | int MIN_PM_RT = 40; |
lucastai | 2:5e9c4d83d038 | 28 | enum mode {NORMAL, SLEEP, EXERCISE, MANUAL}; |
lucastai | 2:5e9c4d83d038 | 29 | |
lucastai | 2:5e9c4d83d038 | 30 | // counters |
lucastai | 2:5e9c4d83d038 | 31 | int beats = 0; |
lucastai | 2:5e9c4d83d038 | 32 | |
lucastai | 2:5e9c4d83d038 | 33 | // state variables |
lucastai | 2:5e9c4d83d038 | 34 | int upper_bound = 100; |
lucastai | 2:5e9c4d83d038 | 35 | int lower_bound = 40; |
lucastai | 2:5e9c4d83d038 | 36 | int obs_int = 10; |
lucastai | 2:5e9c4d83d038 | 37 | mode curr_mode = NORMAL; |
lucastai | 2:5e9c4d83d038 | 38 | |
amiche | 19:f3615321b5c4 | 39 | // alarms |
lucastai | 14:a16b636c2bbc | 40 | DigitalOut led_apace(LED1); |
lucastai | 14:a16b636c2bbc | 41 | DigitalOut led_vpace(LED2); |
chadnach1 | 33:b68c1648206e | 42 | DigitalOut led_asense(LED3); |
chadnach1 | 33:b68c1648206e | 43 | DigitalOut led_vsense(LED4); |
lucastai | 2:5e9c4d83d038 | 44 | |
chadnach1 | 27:2c5aefcf3000 | 45 | DigitalIn agetSignal(p24); |
chadnach1 | 27:2c5aefcf3000 | 46 | DigitalIn vgetSignal(p23); |
chadnach1 | 27:2c5aefcf3000 | 47 | DigitalOut apaceSignal(p22); |
chadnach1 | 27:2c5aefcf3000 | 48 | DigitalOut vpaceSignal(p21); |
chadnach1 | 27:2c5aefcf3000 | 49 | |
chadnach1 | 27:2c5aefcf3000 | 50 | bool v_sense; |
chadnach1 | 27:2c5aefcf3000 | 51 | bool a_sense; |
chadnach1 | 27:2c5aefcf3000 | 52 | |
chadnach1 | 27:2c5aefcf3000 | 53 | void asense() |
chadnach1 | 27:2c5aefcf3000 | 54 | { |
chadnach1 | 27:2c5aefcf3000 | 55 | a_sense = 1; |
chadnach1 | 33:b68c1648206e | 56 | led_asense = 1; |
chadnach1 | 27:2c5aefcf3000 | 57 | Thread::wait(10); |
chadnach1 | 33:b68c1648206e | 58 | led_asense = 0; |
chadnach1 | 27:2c5aefcf3000 | 59 | a_sense = 0; |
chadnach1 | 27:2c5aefcf3000 | 60 | } |
lucastai | 18:d4cd9d12345e | 61 | |
chadnach1 | 27:2c5aefcf3000 | 62 | void vsense() |
chadnach1 | 27:2c5aefcf3000 | 63 | { |
chadnach1 | 27:2c5aefcf3000 | 64 | v_sense = 1; |
chadnach1 | 33:b68c1648206e | 65 | led_vsense = 1; |
chadnach1 | 27:2c5aefcf3000 | 66 | Thread::wait(10); |
chadnach1 | 33:b68c1648206e | 67 | led_vsense = 0; |
chadnach1 | 27:2c5aefcf3000 | 68 | v_sense = 0; |
chadnach1 | 27:2c5aefcf3000 | 69 | } |
chadnach1 | 27:2c5aefcf3000 | 70 | |
chadnach1 | 27:2c5aefcf3000 | 71 | void apace() |
chadnach1 | 27:2c5aefcf3000 | 72 | { |
chadnach1 | 27:2c5aefcf3000 | 73 | apaceSignal = 1; |
chadnach1 | 27:2c5aefcf3000 | 74 | led_apace = 1; |
chadnach1 | 27:2c5aefcf3000 | 75 | Thread::wait(10); |
chadnach1 | 33:b68c1648206e | 76 | led_apace = 0; |
chadnach1 | 27:2c5aefcf3000 | 77 | apaceSignal = 0; |
chadnach1 | 27:2c5aefcf3000 | 78 | |
chadnach1 | 27:2c5aefcf3000 | 79 | } |
chadnach1 | 27:2c5aefcf3000 | 80 | |
chadnach1 | 27:2c5aefcf3000 | 81 | void vpace() |
chadnach1 | 27:2c5aefcf3000 | 82 | { |
chadnach1 | 27:2c5aefcf3000 | 83 | vpaceSignal = 1; |
chadnach1 | 27:2c5aefcf3000 | 84 | led_vpace = 1; |
chadnach1 | 27:2c5aefcf3000 | 85 | Thread::wait(10); |
chadnach1 | 33:b68c1648206e | 86 | led_vpace = 0; |
chadnach1 | 27:2c5aefcf3000 | 87 | vpaceSignal = 0; |
chadnach1 | 27:2c5aefcf3000 | 88 | |
chadnach1 | 27:2c5aefcf3000 | 89 | } |
amiche | 24:81cd9ef5c4f6 | 90 | |
lucastai | 2:5e9c4d83d038 | 91 | // hardware interrupt handler, adapted from code in piazza post by Dagaen |
chadnach1 | 33:b68c1648206e | 92 | /*extern "C" void TIMER0_IRQHandler (void) |
lucastai | 2:5e9c4d83d038 | 93 | { |
amiche | 19:f3615321b5c4 | 94 | if((LPC_TIM0->IR & 0x01) == 0x01) { // if MR0 interrupt, proceed |
amiche | 19:f3615321b5c4 | 95 | LPC_TIM0->IR |= 1 << 0; // Clear MR0 interrupt flag |
amiche | 19:f3615321b5c4 | 96 | timer_count++; //increment timer_count |
lucastai | 2:5e9c4d83d038 | 97 | } |
lucastai | 2:5e9c4d83d038 | 98 | } |
chadnach1 | 33:b68c1648206e | 99 | */ |
chadnach1 | 33:b68c1648206e | 100 | /*// init the hardware interrupt (timer0), adapted same as above |
lucastai | 2:5e9c4d83d038 | 101 | void timer0_init(void) |
lucastai | 2:5e9c4d83d038 | 102 | { |
lucastai | 2:5e9c4d83d038 | 103 | LPC_SC->PCONP |=1<1; //timer0 power on |
lucastai | 2:5e9c4d83d038 | 104 | LPC_SC-> PCLKSEL0 |= 1 << 2; // set timer clock to CCLCK nondivided (1 clock cycle = 1 increment) |
lucastai | 2:5e9c4d83d038 | 105 | LPC_TIM0->MR0 = 1000000; //100mhz clock cycle, 1 cycle = 10ns, 10ms = 10 000 000 ns = 1M cycles |
lucastai | 2:5e9c4d83d038 | 106 | LPC_TIM0->MCR = 3; //interrupt and reset control |
amiche | 19:f3615321b5c4 | 107 | //3 = Interrupt & reset timer0 on match (111) sets all three bits |
lucastai | 2:5e9c4d83d038 | 108 | NVIC_EnableIRQ(TIMER0_IRQn); //enable timer0 interrupt |
chadnach1 | 33:b68c1648206e | 109 | }*/ |
chadnach1 | 0:d92e0b71c6b5 | 110 | |
lucastai | 2:5e9c4d83d038 | 111 | |
chadnach1 | 27:2c5aefcf3000 | 112 | void PM_ALARM(void const *args) |
amiche | 19:f3615321b5c4 | 113 | { |
chadnach1 | 29:5cec671cb80d | 114 | while (1) { |
chadnach1 | 29:5cec671cb80d | 115 | // min hr alarm |
chadnach1 | 29:5cec671cb80d | 116 | if( beats < MIN_PM_RT) { |
chadnach1 | 30:97db5a684eaa | 117 | lcd.cls(); |
chadnach1 | 29:5cec671cb80d | 118 | lcd.locate(0,1); |
chadnach1 | 30:97db5a684eaa | 119 | lcd.printf("!<\n"); |
chadnach1 | 29:5cec671cb80d | 120 | } |
chadnach1 | 31:7f0e865e3d4b | 121 | |
chadnach1 | 29:5cec671cb80d | 122 | // max hr alarm |
chadnach1 | 29:5cec671cb80d | 123 | if(beats > MAX_PM_RT) { |
chadnach1 | 30:97db5a684eaa | 124 | lcd.cls(); |
chadnach1 | 29:5cec671cb80d | 125 | lcd.locate(0,1); |
chadnach1 | 30:97db5a684eaa | 126 | lcd.printf("!>\n"); |
chadnach1 | 29:5cec671cb80d | 127 | } |
amiche | 19:f3615321b5c4 | 128 | } |
amiche | 19:f3615321b5c4 | 129 | |
chadnach1 | 0:d92e0b71c6b5 | 130 | } |
chadnach1 | 0:d92e0b71c6b5 | 131 | |
lucastai | 2:5e9c4d83d038 | 132 | // hw interrupt callback, deal with the keyboard input from PC |
lucastai | 2:5e9c4d83d038 | 133 | |
chadnach1 | 27:2c5aefcf3000 | 134 | void pm_sense(void const *args) |
amiche | 19:f3615321b5c4 | 135 | { |
amiche | 19:f3615321b5c4 | 136 | |
chadnach1 | 4:f04eb7f96f4b | 137 | while(1) { |
chadnach1 | 33:b68c1648206e | 138 | /*if (agetSignal == 0) { |
chadnach1 | 33:b68c1648206e | 139 | pc.printf("Aget:LO\n"); |
chadnach1 | 33:b68c1648206e | 140 | } |
chadnach1 | 33:b68c1648206e | 141 | |
chadnach1 | 33:b68c1648206e | 142 | if (vgetSignal == 0) { |
chadnach1 | 33:b68c1648206e | 143 | pc.printf("Vget:LO\n"); |
chadnach1 | 33:b68c1648206e | 144 | } |
chadnach1 | 33:b68c1648206e | 145 | if (agetSignal == 1) { |
chadnach1 | 33:b68c1648206e | 146 | pc.printf("Aget:HI\n"); |
chadnach1 | 33:b68c1648206e | 147 | } |
chadnach1 | 33:b68c1648206e | 148 | |
chadnach1 | 33:b68c1648206e | 149 | if (vgetSignal == 1) { |
chadnach1 | 33:b68c1648206e | 150 | pc.printf("Vget:HI\n"); |
chadnach1 | 33:b68c1648206e | 151 | }*/ |
chadnach1 | 33:b68c1648206e | 152 | |
amiche | 19:f3615321b5c4 | 153 | |
chadnach1 | 33:b68c1648206e | 154 | if (t_count.read_ms() >= VRP && vgetSignal == 1) { |
chadnach1 | 34:b4b50ca26e8c | 155 | |
amiche | 24:81cd9ef5c4f6 | 156 | // Valid_V state |
chadnach1 | 32:c58b6651336c | 157 | t_count.reset(); |
amiche | 24:81cd9ef5c4f6 | 158 | vsense(); |
amiche | 24:81cd9ef5c4f6 | 159 | |
chadnach1 | 33:b68c1648206e | 160 | } else if (t_count.read_ms() < VRP && vgetSignal == 1) { |
chadnach1 | 34:b4b50ca26e8c | 161 | //pc.printf("invalid v state\n"); |
chadnach1 | 32:c58b6651336c | 162 | |
chadnach1 | 20:dc272bfaa276 | 163 | // Invalid_V state |
chadnach1 | 4:f04eb7f96f4b | 164 | } |
amiche | 19:f3615321b5c4 | 165 | |
chadnach1 | 33:b68c1648206e | 166 | if (t_count.read_ms() < PVARP && agetSignal == 1) { |
chadnach1 | 20:dc272bfaa276 | 167 | // Invalid_A state |
chadnach1 | 34:b4b50ca26e8c | 168 | |
chadnach1 | 34:b4b50ca26e8c | 169 | //pc.printf("invalid a state\n"); |
chadnach1 | 33:b68c1648206e | 170 | } else if (t_count.read_ms() >= PVARP && agetSignal == 1) { |
chadnach1 | 20:dc272bfaa276 | 171 | // Valid_A state |
amiche | 24:81cd9ef5c4f6 | 172 | asense(); |
chadnach1 | 4:f04eb7f96f4b | 173 | } |
chadnach1 | 4:f04eb7f96f4b | 174 | } |
amiche | 3:44d132582373 | 175 | } |
amiche | 3:44d132582373 | 176 | |
chadnach1 | 27:2c5aefcf3000 | 177 | void pm_response(void const *args) |
amiche | 19:f3615321b5c4 | 178 | { |
chadnach1 | 4:f04eb7f96f4b | 179 | while(1) { |
chadnach1 | 34:b4b50ca26e8c | 180 | |
chadnach1 | 27:2c5aefcf3000 | 181 | bool goInitalState = 1; |
chadnach1 | 33:b68c1648206e | 182 | if (t_count.read_ms() >= LRI - AVI) { |
chadnach1 | 33:b68c1648206e | 183 | |
chadnach1 | 27:2c5aefcf3000 | 184 | goInitalState = 0; |
chadnach1 | 34:b4b50ca26e8c | 185 | |
amiche | 19:f3615321b5c4 | 186 | // PM_A! sets the LED high |
amiche | 19:f3615321b5c4 | 187 | led_apace = 1; |
amiche | 19:f3615321b5c4 | 188 | |
amiche | 19:f3615321b5c4 | 189 | avi_clk.reset(); |
amiche | 19:f3615321b5c4 | 190 | |
amiche | 19:f3615321b5c4 | 191 | apace(); |
chadnach1 | 34:b4b50ca26e8c | 192 | |
amiche | 19:f3615321b5c4 | 193 | // At Atrial Event State |
chadnach1 | 33:b68c1648206e | 194 | while (avi_clk.read_ms() < AVI) { |
chadnach1 | 34:b4b50ca26e8c | 195 | |
chadnach1 | 27:2c5aefcf3000 | 196 | if (v_sense == 1) { |
chadnach1 | 27:2c5aefcf3000 | 197 | goInitalState = 1; |
amiche | 24:81cd9ef5c4f6 | 198 | break; |
amiche | 24:81cd9ef5c4f6 | 199 | } |
amiche | 24:81cd9ef5c4f6 | 200 | } |
chadnach1 | 27:2c5aefcf3000 | 201 | if (!goInitalState) { |
amiche | 24:81cd9ef5c4f6 | 202 | // Ventricular Event |
chadnach1 | 32:c58b6651336c | 203 | t_count.reset(); |
amiche | 19:f3615321b5c4 | 204 | |
amiche | 24:81cd9ef5c4f6 | 205 | // PM_V! sets the LED high |
amiche | 24:81cd9ef5c4f6 | 206 | led_vpace = 1; |
amiche | 19:f3615321b5c4 | 207 | |
chadnach1 | 32:c58b6651336c | 208 | t_count.reset(); |
amiche | 24:81cd9ef5c4f6 | 209 | vpace(); |
amiche | 24:81cd9ef5c4f6 | 210 | } |
chadnach1 | 33:b68c1648206e | 211 | } else if (t_count.read_ms() < LRI - AVI) { |
chadnach1 | 34:b4b50ca26e8c | 212 | |
amiche | 24:81cd9ef5c4f6 | 213 | // if Asense, move on to atrial event |
chadnach1 | 27:2c5aefcf3000 | 214 | if (a_sense == 1) { |
chadnach1 | 27:2c5aefcf3000 | 215 | goInitalState = 0; |
chadnach1 | 34:b4b50ca26e8c | 216 | |
amiche | 24:81cd9ef5c4f6 | 217 | avi_clk.reset(); |
amiche | 19:f3615321b5c4 | 218 | |
amiche | 24:81cd9ef5c4f6 | 219 | // At Atrial Event State |
amiche | 24:81cd9ef5c4f6 | 220 | while (avi_clk.read() < AVI) { |
chadnach1 | 27:2c5aefcf3000 | 221 | if (v_sense == 1) { |
chadnach1 | 27:2c5aefcf3000 | 222 | goInitalState = 1; |
amiche | 24:81cd9ef5c4f6 | 223 | break; |
amiche | 24:81cd9ef5c4f6 | 224 | } |
amiche | 24:81cd9ef5c4f6 | 225 | } |
amiche | 19:f3615321b5c4 | 226 | |
amiche | 24:81cd9ef5c4f6 | 227 | // Ventricular Event |
chadnach1 | 32:c58b6651336c | 228 | t_count.reset(); |
amiche | 24:81cd9ef5c4f6 | 229 | |
amiche | 24:81cd9ef5c4f6 | 230 | // PM_V! sets the LED high |
amiche | 24:81cd9ef5c4f6 | 231 | led_vpace = 1; |
amiche | 24:81cd9ef5c4f6 | 232 | |
chadnach1 | 32:c58b6651336c | 233 | t_count.reset(); |
amiche | 24:81cd9ef5c4f6 | 234 | vpace(); |
amiche | 24:81cd9ef5c4f6 | 235 | } |
amiche | 19:f3615321b5c4 | 236 | } |
amiche | 19:f3615321b5c4 | 237 | } |
amiche | 3:44d132582373 | 238 | } |
lucastai | 2:5e9c4d83d038 | 239 | |
amiche | 19:f3615321b5c4 | 240 | int main() |
amiche | 19:f3615321b5c4 | 241 | { |
chadnach1 | 16:ae9df4194011 | 242 | // https://developer.mbed.org/users/chadnach1/code/PacemakerController/ |
lucastai | 2:5e9c4d83d038 | 243 | // connect the serial device (PC keybd) to the interrupt |
amiche | 19:f3615321b5c4 | 244 | |
chadnach1 | 16:ae9df4194011 | 245 | // Start LED's Off |
chadnach1 | 17:c89cddf30925 | 246 | led_apace = 0; |
chadnach1 | 17:c89cddf30925 | 247 | led_vpace = 0; |
amiche | 19:f3615321b5c4 | 248 | |
chadnach1 | 16:ae9df4194011 | 249 | // Start the avi_clock |
chadnach1 | 16:ae9df4194011 | 250 | avi_clk.start(); |
chadnach1 | 33:b68c1648206e | 251 | avi_clk.reset(); |
amiche | 19:f3615321b5c4 | 252 | |
chadnach1 | 30:97db5a684eaa | 253 | Thread t1(pm_sense, (void *)""); |
chadnach1 | 30:97db5a684eaa | 254 | Thread t2(pm_response, (void *)""); |
chadnach1 | 31:7f0e865e3d4b | 255 | Thread t3(PM_ALARM, (void *)""); |
chadnach1 | 33:b68c1648206e | 256 | t_count.start(); |
chadnach1 | 33:b68c1648206e | 257 | t_count.reset(); |
chadnach1 | 31:7f0e865e3d4b | 258 | |
chadnach1 | 31:7f0e865e3d4b | 259 | while(1) { |
mhowar | 35:b5e8650a7669 | 260 | if (pc.readable()) { |
mhowar | 35:b5e8650a7669 | 261 | |
mhowar | 35:b5e8650a7669 | 262 | char a = pc.getc(); |
mhowar | 35:b5e8650a7669 | 263 | |
mhowar | 35:b5e8650a7669 | 264 | // Handle different keyboard inputs |
mhowar | 35:b5e8650a7669 | 265 | if (keyboard_needs_numeric) { |
mhowar | 35:b5e8650a7669 | 266 | if (a >= '0' && a <= '9') { |
mhowar | 35:b5e8650a7669 | 267 | // update observation interval |
mhowar | 35:b5e8650a7669 | 268 | obs_int = (a - '0' + 1) * 5; |
mhowar | 35:b5e8650a7669 | 269 | keyboard_needs_numeric = 0; |
mhowar | 35:b5e8650a7669 | 270 | } else { |
mhowar | 35:b5e8650a7669 | 271 | pc.printf("Expected numeric key\n"); |
mhowar | 35:b5e8650a7669 | 272 | } |
mhowar | 35:b5e8650a7669 | 273 | } else if(a == 'N') { |
mhowar | 35:b5e8650a7669 | 274 | // if the char is N, update bounds to normal mode |
mhowar | 35:b5e8650a7669 | 275 | curr_mode = NORMAL; |
mhowar | 35:b5e8650a7669 | 276 | upper_bound = 100; |
amiche | 38:ceabf8f1dfa0 | 277 | LRI = 100; |
mhowar | 35:b5e8650a7669 | 278 | lower_bound = 40; |
mhowar | 35:b5e8650a7669 | 279 | pc.printf("MODE IS N\n"); |
mhowar | 35:b5e8650a7669 | 280 | // if the char is S, set bounds to sleep |
mhowar | 35:b5e8650a7669 | 281 | } else if (a == 'S') { |
mhowar | 35:b5e8650a7669 | 282 | curr_mode = SLEEP; |
mhowar | 35:b5e8650a7669 | 283 | upper_bound = 60; |
amiche | 38:ceabf8f1dfa0 | 284 | LRI = 60; |
mhowar | 35:b5e8650a7669 | 285 | lower_bound = 30; |
mhowar | 35:b5e8650a7669 | 286 | pc.printf("MODE IS S\n"); |
mhowar | 35:b5e8650a7669 | 287 | // if the char is E, set bounds to exercise |
mhowar | 35:b5e8650a7669 | 288 | } else if (a == 'E') { |
mhowar | 35:b5e8650a7669 | 289 | curr_mode = EXERCISE; |
mhowar | 35:b5e8650a7669 | 290 | upper_bound = 175; |
amiche | 38:ceabf8f1dfa0 | 291 | LRI = 175; |
mhowar | 35:b5e8650a7669 | 292 | lower_bound = 100; |
mhowar | 35:b5e8650a7669 | 293 | pc.printf("MODE IS E\n"); |
mhowar | 35:b5e8650a7669 | 294 | // if the char is M, set to manual |
mhowar | 35:b5e8650a7669 | 295 | } else if (a == 'M') { |
mhowar | 35:b5e8650a7669 | 296 | curr_mode = MANUAL; |
mhowar | 35:b5e8650a7669 | 297 | upper_bound = 175; |
amiche | 38:ceabf8f1dfa0 | 298 | LRI = 175; |
mhowar | 35:b5e8650a7669 | 299 | lower_bound = 30; |
mhowar | 35:b5e8650a7669 | 300 | pc.printf("MODE IS MANUAL\n"); |
mhowar | 35:b5e8650a7669 | 301 | // check for A if mode is manual |
mhowar | 35:b5e8650a7669 | 302 | } else if (a == 'A') { |
mhowar | 35:b5e8650a7669 | 303 | if(curr_mode == MANUAL) { |
chadnach1 | 39:51c4ec84f6fd | 304 | apace(); |
chadnach1 | 39:51c4ec84f6fd | 305 | pc.printf("MODE IS MANUAL SENT APACE\n"); |
mhowar | 35:b5e8650a7669 | 306 | } |
mhowar | 35:b5e8650a7669 | 307 | // check for V is mode is manual |
mhowar | 35:b5e8650a7669 | 308 | } else if (a == 'V') { |
mhowar | 35:b5e8650a7669 | 309 | if(curr_mode == MANUAL) { |
chadnach1 | 39:51c4ec84f6fd | 310 | vpace(); |
chadnach1 | 39:51c4ec84f6fd | 311 | pc.printf("MODE IS MANUAL SENT VPACE\n"); |
mhowar | 35:b5e8650a7669 | 312 | } |
mhowar | 35:b5e8650a7669 | 313 | } else if (a == 'O') { |
mhowar | 35:b5e8650a7669 | 314 | keyboard_needs_numeric = 1; |
mhowar | 35:b5e8650a7669 | 315 | } else { |
mhowar | 35:b5e8650a7669 | 316 | // do nothing for invalid char |
mhowar | 35:b5e8650a7669 | 317 | } |
chadnach1 | 31:7f0e865e3d4b | 318 | } |
chadnach1 | 31:7f0e865e3d4b | 319 | } |
chadnach1 | 31:7f0e865e3d4b | 320 | } |