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.
Revision 0:a48b7099a59c, committed 2017-10-13
- Comitter:
- kgilbert
- Date:
- Fri Oct 13 16:56:41 2017 +0000
- Commit message:
- Add source for example
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 13 16:56:41 2017 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "SDBlockDevice.h"
+#include "MBRBlockDevice.h"
+#include "FATFileSystem.h"
+
+// Pin mappings for K64F
+PinName s0 = PTE3; // MOSI
+PinName s1 = PTE1; // MISO
+PinName s2 = PTE2; // SCLK
+PinName s3 = PTE4; // CS
+
+int main(void) {
+ // Create an SD card
+ SDBlockDevice sd(s0, s1, s2, s3);
+
+ // Create a partition with 1 GB of space
+ MBRBlockDevice::partition(&sd, 1, 0x83, 0, 1024*1024);
+
+ // Create the block device that represents the partition
+ MBRBlockDevice part1(&sd, 1);
+
+ // Format the partition with a FAT filesystem
+ FATFileSystem::format(&part1);
+
+ // Create the FAT filesystem instance, files can now be written to
+ // the FAT filesystem in partition 1
+ FATFileSystem fat("fat", &part1);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri Oct 13 16:56:41 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#6e0d01cd13e8aca7bf4d697c3699ec9225386881
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sd-driver.lib Fri Oct 13 16:56:41 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/sd-driver/#ae7e7440054c9447f8255bdccbcc523b3f6dffe4