CIS441 Controller
Dependencies: TextLCD mbed-rtos mbed
Fork of PacemakerController by
Diff: PacemakerController.cpp
- Revision:
- 21:f7f50bbeba5e
- Parent:
- 20:dc272bfaa276
--- a/PacemakerController.cpp Mon Nov 30 21:38:54 2015 +0000 +++ b/PacemakerController.cpp Mon Nov 30 21:46:29 2015 +0000 @@ -22,6 +22,7 @@ int PVARP = 300; int VRP = 200; + // constants int MAX_PM_RT = 180; int MIN_PM_RT = 40; @@ -47,6 +48,9 @@ DigitalOut apace(p22); DigitalOut vpace(p21); +bool vsense; +bool asense; + // hardware interrupt handler, adapted from code in piazza post by Dagaen extern "C" void TIMER0_IRQHandler (void) { @@ -152,6 +156,7 @@ // Valid_V state timer_count = 0; + vsense(); // do something with Vsense! } else if (timer_count < VRP && vget == 1) { @@ -162,7 +167,7 @@ // Invalid_A state } else if (timer_count >= PVARP && aget == 1) { // Valid_A state - + asense(); // do something with Asense! } @@ -203,6 +208,18 @@ } } +void vsense() { + vsense = 1; + Thread::wait(10); + vsense = 0; +} + +void asense() { + asense = 1; + Thread::wait(10); + asense = 0; +} + void apace() {