SD Card Peripheral¶
If your board has a SD card connected, use this API to initialize, mount and unmount the card, see functions periph_sdcard_init()
, periph_sdcard_mount()
and periph_sdcard_unmount()
. The data reading / writing is implemented in a separate API described in FatFs 流.
Application Examples¶
Implementation of this API is demonstrated in couple of examples:
API Reference¶
Header File¶
Functions¶
-
esp_periph_handle_t
periph_sdcard_init
(periph_sdcard_cfg_t *sdcard_config)¶ Create the sdcard peripheral handle for esp_peripherals.
- Note
The handle was created by this function automatically destroy when
esp_periph_destroy
is called- Return
The esp peripheral handle
- Parameters
sdcard_config
: The sdcard configuration
-
bool
periph_sdcard_is_mounted
(esp_periph_handle_t periph)¶ Check the sdcard is mounted or not.
- Return
SDCARD mounted state
- Parameters
[in] periph
: The periph
Structures¶
-
struct
periph_sdcard_cfg_t
¶ The SD Card Peripheral configuration.
Public Members
-
int
card_detect_pin
¶ Card detect gpio number
-
const char *
root
¶ Base path for vfs
-
periph_sdcard_mode_t
mode
¶ card mode
-
int
Enumerations¶
-
enum
periph_sdcard_event_id_t
¶ Peripheral sdcard event id.
Values:
-
SDCARD_STATUS_UNKNOWN
¶ No event
-
SDCARD_STATUS_CARD_DETECT_CHANGE
¶ Detect changes in the card_detect pin
-
SDCARD_STATUS_MOUNTED
¶ SDCARD mounted successfully
-
SDCARD_STATUS_UNMOUNTED
¶ SDCARD unmounted successfully
-
SDCARD_STATUS_MOUNT_ERROR
¶ SDCARD mount error
-
SDCARD_STATUS_UNMOUNT_ERROR
¶ SDCARD unmount error
-