sd & rtos & serial test
Dependencies: SDFileSystem mbed-rtos mbed
Diff: main.cpp
- Revision:
- 1:0714787a8824
- Parent:
- 0:8aef073b3e23
diff -r 8aef073b3e23 -r 0714787a8824 main.cpp --- a/main.cpp Mon Jan 28 07:43:09 2013 +0000 +++ b/main.cpp Mon Jan 28 08:28:11 2013 +0000 @@ -9,14 +9,23 @@ Serial test(p9,p10); SDFileSystem sd(p5, p6, p7, p8, "sd"); DigitalOut myled(LED1); +DigitalOut sdled(LED2); + +void sd_thread(void const *argument) { + while(1){ + sdled = !sdled; + FILE *fp = NULL; + fp = fopen(FILE_LOC, "w"); + if( fp != NULL ) fclose(fp); + Thread::wait(1000); + } +} int main() { + Thread sdTask(sd_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE * 2.25); while(1) { myled = !myled; - FILE *fp = NULL; - fp = fopen(FILE_LOC, "w"); - if( fp != NULL ) fclose(fp); Thread::wait(1000); } }