Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TextLCD mbed-rtos mbed
Diff: main.cpp
- Revision:
- 4:cf40000fdac1
- Parent:
- 3:1498846197ee
- Child:
- 5:ba77f2da6fc5
diff -r 1498846197ee -r cf40000fdac1 main.cpp
--- a/main.cpp Wed Dec 07 15:09:32 2016 +0000
+++ b/main.cpp Thu Dec 08 00:11:40 2016 +0000
@@ -40,7 +40,7 @@
int uri = 700;
int avi = 150;
int pvarp = 300;
-int vrp = 100;
+int vrp = 200;
int arp = 50;
@@ -49,6 +49,7 @@
int heartmode = 0;
int v_flag = 0;
int observation_interval = 10000; // In miliseconds
+int tmm = 0; //testmode flag
int heart_beats = 0; // Heart-Beats (sensed or paced) since the last observation interval
Mutex hr_mutex; //hr_mutex.lock()/unlock()
@@ -80,6 +81,10 @@
void vpace_irq()
{
//heartmodeThread->signal_set(0x1);
+ if(tmm)
+ {
+ osSignalSet(heartmodeTid, 0x1);
+ }
osSignalSet(HeartSenseTid, 0x1);
}
@@ -87,6 +92,10 @@
void apace_irq()
{
//heartmodeThread->signal_set(0x10);
+ if(tmm)
+ {
+ osSignalSet(heartmodeTid, 0x10);
+ }
osSignalSet(HeartSenseTid, 0x10);
}
@@ -820,7 +829,7 @@
//heartmodeThread = new Thread();
- //Callback<void()> testmodeTask((void*)NULL,(void (*)(void *))&testmode);
+// Callback<void()> testmodeTask((void*)NULL,(void (*)(void *))&testmode);
HeartSenseTid = osThreadCreate(osThread(HeartSense), NULL);
heartmodeTid = osThreadCreate(osThread(randommode), NULL);
@@ -835,6 +844,7 @@
switch((char)evt.value.p) {
//pvarp = 0.3s
case('r'):
+ tmm = 0;
lcd.printf("R");
osThreadTerminate (heartmodeTid);
osThreadTerminate (displayTid);
@@ -851,21 +861,26 @@
// Thread::wait(100);
break;
case('t'):
+
+ tmm = 1;
lcd.printf("T");
osThreadTerminate (heartmodeTid);
osThreadTerminate (displayTid);
- if (testresults != NULL) {
- fclose(testresults);
- }
asignal_led = 0;
vsignal_led = 0;
apace_led = 0;
vpace_led = 0;
-
+ osSignalClear (HeartSenseTid,0x1111);
displayTid = osThreadCreate(osThread(displayThread), NULL);
- heartmodeTid = osThreadCreate(osThread(testmode), NULL);
+ HeartSenseTid = osThreadCreate(osThread(testmode), NULL);
+
+ if (testresults != NULL) {
+ fclose(testresults);
+ }
+
break;
case('m'):
+ tmm = 0;
lcd.printf("M");
osThreadTerminate (heartmodeTid);
osThreadTerminate (displayTid);
@@ -884,6 +899,7 @@
break;
case('o'):
+ tmm = 0;
lcd.printf("modeO");
obsinterval();
osThreadTerminate (displayTid);