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.
Fork of rtos_signals by
Revision 4:84ab1b5e8265, committed 2014-03-04
- Comitter:
- avnisha
- Date:
- Tue Mar 04 21:39:55 2014 +0000
- Parent:
- 3:c133402c77cb
- Commit message:
- ok
Changed in this revision
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