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.
libraries/tests/rtos/cmsis/signals/main.cpp@0:6c56fb4bc5f0, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:27:58 2016 +0000
- Revision:
- 0:6c56fb4bc5f0
Moving to library for sharing updates
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nexpaq | 0:6c56fb4bc5f0 | 1 | #include "mbed.h" |
| nexpaq | 0:6c56fb4bc5f0 | 2 | #include "cmsis_os.h" |
| nexpaq | 0:6c56fb4bc5f0 | 3 | |
| nexpaq | 0:6c56fb4bc5f0 | 4 | #if defined(MBED_RTOS_SINGLE_THREAD) |
| nexpaq | 0:6c56fb4bc5f0 | 5 | #error [NOT_SUPPORTED] test not supported |
| nexpaq | 0:6c56fb4bc5f0 | 6 | #endif |
| nexpaq | 0:6c56fb4bc5f0 | 7 | |
| nexpaq | 0:6c56fb4bc5f0 | 8 | DigitalOut led(LED1); |
| nexpaq | 0:6c56fb4bc5f0 | 9 | |
| nexpaq | 0:6c56fb4bc5f0 | 10 | void led_thread(void const *argument) { |
| nexpaq | 0:6c56fb4bc5f0 | 11 | while (true) { |
| nexpaq | 0:6c56fb4bc5f0 | 12 | // Signal flags that are reported as event are automatically cleared. |
| nexpaq | 0:6c56fb4bc5f0 | 13 | osSignalWait(0x1, osWaitForever); |
| nexpaq | 0:6c56fb4bc5f0 | 14 | led = !led; |
| nexpaq | 0:6c56fb4bc5f0 | 15 | } |
| nexpaq | 0:6c56fb4bc5f0 | 16 | } |
| nexpaq | 0:6c56fb4bc5f0 | 17 | |
| nexpaq | 0:6c56fb4bc5f0 | 18 | osThreadDef(led_thread, osPriorityNormal, DEFAULT_STACK_SIZE); |
| nexpaq | 0:6c56fb4bc5f0 | 19 | |
| nexpaq | 0:6c56fb4bc5f0 | 20 | int main (void) { |
| nexpaq | 0:6c56fb4bc5f0 | 21 | osThreadId tid = osThreadCreate(osThread(led_thread), NULL); |
| nexpaq | 0:6c56fb4bc5f0 | 22 | |
| nexpaq | 0:6c56fb4bc5f0 | 23 | while (true) { |
| nexpaq | 0:6c56fb4bc5f0 | 24 | osDelay(1000); |
| nexpaq | 0:6c56fb4bc5f0 | 25 | osSignalSet(tid, 0x1); |
| nexpaq | 0:6c56fb4bc5f0 | 26 | } |
| nexpaq | 0:6c56fb4bc5f0 | 27 | } |