Seeed / Mbed OS Wio_3G-example-sd-driver

Fork of Wio_3G-example-sd-driver by Toyomasa Watarai

Files at this revision

API Documentation at this revision

Comitter:
ytsuboi
Date:
Mon Dec 03 08:27:31 2018 +0000
Parent:
0:8eedb2495d52
Commit message:
Added format demo for Handson.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
sd-driver/.git/index Show annotated file Show diff for this revision Revisions of this file
diff -r 8eedb2495d52 -r 080085a0a3ec main.cpp
--- a/main.cpp	Thu Aug 09 01:42:53 2018 +0000
+++ b/main.cpp	Mon Dec 03 08:27:31 2018 +0000
@@ -11,6 +11,8 @@
 DigitalOut SD_POWER(PA_15, 1);
 #endif
 
+// #define DO_FORMAT
+
 SDBlockDevice sd(MBED_CONF_APP_SPI_MOSI, MBED_CONF_APP_SPI_MISO, MBED_CONF_APP_SPI_CLK, MBED_CONF_APP_SPI_CS);
 FATFileSystem fs("sd", &sd);
 Serial pc(USBTX, USBRX, 115200);
@@ -34,7 +36,15 @@
 int main()
 {
     int error = 0;
-    pc.printf("Welcome to the filesystem example.\n");
+
+#if defined(DO_FORMAT)
+    pc.printf("Welcome to the filesystem example.\r\n"
+    "Formatting... ");
+    error = FATFileSystem::format(&sd);
+    return_error(error);
+#else
+    pc.printf("Welcome to the filesystem example.\r\n");
+#endif
 
     pc.printf("Opening a new file, numbers.txt.");
     FILE* fd = fopen("/sd/numbers.txt", "w+");
diff -r 8eedb2495d52 -r 080085a0a3ec sd-driver/.git/index
Binary file sd-driver/.git/index has changed