CIS441 Controller
Dependencies: TextLCD mbed-rtos mbed
Fork of PacemakerController by
Diff: PacemakerController.cpp
- Revision:
- 34:b4b50ca26e8c
- Parent:
- 33:b68c1648206e
- Child:
- 35:b5e8650a7669
- Child:
- 37:4573d0f2ae23
--- a/PacemakerController.cpp Wed Dec 02 03:40:48 2015 +0000 +++ b/PacemakerController.cpp Wed Dec 02 04:43:10 2015 +0000 @@ -54,7 +54,6 @@ { a_sense = 1; led_asense = 1; - lcd.printf("asense fired\n"); Thread::wait(10); led_asense = 0; a_sense = 0; @@ -64,7 +63,6 @@ { v_sense = 1; led_vsense = 1; - lcd.printf("vssense fired\n"); Thread::wait(10); led_vsense = 0; v_sense = 0; @@ -72,8 +70,6 @@ void apace() { - - lcd.printf("apace fired\n"); apaceSignal = 1; led_apace = 1; Thread::wait(10); @@ -84,7 +80,6 @@ void vpace() { - lcd.printf("vpace fired\n"); vpaceSignal = 1; led_vpace = 1; Thread::wait(10); @@ -140,9 +135,6 @@ { while(1) { - //lcd.locate(0,1); - //lcd.printf("in pmsense\n"); - /*if (agetSignal == 0) { pc.printf("Aget:LO\n"); } @@ -160,72 +152,47 @@ if (t_count.read_ms() >= VRP && vgetSignal == 1) { - lcd.printf("valid v state\n"); - pc.printf("valid v state\n"); - //Thread::wait(2); + // Valid_V state - t_count.reset(); - //t_count.start(); vsense(); - // do something with Vsense! } else if (t_count.read_ms() < VRP && vgetSignal == 1) { - lcd.printf("invalid v state\n"); - pc.printf("invalid v state\n"); - //pc.printf("%d\n",t_count.read()); - - //t_count.start(); + //pc.printf("invalid v state\n"); - //Thread::wait(2); // Invalid_V state } if (t_count.read_ms() < PVARP && agetSignal == 1) { // Invalid_A state - lcd.printf("invalid a state\n"); - pc.printf("invalid a state\n"); - // pc.printf("%d\n",t_count.read()); - //t_count.start(); - - //Thread::wait(2); + + //pc.printf("invalid a state\n"); } else if (t_count.read_ms() >= PVARP && agetSignal == 1) { // Valid_A state - lcd.printf("valid a state\n"); - pc.printf("valid a state\n"); - //Thread::wait(2); - //t_count.start(); asense(); - // do something with Asense! } - } } void pm_response(void const *args) { while(1) { - //lcd.cls(); - lcd.printf("in response\n"); - pc.printf("in response %d\n", t_count.read()); + bool goInitalState = 1; if (t_count.read_ms() >= LRI - AVI) { - //lcd.cls(); - //lcd.printf("t_count.reasd() >= LRI-AVI\n"); goInitalState = 0; + // PM_A! sets the LED high - pc.printf("in pmresponse"); led_apace = 1; - // avi_clk = 0 avi_clk.reset(); apace(); + // At Atrial Event State while (avi_clk.read_ms() < AVI) { - //lcd.cls(); - //lcd.printf("avi_clk.read() < AVI\n"); + if (v_sense == 1) { goInitalState = 1; break; @@ -243,13 +210,11 @@ vpace(); } } else if (t_count.read_ms() < LRI - AVI) { - //lcd.cls(); - //lcd.printf("t_count.read() < LRI - AVI\n"); + // if Asense, move on to atrial event if (a_sense == 1) { goInitalState = 0; - - // avi_clk = 0 + avi_clk.reset(); // At Atrial Event State @@ -277,8 +242,6 @@ { // https://developer.mbed.org/users/chadnach1/code/PacemakerController/ // connect the serial device (PC keybd) to the interrupt - //pc.attach(&keyboard_handler); - lcd.printf("in main\n"); // Start LED's Off led_apace = 0; @@ -293,14 +256,10 @@ Thread t3(PM_ALARM, (void *)""); t_count.start(); t_count.reset(); - //pc.printf("PM CLOCK time isss %d\n",t_count.read_ms()); - // pc.printf("AVI CLK %d\n",avi_clk.read_ms()); char a = 'Z'; while(1) { - - if (pc.readable()) { a = pc.getc(); @@ -311,7 +270,6 @@ // update observation interval obs_int = (a - '0' + 1) * 5; } else { - lcd.printf("MODE IS N\n"); pc.printf("Expected numeric key\n"); } } else if(a == 'N') { @@ -319,21 +277,18 @@ curr_mode = NORMAL; upper_bound = 100; lower_bound = 40; - lcd.printf("MODE IS N\n"); pc.printf("MODE IS N\n"); // if the char is S, set bounds to sleep } else if (a == 'S') { curr_mode = SLEEP; upper_bound = 60; lower_bound = 30; - lcd.printf("MODE IS S\n"); pc.printf("MODE IS S\n"); // if the char is E, set bounds to exercise } else if (a == 'E') { curr_mode = EXERCISE; upper_bound = 175; lower_bound = 100; - lcd.printf("MODE IS E\n"); pc.printf("MODE IS E\n"); beats = 2; // if the char is M, set to manual @@ -342,7 +297,6 @@ upper_bound = 175; lower_bound = 30; beats = 300; - lcd.printf("MODE IS MANUAL\n"); pc.printf("MODE IS MANUAL\n"); // check for A if mode is manual } else if (a == 'A') {