![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Part of the Pacemaker Project; this models the Pacemaker.
Dependencies: mbed TextLCD mbed-rtos
Diff: PMTest.cpp
- Revision:
- 26:64e2bc7d544a
- Parent:
- 25:18923916215b
- Child:
- 28:5c5552cd472b
--- a/PMTest.cpp Tue Dec 01 21:42:52 2015 +0000 +++ b/PMTest.cpp Wed Dec 02 00:21:13 2015 +0000 @@ -9,6 +9,9 @@ DigitalIn apace(p22); DigitalIn vpace(p21); +Serial pc(USBTX, USBRX); + + int timer_count; int curr_test; int minwaitV; @@ -16,11 +19,10 @@ int needs_num_input = 0; -struct mode{RANDOM,MANUAL,TEST}; +enum mode{RANDOM,MANUAL,TEST}; mode curr_mode = RANDOM; Timer t; -int[][] testfunc; @@ -62,7 +64,7 @@ return; } - if(a = 'R'){ + if(a == 'R'){ curr_mode = RANDOM; }else if(a == 'T'){ curr_mode = TEST; @@ -70,13 +72,13 @@ curr_mode = MANUAL; } - if(a == 'A' && curr_mode = MANUAL){ + if(a == 'A' && curr_mode == MANUAL){ asense = 1; Thread::wait(10); asense = 0; } - if(a == 'V' && curr_mode = MANUAL){ + if(a == 'V' && curr_mode == MANUAL){ vsense = 1; Thread::wait(10); vsense = 0; @@ -92,35 +94,22 @@ // interrupt function void interrupt_and_run_test(){ // zero timer, set for 1ms interrupt - timer0_init(100000) // wait for atrial pulse - while(apace != 1}{} // check if timer was within event - if(timer_count < testfunc[curr_test][0]){ - printf("ATRIAL PULSE FOR TEST " + curr_test + " WAS WITHIN BOUNDS\n"); - } // send vsense - while(timer_count < testfunc[curr_test][1]){}; - vpace = 1; // send asense - while(timer_count < testfunc[curr_test][2]){}; - apace = 1; // check if timer was in event // wait for vpace // wait for atrial pulse - while(vpace != 1}{} // check if timer was within event - - if(timer_count < testfunc[curr_test][0]){ - printf("VENT PULSE FOR TEST " + curr_test + " WAS WITHIN BOUNDS\n"); - } \ No newline at end of file +} \ No newline at end of file