Kiyoshi Hayakawa
/
rtos_signals
KEIS
Fork of rtos_signals by
main.cpp@4:ad6be128bc77, 2013-09-28 (annotated)
- Committer:
- khayakawa
- Date:
- Sat Sep 28 06:38:42 2013 +0000
- Revision:
- 4:ad6be128bc77
- Parent:
- 1:6a8fcc666593
KEIS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 1:6a8fcc666593 | 1 | #include "mbed.h" |
emilmont | 1:6a8fcc666593 | 2 | #include "rtos.h" |
emilmont | 1:6a8fcc666593 | 3 | |
emilmont | 1:6a8fcc666593 | 4 | DigitalOut led(LED1); |
emilmont | 1:6a8fcc666593 | 5 | |
emilmont | 1:6a8fcc666593 | 6 | void led_thread(void const *argument) { |
emilmont | 1:6a8fcc666593 | 7 | while (true) { |
emilmont | 1:6a8fcc666593 | 8 | Thread::signal_wait(0x1); |
emilmont | 1:6a8fcc666593 | 9 | led = !led; |
emilmont | 1:6a8fcc666593 | 10 | } |
emilmont | 1:6a8fcc666593 | 11 | } |
emilmont | 1:6a8fcc666593 | 12 | |
emilmont | 1:6a8fcc666593 | 13 | int main (void) { |
emilmont | 1:6a8fcc666593 | 14 | Thread thread(led_thread); |
emilmont | 1:6a8fcc666593 | 15 | |
emilmont | 1:6a8fcc666593 | 16 | while (true) { |
emilmont | 1:6a8fcc666593 | 17 | Thread::wait(1000); |
emilmont | 1:6a8fcc666593 | 18 | thread.signal_set(0x1); |
emilmont | 1:6a8fcc666593 | 19 | } |
emilmont | 1:6a8fcc666593 | 20 | } |