
.
Revision 28:bc8560ba955d, committed 2019-01-17
- Comitter:
- mbed_official
- Date:
- Thu Jan 17 13:15:29 2019 +0000
- Parent:
- 27:a1b682cc912b
- Child:
- 29:d28cf713107b
- Commit message:
- Enhance documentation for the following:
- Explain how to use FAT FS vs. LittleFS
- Explain how to use your own block device
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-filesystem
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jan 17 12:30:29 2019 +0000 +++ b/main.cpp Thu Jan 17 13:15:29 2019 +0000 @@ -19,15 +19,22 @@ #include "BlockDevice.h" -// File systems -#include "LittleFileSystem.h" -#include "FATFileSystem.h" +// This will take the system's default block device +BlockDevice *bd = BlockDevice::get_default_instance(); + +// Instead of the default block device, you can define your own block device. +// For example: HeapBlockDevice with size of 2048 bytes, read size 1, write size 1 and erase size 512. +// #include "HeapBlockDevice.h" +// BlockDevice *bd = new HeapBlockDevice(2048, 1, 1, 512); -BlockDevice *bd = BlockDevice::get_default_instance(); +// This example uses LittleFileSystem as the default file system +#include "LittleFileSystem.h" +LittleFileSystem fs("fs"); -// File system declaration -LittleFileSystem fs("fs"); +// Uncomment the following two lines and comment the previous two to use FAT file system. +// #include "FATFileSystem.h" +// FATFileSystem fs("fs"); // Set up the button to trigger an erase