esp_err_t Core2ForAWS_SDcard_Unmount(const char *mount_path, sdmmc_card_t *out_card)
Removes the FAT partition and unmounts the SD-Card.
Definition: core2forAWS.c:132
Removes the FAT partition and unmounts the SD-Card.
- Note
- The SD Card must be mounted before use. The SD card and the screen uses the same SPI bus. In order to avoid conflicts with the screen, you must take the spi_mutex semaphore, then call spi_poll() before accessing the SD card. Once done, give/free the semaphore so the display can take it. The display task will then continue to update the display controller on the SPI bus.
To learn more about using the SD card, visit Espressif's virtual file system component docs for usage.
The example code below, mounts the SD card, writes a file named hello.txt on the path /sdcard with the contents "Hello
<<YOUR SD CARD'S PRODUCT NAME>>!", and then unmounts the card:
Example:
#define MOUNT_POINT "/sdcard"
sdmmc_card_t* card;
esp_err_t err;
err = Core2ForAWS_Sdcard_Mount(MOUNT_POINT, &card);
FILE* f = fopen(MOUNT_POINT"/hello.txt", "w+")
fprintf(f, "Hello %s!\n", card->cid.name);
fclose(f);
err = Core2ForAWS_Sdcard_Unmount(MOUNT_POINT, &card);
void spi_poll()
Polls the SPI bus for a pending SPI transaction to complete.
Definition: disp_spi.c:34
SemaphoreHandle_t spi_mutex
Semaphore for the shared SPI bus.
Definition: disp_spi.c:21
- Parameters
-
| [in] | mount_path | The path where partition should be registered. |
| [out] | out_card | The card information structure. |
- Returns
- esp_err_t. 0 or
ESP_OK if successful.