monitor thread, own random heart
Dependencies: TextLCD mbed-rtos mbed
Fork of pacemaker_v2 by
Diff: main.cpp
- Revision:
- 1:9d463bc2b7b9
- Parent:
- 0:cd6f505d57da
--- a/main.cpp Tue Dec 02 22:01:20 2014 +0000 +++ b/main.cpp Tue Dec 02 22:20:46 2014 +0000 @@ -6,6 +6,9 @@ #define RUN 0x1 +// pins 5,6 for AGet +// pins 7,8 for Vpace + TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); Serial pc (USBTX, USBRX); @@ -55,12 +58,13 @@ void flashLED(int i); void event_out(char *s, int between_t); void blind(); -//void rand_heart_func(void const *args); +void rand_heart_func(void const *args); // threads Thread * VS_thread; Thread * AS_thread; -//Thread * rand_heart_thread; // just for testing until mbed connection is made +Thread * PM_monitor_thread; +Thread * rand_heart_thread; // just for testing until mbed connection is made // rtos timers RtosTimer * VP_timer; @@ -77,7 +81,8 @@ // init threads VS_thread = new Thread(VS_func); AS_thread = new Thread(AS_func); - //rand_heart_thread = new Thread(rand_heart_func); // just for testing until mbed connection is made + PM_monitor_thread = new Thread(PM_monitor_func); + rand_heart_thread = new Thread(rand_heart_func); // just for testing until mbed connection is made // init timers VP_timer = new RtosTimer(VP_func, osTimerOnce, (void *)0); @@ -189,20 +194,19 @@ } } -/* void rand_heart_func(void const *args) { - int interval; - srand(time(NULL)); - while (1) { - interval = rand()%5000+10; - fprintf(fp,"interval = %d\n",interval); - Thread::wait(interval); - if (interval%2) AG = 1; - else - VG = 1; + int interval; + srand(time(NULL)); + while (1) { + interval = rand()%5000+10; + //fprintf(fp,"interval = %d\n",interval); + Thread::wait(interval); + if (interval%2) AG = 1; + else + VG = 1; + } } - } - */ + void PM_monitor_func(void const *args) { while (1) {