![]() |
Data Gator
Hardware and software documentation for the Data Gator project.
|
Thin wrapper around ESP32 SD card API. More...
#include <SDCard.hpp>
Public Types | |
using | File = fs::File |
Public Member Functions | |
operator bool () const | |
bool | begin (uint8_t clkPin=TT_CLK, uint8_t misoPin=TT_MISO, uint8_t mosiPin=TT_MOSI, uint8_t ssPin=TT_SS, SPIClass *spi=&SPI) |
void | end () |
Terminate connection to SD Card and associated SPI interface. | |
File | open (const char *path, const char *mode=FILE_READ, const bool create=false) |
File | open (const String &path, const char *mode=FILE_READ, const bool create=false) |
bool | exists (const char *path) |
bool | exists (const String &path) |
bool | remove (const char *path) |
bool | remove (const String &path) |
bool | rename (const char *pathFrom, const char *pathTo) |
bool | rename (const String &pathFrom, const String &pathTo) |
bool | mkdir (const char *path) |
bool | mkdir (const String &path) |
bool | rmdir (const char *path) |
bool | rmdir (const String &path) |
Private Attributes | |
fs::SDFS * | mCard |
Thin wrapper around ESP32 SD card API.
Only works with ESP32 Arduino framework
using SDCard::File = fs::File |
|
inline |
Function to connect to an SD card using the specified pins and SPI interface.
For more information on SPI https://en.wikipedia.org/wiki/Serial_Peripheral_Interface ESP32 docs https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/spi_master.html
clkPin | - GPIO pin that provides the clock signal. |
misoPin | - Master in slave out pin. |
mosiPin | - Master out slave in pin. |
ssPin | - Chip/Save select. |
spi | - Pointer to SPI interface. |
Check to see if path exists.
path | path to file or directory. |
Create a directory
If directory doesn't exist it will be created.
path | path to directory to create. Naming conventions are the same as for files. For example "\testdir" will be in the root of the device. |
|
inline |
Open and possibly create a file.
path | Name of file. This API uses the 8.3 DOS file name rules. The full path of the file needs to be specified. Files in the root of the device will requre a "/". For example "/test.txt". |
mode | "w", "r", "a". Simple C style modes. |
create | If true allows creation of the file. true is implied if mode is "w". |
|
inlineexplicit |
Operator to test if properly initialized.
Permantly delete a file or directory
path | path to file or directory. |
Permantly rename a file or directory
pathFrom | path to original file or directory |
pathTo | path to new file or directory |
Delete a directory
path must be an empty directory.
path | path to directory to delete. |