The code from https://github.com/vpcola/Nucleo
SDFileSystem Class Reference
Access the filesystem on an SD Card using SPI. More...
#include <SDFileSystem.h>
Inherits FATFileSystem.
Public Member Functions | |
SDFileSystem (PinName mosi, PinName miso, PinName sclk, PinName cs, const char *name) | |
Create the File System for accessing an SD Card using SPI. | |
virtual FileHandle * | open (const char *name, int flags) |
Opens a file on the filesystem. | |
virtual int | stat (const char *name, FILINFO *) |
Gets information on a file. | |
virtual int | remove (const char *filename) |
Removes a file path. | |
virtual int | format () |
Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster. | |
virtual DirHandle * | opendir (const char *name) |
Opens a directory on the filesystem. | |
virtual int | mkdir (const char *name, mode_t mode) |
Creates a directory path. | |
virtual int | rename (const char *oldname, const char *newname) |
Rename a file in the filesystem. |
Detailed Description
Access the filesystem on an SD Card using SPI.
#include "mbed.h" #include "SDFileSystem.h" SDFileSystem sd(p5, p6, p7, p12, "sd"); // MOSI, MISO, SCLK, SSEL int main() { FILE *fp = fopen("/sd/mbed.txt", "w"); fprintf(fp, "Hello World!\n"); fclose(fp); }
Definition at line 44 of file SDFileSystem.h.
Constructor & Destructor Documentation
SDFileSystem | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | cs, | ||
const char * | name | ||
) |
Create the File System for accessing an SD Card using SPI.
- Parameters:
-
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 virtual filesystem
Definition at line 124 of file SDFileSystem.cpp.
Member Function Documentation
int format | ( | ) | [virtual, inherited] |
Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster.
Definition at line 126 of file FATFileSystem.cpp.
int mkdir | ( | const char * | name, |
mode_t | mode | ||
) | [virtual, inherited] |
Creates a directory path.
Reimplemented from FileSystemLike.
Definition at line 144 of file FATFileSystem.cpp.
FileHandle * open | ( | const char * | name, |
int | flags | ||
) | [virtual, inherited] |
Opens a file on the filesystem.
Implements FileSystemLike.
Definition at line 68 of file FATFileSystem.cpp.
DirHandle * opendir | ( | const char * | name ) | [virtual, inherited] |
Opens a directory on the filesystem.
Reimplemented from FileSystemLike.
Definition at line 135 of file FATFileSystem.cpp.
int remove | ( | const char * | filename ) | [virtual, inherited] |
Removes a file path.
Reimplemented from FileSystemLike.
Definition at line 117 of file FATFileSystem.cpp.
virtual int rename | ( | const char * | oldname, |
const char * | newname | ||
) | [virtual, inherited] |
Rename a file in the filesystem.
- Parameters:
-
oldname the name of the file to rename. newname the name to rename it to.
- Returns:
- 0 on success, -1 on failure.
Definition at line 75 of file FileSystemLike.h.
int stat | ( | const char * | name, |
FILINFO * | info | ||
) | [virtual, inherited] |
Gets information on a file.
Definition at line 102 of file FATFileSystem.cpp.
Generated on Tue Jul 12 2022 18:55:02 by 1.7.2