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.
Diff: libraries/tests/rtos/cmsis/signals/main.cpp
- Revision:
- 0:6c56fb4bc5f0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/tests/rtos/cmsis/signals/main.cpp Fri Nov 04 20:27:58 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "cmsis_os.h"
+
+#if defined(MBED_RTOS_SINGLE_THREAD)
+ #error [NOT_SUPPORTED] test not supported
+#endif
+
+DigitalOut led(LED1);
+
+void led_thread(void const *argument) {
+ while (true) {
+ // Signal flags that are reported as event are automatically cleared.
+ osSignalWait(0x1, osWaitForever);
+ led = !led;
+ }
+}
+
+osThreadDef(led_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
+
+int main (void) {
+ osThreadId tid = osThreadCreate(osThread(led_thread), NULL);
+
+ while (true) {
+ osDelay(1000);
+ osSignalSet(tid, 0x1);
+ }
+}