Hiroshi SAKAMOTO
/
test-thread-12112902
simple program for rtos thread test.
threadの解説は、
http://mbed.org/users/takashikojo/notebook/r/
が詳しいです。
Revision 0:9c5cee1cb2ba, committed 2013-01-17
- Comitter:
- hayashiisme
- Date:
- Thu Jan 17 02:22:58 2013 +0000
- Commit message:
- theread test
Changed in this revision
diff -r 000000000000 -r 9c5cee1cb2ba main.cpp --- /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); +}
diff -r 000000000000 -r 9c5cee1cb2ba mbed-rtos.lib --- /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
diff -r 000000000000 -r 9c5cee1cb2ba mbed.bld --- /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