simple program for rtos thread test.

Dependencies:   mbed-rtos mbed

threadの解説は、

http://mbed.org/users/takashikojo/notebook/r/

が詳しいです。

Files at this revision

API Documentation at this revision

Comitter:
hayashiisme
Date:
Thu Jan 17 02:22:58 2013 +0000
Commit message:
theread test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 17 02:22:58 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "rtos.h"
+#include<vector>
+
+LocalFileSystem local("local");
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED4);
+Queue<uint32_t, 5> queue;
+
+
+void indicater(void const *args)
+{
+    printf(">led thread start\r\n");
+//    int n;
+    FILE *fp = fopen("/local/test02.txt", "w"); 
+    fprintf(fp, "Hello file system from thread!\n");
+    fclose(fp);
+    while(1){
+//    for(n=0; n < 100; n++){
+        myled = 1;
+        Thread::wait(500);
+        myled = 0;
+        Thread::wait(500);
+    }
+    while(1){Thread::wait(500);}
+}
+
+int main(void)
+{
+    pc.baud(921600);
+    printf("\r\n==== mbed program start ====\r\n");
+    printf("%s\r\n", __FILE__);
+    Thread th_console_out(indicater);
+    FILE *fp = fopen("/local/test01.txt", "w"); 
+    fprintf(fp, "Hello file system from main()!\n");
+    fclose(fp);
+    wait(3);
+    th_console_out.terminate();
+    wait(1);
+    printf("=== mbed program end ====\r\n");
+    exit(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Thu Jan 17 02:22:58 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	Thu Jan 17 02:22:58 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/49c296715c73
\ No newline at end of file