Update version of EALib.

Dependencies:   FATFileSystem

Fork of EALib by IONX

Embed: (wiki syntax)

« Back to documentation index

MCIFileSystem Class Reference

MCIFileSystem Class Reference

Access the filesystem on an SD Card using MCI. More...

#include <MCIFileSystem.h>

Public Member Functions

 MCIFileSystem (const char *name, PinName cd=p38)
 Create the File System for accessing an SD/MMC Card using MCI.
bool cardInserted () const
 Tests if a SD/MMC card is inserted or not.

Detailed Description

Access the filesystem on an SD Card using MCI.

 #include "mbed.h"
 #include "MCIFileSystem.h"

 MCIFileSystem mcifs("mci");

 int main() {
     printf("Please insert a SD/MMC card\n");
     while(!mcifs.cardInserted()) {
         wait(0.5);
     }
     
     printf("Found SD/MMC card, writing to /mci/myfile.txt ...\n");
     
     FILE *fp = fopen("/mci/myfile.txt", "w");
     if (fp != NULL) {
         fprintf(fp, "Hello World!\n");
         fclose(fp);
         printf("Wrote to /mci/myfile.txt\n");
     } else {
         printf("Failed to open /mci/myfile.txt\n");
     }
 }

Definition at line 50 of file MCIFileSystem.h.


Constructor & Destructor Documentation

MCIFileSystem ( const char *  name,
PinName  cd = p38 
)

Create the File System for accessing an SD/MMC Card using MCI.

Parameters:
nameThe name used to access the virtual filesystem
cdThe pin connected to the CardDetect line

Definition at line 600 of file MCIFileSystem.cpp.


Member Function Documentation

bool cardInserted (  ) const

Tests if a SD/MMC card is inserted or not.

Returns:
True if a card has been inserted, False if no card is inserted or if the card detect pin is unavailable

Definition at line 800 of file MCIFileSystem.cpp.