Developer World
Spresense Arduino Library v3.2.0-77d75a4
SDClass Class Reference

The SD class provides functions for accessing the SD card and manipulating its files and directories. Also, this class also provides the USB Mass storage function. More...

#include <SDHCI.h>

Inheritance diagram for SDClass:
Collaboration diagram for SDClass:

Public Member Functions

boolean begin (uint8_t dummy=0)
 Initialize the SD library. More...
 
int beginUsbMsc ()
 Start USB Mass Storage Class.
 
int endUsbMsc ()
 Stop USB Mass Storage Class.
 
int format (uint8_t fattype=32)
 Format the SD card. More...
 
- Public Member Functions inherited from StorageClass
 StorageClass (const char *str)
 
File open (const char *filename, uint8_t mode=FILE_READ)
 Opens a file on the Flash. More...
 
File open (const String &filename, uint8_t mode=FILE_READ)
 Opens a file on the Flash. More...
 
boolean exists (const char *filepath)
 Tests whether a file or directory exists on the Flash. More...
 
boolean exists (const String &filepath)
 Tests whether a file or directory exists on the Flash. More...
 
boolean mkdir (const char *filepath)
 Create a directory on the Flash. More...
 
boolean mkdir (const String &filepath)
 Create a directory on the Flash. More...
 
boolean remove (const char *filepath)
 Remove a file from the Flash. More...
 
boolean remove (const String &filepath)
 Remove a file from the Flash. More...
 
boolean rmdir (const char *filepath)
 Remove a directory from the Flash. More...
 
boolean rmdir (const String &filepath)
 Remove a directory from the Flash. More...
 

Additional Inherited Members

- Protected Attributes inherited from StorageClass
char mountdir [16]
 

Detailed Description

The SD class provides functions for accessing the SD card and manipulating its files and directories. Also, this class also provides the USB Mass storage function.

Member Function Documentation

◆ begin()

boolean SDClass::begin ( uint8_t  dummy = 0)

Initialize the SD library.

This will check that the SD card is inserted and mounted or not. This needs to be called to set up the connection to the SD card before other methods are used.

Parameters
[in]dummydummy argument to keep compatibility with Arduino SD library
Returns
true if the SD card is inserted and mounted, false if not

◆ format()

int SDClass::format ( uint8_t  fattype = 32)

Format the SD card.

This will format the unformatted SD card to FAT file system.

Parameters
[in]fattypeFAT type: 12 or 16 or 32 (default 32)
Returns
0 if the SD card format is successful, error code if not

The documentation for this class was generated from the following file: