mbed-os

Fork of mbed-os by erkin yucel

Revision:
0:f269e3021894
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/features/unsupported/tests/mbed/fs/main.cpp	Sun Oct 23 15:10:02 2016 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "SDFileSystem.h"
+
+#define FILE_LOC "/sd/test.txt"
+
+Serial pc(USBTX, USBRX);
+Serial gps(p28, p27);
+Serial test(p9,p10);
+
+SDFileSystem sd(p11, p12, p13, p14, "sd");
+
+DigitalOut myled(LED1);
+DigitalOut sdled(LED2);
+
+void sd_thread(void const *argument) {
+    while (true) {
+        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 (true) {
+        myled = !myled;
+        Thread::wait(1000);
+    }
+}