Functions | |
| esp_err_t | mount_sd_card (void) |
| Mount the SD card with LittleFS. | |
| void | sd_card_log_info (const sdmmc_card_t *card) |
| Log information about a mounted SD card. | |
| esp_err_t | unmount_sd_card (void) |
| Unmount the SD card and release associated resources. | |
SD Card Macros | |
| #define | SD_PWR_CTRL_LDO_IO_ID (4) |
| GPIO controlling SD power via LDO. | |
| #define | GPIO_UNUSED (-1) |
| Placeholder for unused GPIO. | |
| #define | SD_CARD_MOUNT_PATH ("/littlefs") |
| Path where SD card is mounted with VFS. | |
| #define | SD_CARD_BUS_WIDTH (4) |
| SD card bus width. | |
| #define | BYTE_DIV (8) |
| Divider to convert bits to bytes. | |
Useful ESP-IDF wrappers to initialize/deinitialize the file system on SD cards.
The OBC employs the fail-safe LittleFS file system. VFS is used to map standard POSIX calls to LittleFS functions.
| #define BYTE_DIV (8) |
Divider to convert bits to bytes.
| #define GPIO_UNUSED (-1) |
Placeholder for unused GPIO.
| #define SD_CARD_BUS_WIDTH (4) |
SD card bus width.
| #define SD_CARD_MOUNT_PATH ("/littlefs") |
Path where SD card is mounted with VFS.
| #define SD_PWR_CTRL_LDO_IO_ID (4) |
GPIO controlling SD power via LDO.
| esp_err_t mount_sd_card | ( | void | ) |
Mount the SD card with LittleFS.
The following steps are performed:
| ESP_OK | On success. |
| ESP_ERR_INVALID_ARG | Bad initialization for objects. |
| ESP_ERR_INVALID_STATE | Either the SDMMC host has not been configured or the partition is already mounted / is encrypted. |
| ESP_ERR_NO_MEM | Failed to allocate memory for objects. |
| ESP_ERR_NOT_FOUND | Partition for LittleFS was not found. |
| ESP_FAIL | Mount or format failed. |
| void sd_card_log_info | ( | const sdmmc_card_t * | card | ) |
Log information about a mounted SD card.
The following information is loged:
| [in] | card | Pointer to a SD card descriptor. |
| esp_err_t unmount_sd_card | ( | void | ) |
Unmount the SD card and release associated resources.
Safely unmounts the LittleFS file system and powers down the SD card.
| ESP_OK | On success. |
| ESP_ERR_INVALID_ARG | LDO instance is invalid. |
| ESP_ERR_INVALID_STATE | SDMMC host in not initialized or is unregistered. |