sd & rtos & serial test

Dependencies:   SDFileSystem mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
tetuomin
Date:
Mon Jan 28 08:28:11 2013 +0000
Parent:
0:8aef073b3e23
Commit message:
thread added for sd

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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); 
     }
 }