Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Wio_3G-example-sd-driver by
Revision 1:080085a0a3ec, committed 2018-12-03
- 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