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.
Dependencies: mbed mpu9250_i2c IM920 BMP180 GPS millis
Revision 0:effffaacd967, committed 2016-11-22
- Comitter:
- ryood
- Date:
- Tue Nov 22 07:23:12 2016 +0000
- Child:
- 1:690378b5f48a
- Commit message:
- first commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Tue Nov 22 07:23:12 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/neilt6/code/SDFileSystem/#e4d2567200db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Nov 22 07:23:12 2016 +0000
@@ -0,0 +1,82 @@
+/*
+ * SDFileSystem Binary R/W Test
+ *
+ * Library
+ * SDFileSystem: https://developer.mbed.org/users/neilt6/code/SDFileSystem/ Revision:26
+ * mbed: Revision: 124
+ *
+ * 2016.11.22 created
+ *
+ */
+
+#include "mbed.h"
+#include "SDFileSystem.h"
+
+SDFileSystem sd(D11, D12, D13, D10, "sd", NC, SDFileSystem::SWITCH_NONE, 25000000);
+
+struct {
+ uint8_t x;
+ uint8_t y;
+ uint8_t z;
+} data, rdata;
+
+int main()
+{
+ FileHandle* file;
+
+ data.x = 0xff;
+ data.y = 0x55;
+ data.z = 0xaa;
+
+ //Mount the filesystem
+ sd.mount();
+
+ //Perform a write test
+ printf("\nWriting binary data to SD card...");
+ file = sd.open("Test File.bin", O_WRONLY | O_CREAT | O_TRUNC);
+ if (file != NULL)
+ {
+ if (file->write(&data, sizeof(data)) != sizeof(data))
+ {
+ error("write error!\n");
+ }
+ if (file->close())
+ {
+ printf("failed to close file!\n");
+ }
+ else
+ {
+ printf("done!\n");
+ }
+ }
+ else
+ {
+ printf("failed to create file!\n");
+ }
+
+ //Perform a read test
+ printf("\nReading binary data from SD card...");
+ file = sd.open("Test File.bin", O_RDONLY);
+ if (file != NULL)
+ {
+ if (file->read(&rdata, sizeof(rdata)) != sizeof(rdata))
+ {
+ error("read error!\n");
+ }
+ if (file->close())
+ {
+ printf("failed to close file!\n");
+ }
+ else
+ {
+ printf("done! x:%02x y:%02x z:%02x\n", rdata.x, rdata.y, rdata.z);
+ }
+ }
+ else
+ {
+ printf("failed to open file!\n");
+ }
+
+ //Unmount the filesystem
+ sd.unmount();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 22 07:23:12 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2241e3a39974 \ No newline at end of file