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: MMA8451Q SDFileSystem mbed
Fork of SDCardTest by
Diff: SDFileSystem.h
- Revision:
- 2:849162a1207f
- Parent:
- 0:666a082cf50f
- Child:
- 3:68ef62208d4d
--- a/SDFileSystem.h Mon Dec 14 20:31:54 2009 +0000
+++ b/SDFileSystem.h Mon Dec 14 22:32:28 2009 +0000
@@ -1,56 +1,58 @@
-/* mbed Microcontroller Library - SDFileSystem
- * Copyright (c) 2008-2009, sford
- */
-
-#ifndef SDFILESYSTEM_H
-#define SDFILESYSTEM_H
-
-#include "mbed.h"
-#include "FATFileSystem.h"
-
-/* Class: SDFileSystem
- * Access the filesystem on an SD Card using SPI
- *
- * Example:
- * > SDFileSystem sd(p5, p6, p7, p12, "sd");
- * >
- * > int main() {
- * > FILE *fp = fopen("/sd/myfile.txt", "w");
- * > fprintf(fp, "Hello World!\n");
- * > fclose(fp);
- * > }
- */
-class SDFileSystem : public FATFileSystem {
-public:
-
- /* Constructor: SDFileSystem
- * Create the File System for accessing an SD Card using SPI
- *
- * Variables:
- * mosi - SPI mosi pin connected to SD Card
- * miso - SPI miso pin conencted to SD Card
- * sclk - SPI sclk pin connected to SD Card
- * cs - DigitalOut pin used as SD Card chip select
- * name - The name used to access the filesystem
- */
- SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
- virtual int disk_initialize();
- virtual int disk_write(const char *buffer, int block_number);
- virtual int disk_read(char *buffer, int block_number);
- virtual int disk_status();
- virtual int disk_sync();
- virtual int disk_sectors();
-
-protected:
-
- int _cmd(int cmd, int arg);
- int _read(char *buffer, int length);
- int _write(const char *buffer, int length);
- int _sd_sectors();
- int _sectors;
-
- SPI _spi;
- DigitalOut _cs;
-};
-
-#endif
+/* mbed Microcontroller Library - SDFileSystem
+ * Copyright (c) 2008-2009, sford
+ */
+
+#ifndef SDFILESYSTEM_H
+#define SDFILESYSTEM_H
+
+#include "mbed.h"
+#include "FATFileSystem.h"
+
+/* Class: SDFileSystem
+ * Access the filesystem on an SD Card using SPI
+ *
+ * Example:
+ * > SDFileSystem sd(p5, p6, p7, p12, "sd");
+ * >
+ * > int main() {
+ * > FILE *fp = fopen("/sd/myfile.txt", "w");
+ * > fprintf(fp, "Hello World!\n");
+ * > fclose(fp);
+ * > }
+ */
+class SDFileSystem : public FATFileSystem {
+public:
+
+ /* Constructor: SDFileSystem
+ * Create the File System for accessing an SD Card using SPI
+ *
+ * Variables:
+ * mosi - SPI mosi pin connected to SD Card
+ * miso - SPI miso pin conencted to SD Card
+ * sclk - SPI sclk pin connected to SD Card
+ * cs - DigitalOut pin used as SD Card chip select
+ * name - The name used to access the filesystem
+ */
+ SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
+ virtual int disk_initialize();
+ virtual int disk_write(const char *buffer, int block_number);
+ virtual int disk_read(char *buffer, int block_number);
+ virtual int disk_status();
+ virtual int disk_sync();
+ virtual int disk_sectors();
+
+protected:
+
+ int _cmd(int cmd, int arg);
+ int _cmd8();
+
+ int _read(char *buffer, int length);
+ int _write(const char *buffer, int length);
+ int _sd_sectors();
+ int _sectors;
+
+ SPI _spi;
+ DigitalOut _cs;
+};
+
+#endif
