#define SDMMC_SLOT_NO_CD ((gpio_num_t) -1) ///< indicates that card detect line is not used
#define SDMMC_SLOT_NO_WP ((gpio_num_t) -1) ///< indicates that write protect line is not used
+#define SDMMC_SLOT_WIDTH_DEFAULT 0 ///< use the default width for the slot (8 for slot 0, 4 for slot 1)
/**
* Macro defining default configuration of SDMMC host slot
#define SDMMC_SLOT_CONFIG_DEFAULT() {\
.gpio_cd = SDMMC_SLOT_NO_CD, \
.gpio_wp = SDMMC_SLOT_NO_WP, \
- .width = 4, \
+ .width = SDMMC_SLOT_WIDTH_DEFAULT, \
}
/**
}
int gpio_cd = slot_config->gpio_cd;
int gpio_wp = slot_config->gpio_wp;
+ uint8_t slot_width = slot_config->width;
// Configure pins
const sdmmc_slot_info_t* pslot = &s_slot_info[slot];
- if (slot_config->width > pslot->width) {
+ if (slot_width == SDMMC_SLOT_WIDTH_DEFAULT) {
+ slot_width = pslot->width;
+ }
+ else if (slot_width > pslot->width) {
return ESP_ERR_INVALID_ARG;
}
configure_pin(pslot->clk);
configure_pin(pslot->cmd);
configure_pin(pslot->d0);
- if (slot_config->width >= 4) {
+ if (slot_width >= 4) {
configure_pin(pslot->d1);
configure_pin(pslot->d2);
configure_pin(pslot->d3);
- if (slot_config->width == 8) {
+ if (slot_width == 8) {
configure_pin(pslot->d4);
configure_pin(pslot->d5);
configure_pin(pslot->d6);
.. doxygendefine:: SDMMC_HOST_SLOT_0
.. doxygendefine:: SDMMC_HOST_SLOT_1
.. doxygendefine:: SDMMC_HOST_DEFAULT
+.. doxygendefine:: SDMMC_SLOT_WIDTH_DEFAULT
.. doxygenfunction:: sdmmc_host_init_slot