rtos test
Revision 0:caffc01f54aa, committed 2013-01-26
- Comitter:
- ohira
- Date:
- Sat Jan 26 12:26:19 2013 +0000
- Commit message:
- first.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jan 26 12:26:19 2013 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "cmsis_os.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+Serial pc(USBTX , USBRX);
+
+void led2_thread(void const *args){
+ while (true) {
+ led2 = !led2;
+ osDelay(1000);
+ }
+}
+
+void serial_thread(const void *args){
+ pc.baud(115200);
+ while(true){
+ pc.putc(pc.getc());
+ }
+}
+
+osThreadDef(serial_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
+osThreadDef(led2_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
+
+int main() {
+ osThreadCreate(osThread(led2_thread), NULL);
+ osThreadCreate(osThread(serial_thread), NULL);
+ while(true);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Sat Jan 26 12:26:19 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#88a1a9c26ae3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 26 12:26:19 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59 \ No newline at end of file
Ryuichiro Ohira