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.
Revision 0:bd08296227ad, committed 2022-03-17
- Comitter:
- cspista
- Date:
- Thu Mar 17 12:43:28 2022 +0000
- Commit message:
- Final version
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 17 12:43:28 2022 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalOut led(LED1);
+
+void led_thread(void const *argument) {
+ while (true) {
+ // Signal flags that are reported as event are automatically cleared.
+ osEvent evt = Thread::signal_wait(0); //Wait for any signal
+ switch(evt.status) {
+ case osOK:
+ printf("osOK\n"); //no error or event occurred
+ break;
+ case osEventSignal:
+ printf("osEventSignal = %#05x\n",evt.value.signals); //signal event occurred
+ break;
+ case osEventTimeout:
+ printf("osEventTimeout\n"); //timeout occurred
+ break;
+ case osErrorValue:
+ printf("osErrorValue\n"); //value of a parameter is out of range
+ break;
+ default:
+ printf("Unknown error flag: %#08x\n",(uint32_t)evt.status);
+ break;
+ };
+ led = !led;
+ }
+}
+
+int main (void) {
+ int32_t signal_mask = 0x1;
+ Thread thread2(led_thread);
+ while (true) {
+ Thread::wait(1000);
+ thread2.signal_set(signal_mask);
+ signal_mask <<=1;
+ if(signal_mask > 0x8000) signal_mask=0x1;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Mar 17 12:43:28 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed-rtos/#5713cbbdb706
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 17 12:43:28 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file