CIS441 Controller
Dependencies: TextLCD mbed-rtos mbed
Fork of PacemakerController by
PacemakerController.cpp@1:979e9e785549, 2015-11-24 (annotated)
- Committer:
- chadnach1
- Date:
- Tue Nov 24 23:19:34 2015 +0000
- Revision:
- 1:979e9e785549
- Parent:
- main.cpp@0:d92e0b71c6b5
- Child:
- 2:5e9c4d83d038
Pacemaker and Heart
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chadnach1 | 0:d92e0b71c6b5 | 1 | #include "mbed.h" |
chadnach1 | 0:d92e0b71c6b5 | 2 | |
chadnach1 | 0:d92e0b71c6b5 | 3 | // This is for the pacemaker |
chadnach1 | 0:d92e0b71c6b5 | 4 | TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); |
chadnach1 | 0:d92e0b71c6b5 | 5 | |
chadnach1 | 0:d92e0b71c6b5 | 6 | int h_clock; |
chadnach1 | 0:d92e0b71c6b5 | 7 | |
chadnach1 | 0:d92e0b71c6b5 | 8 | void A_Pace() { |
chadnach1 | 0:d92e0b71c6b5 | 9 | |
chadnach1 | 0:d92e0b71c6b5 | 10 | } |
chadnach1 | 0:d92e0b71c6b5 | 11 | |
chadnach1 | 0:d92e0b71c6b5 | 12 | void A_Pace() { |
chadnach1 | 0:d92e0b71c6b5 | 13 | |
chadnach1 | 0:d92e0b71c6b5 | 14 | } |
chadnach1 | 0:d92e0b71c6b5 | 15 | |
chadnach1 | 0:d92e0b71c6b5 | 16 | void timer0_init(void) |
chadnach1 | 0:d92e0b71c6b5 | 17 | { |
chadnach1 | 0:d92e0b71c6b5 | 18 | LPC_SC->PCONP |=1<1; //timer0 power on |
chadnach1 | 0:d92e0b71c6b5 | 19 | LPC_TIM0->MR0 = 239800; //10 msec |
chadnach1 | 0:d92e0b71c6b5 | 20 | LPC_TIM0->MCR = 3; //interrupt and reset control |
chadnach1 | 0:d92e0b71c6b5 | 21 | //3 = Interrupt & reset timer0 on match |
chadnach1 | 0:d92e0b71c6b5 | 22 | //1 = Interrupt only, no reset of timer0 |
chadnach1 | 0:d92e0b71c6b5 | 23 | NVIC_EnableIRQ(TIMER0_IRQn); //enable timer0 interrupt |
chadnach1 | 0:d92e0b71c6b5 | 24 | LPC_TIM0->TCR = 1; //enable Timer0 |
chadnach1 | 0:d92e0b71c6b5 | 25 | } |
chadnach1 | 0:d92e0b71c6b5 | 26 | |
chadnach1 | 0:d92e0b71c6b5 | 27 | int main() { |
chadnach1 | 0:d92e0b71c6b5 | 28 | while(1) { |
chadnach1 | 0:d92e0b71c6b5 | 29 | myled = 1; |
chadnach1 | 0:d92e0b71c6b5 | 30 | wait(0.2); |
chadnach1 | 0:d92e0b71c6b5 | 31 | myled = 0; |
chadnach1 | 0:d92e0b71c6b5 | 32 | wait(0.2); |
chadnach1 | 0:d92e0b71c6b5 | 33 | } |
chadnach1 | 0:d92e0b71c6b5 | 34 | } |