Part of the Pacemaker Project; this models the Pacemaker.
Dependencies: mbed TextLCD mbed-rtos
Diff: PacemakerController.cpp
- Revision:
- 47:bac7fc1a44fe
- Parent:
- 46:2d9cf50b4bc3
- Child:
- 48:f459ab609d59
diff -r 2d9cf50b4bc3 -r bac7fc1a44fe PacemakerController.cpp --- a/PacemakerController.cpp Wed Dec 02 07:50:33 2015 +0000 +++ b/PacemakerController.cpp Wed Dec 02 21:34:46 2015 +0000 @@ -90,40 +90,21 @@ } -// hardware interrupt handler, adapted from code in piazza post by Dagaen -/*extern "C" void TIMER0_IRQHandler (void) -{ - if((LPC_TIM0->IR & 0x01) == 0x01) { // if MR0 interrupt, proceed - LPC_TIM0->IR |= 1 << 0; // Clear MR0 interrupt flag - timer_count++; //increment timer_count - } -} -*/ -/*// init the hardware interrupt (timer0), adapted same as above -void timer0_init(void) -{ - LPC_SC->PCONP |=1<1; //timer0 power on - LPC_SC-> PCLKSEL0 |= 1 << 2; // set timer clock to CCLCK nondivided (1 clock cycle = 1 increment) - LPC_TIM0->MR0 = 1000000; //100mhz clock cycle, 1 cycle = 10ns, 10ms = 10 000 000 ns = 1M cycles - LPC_TIM0->MCR = 3; //interrupt and reset control - //3 = Interrupt & reset timer0 on match (111) sets all three bits - NVIC_EnableIRQ(TIMER0_IRQn); //enable timer0 interrupt -}*/ - - void PM_ALARM(void const *args) { while (1) { // min hr alarm - if( beats < MIN_PM_RT) { + if( bpm < lower_bound) { lcd.locate(0,1); lcd.printf("!<"); + pc.printf("BPM low: %.1f ", bpm); } // max hr alarm - else if(beats > MAX_PM_RT) { + else if(beats > upper_bound) { lcd.locate(0,1); lcd.printf("!>"); + pc.printf("BPM high: %.1f ", bpm); } else { lcd.locate(0,1); lcd.printf(" "); @@ -320,4 +301,4 @@ } } } -} +} \ No newline at end of file