ok

Dependencies:   mbed-rtos mbed

Fork of rtos_signals by mbed official

Files at this revision

API Documentation at this revision

Comitter:
avnisha
Date:
Tue Mar 04 21:39:55 2014 +0000
Parent:
3:c133402c77cb
Commit message:
ok

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r c133402c77cb -r 84ab1b5e8265 main.cpp
--- a/main.cpp	Tue Jun 04 15:54:12 2013 +0100
+++ b/main.cpp	Tue Mar 04 21:39:55 2014 +0000
@@ -1,21 +1,47 @@
 #include "mbed.h"
 #include "rtos.h"
 
-DigitalOut led(LED1);
+void        proxy_thread(void const *argument);
+DigitalOut  led1(LED1);
+DigitalOut  led2(LED2);
+InterruptIn fire(p14);
+Thread      *proxy_ptr;
 
-void led_thread(void const *argument) {
-    while (true) {
-        // Signal flags that are reported as event are automatically cleared.
-        Thread::signal_wait(0x1);
-        led = !led;
+/*
+ * PROXY thread that works with and is triggered by the ISR
+ */
+
+void proxy_thread(void const *argument) {
+    while (true) { 
+        printf("proxy - waiting for  signal \n\r");    
+        Thread::signal_wait(0x1, osWaitForever);
+        printf("proxy - got signal \n\r");
+        led1 = !led1;
     }
 }
 
+
+/*
+ * ISR - does minimal work and passes the buck to PROXY thread
+ */
+
+void ISR1() {
+    led2 = !led2;
+    proxy_ptr->signal_set(0x1);
+}
+
+
+
+
 int main (void) {
-    Thread thread(led_thread);
     
+    fire.rise(&ISR1);
+    Thread thread(proxy_thread);
+    proxy_ptr = &thread;  
+    
+    printf("main ... testing signals\n\r");
     while (true) {
         Thread::wait(1000);
-        thread.signal_set(0x1);
+        printf("main ... wait loop\n\r");
     }
 }
diff -r c133402c77cb -r 84ab1b5e8265 mbed-rtos.lib
--- a/mbed-rtos.lib	Tue Jun 04 15:54:12 2013 +0100
+++ b/mbed-rtos.lib	Tue Mar 04 21:39:55 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed-rtos/#f88660a9bed1
diff -r c133402c77cb -r 84ab1b5e8265 mbed.bld
--- a/mbed.bld	Tue Jun 04 15:54:12 2013 +0100
+++ b/mbed.bld	Tue Mar 04 21:39:55 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file