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.
备注
The handle was created by this function automatically destroy when
esp_periph_destroy
is called- 参数
sdcard_config – The sdcard configuration
- 返回
The esp peripheral handle
-
bool periph_sdcard_is_mounted(esp_periph_handle_t periph)
Check the sdcard is mounted or not.
- 参数
periph – [in] The periph
- 返回
SDCARD mounted state
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 card_detect_pin
Enumerations
-
enum periph_sdcard_event_id_t
Peripheral sdcard event id.
Values:
-
enumerator SDCARD_STATUS_UNKNOWN
No event
-
enumerator SDCARD_STATUS_CARD_DETECT_CHANGE
Detect changes in the card_detect pin
-
enumerator SDCARD_STATUS_MOUNTED
SDCARD mounted successfully
-
enumerator SDCARD_STATUS_UNMOUNTED
SDCARD unmounted successfully
-
enumerator SDCARD_STATUS_MOUNT_ERROR
SDCARD mount error
-
enumerator SDCARD_STATUS_UNMOUNT_ERROR
SDCARD unmount error
-
enumerator SDCARD_STATUS_UNKNOWN