mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
sdmmc host: minor cleanup
Code style, comments
This commit is contained in:
@@ -336,7 +336,8 @@ esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
|
|||||||
if (slot_width >= 4) {
|
if (slot_width >= 4) {
|
||||||
configure_pin(pslot->d1_gpio);
|
configure_pin(pslot->d1_gpio);
|
||||||
configure_pin(pslot->d2_gpio);
|
configure_pin(pslot->d2_gpio);
|
||||||
//force pull-up D3 to make slave detect SD mode. connect to peripheral after width configuration.
|
// Force D3 high to make slave enter SD mode.
|
||||||
|
// Connect to peripheral after width configuration.
|
||||||
gpio_config_t gpio_conf = {
|
gpio_config_t gpio_conf = {
|
||||||
.pin_bit_mask = BIT(pslot->d3_gpio),
|
.pin_bit_mask = BIT(pslot->d3_gpio),
|
||||||
.mode = GPIO_MODE_OUTPUT ,
|
.mode = GPIO_MODE_OUTPUT ,
|
||||||
@@ -344,8 +345,8 @@ esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
|
|||||||
.pull_down_en = 0,
|
.pull_down_en = 0,
|
||||||
.intr_type = GPIO_INTR_DISABLE,
|
.intr_type = GPIO_INTR_DISABLE,
|
||||||
};
|
};
|
||||||
gpio_config( &gpio_conf );
|
gpio_config(&gpio_conf);
|
||||||
gpio_set_level( pslot->d3_gpio, 1 );
|
gpio_set_level(pslot->d3_gpio, 1);
|
||||||
if (slot_width == 8) {
|
if (slot_width == 8) {
|
||||||
configure_pin(pslot->d4_gpio);
|
configure_pin(pslot->d4_gpio);
|
||||||
configure_pin(pslot->d5_gpio);
|
configure_pin(pslot->d5_gpio);
|
||||||
@@ -445,10 +446,12 @@ esp_err_t sdmmc_host_set_bus_width(int slot, size_t width)
|
|||||||
} else if (width == 4) {
|
} else if (width == 4) {
|
||||||
SDMMC.ctype.card_width_8 &= ~mask;
|
SDMMC.ctype.card_width_8 &= ~mask;
|
||||||
SDMMC.ctype.card_width |= mask;
|
SDMMC.ctype.card_width |= mask;
|
||||||
configure_pin(sdmmc_slot_info[slot].d3_gpio); // D3 was set to GPIO high to force slave into SD 1-bit mode, until 4-bit mode is set
|
// D3 was set to GPIO high to force slave into SD mode, until 4-bit mode is set
|
||||||
} else if (width == 8){
|
configure_pin(sdmmc_slot_info[slot].d3_gpio);
|
||||||
|
} else if (width == 8) {
|
||||||
SDMMC.ctype.card_width_8 |= mask;
|
SDMMC.ctype.card_width_8 |= mask;
|
||||||
configure_pin(sdmmc_slot_info[slot].d3_gpio); // D3 was set to GPIO high to force slave into SD 1-bit mode, until 4-bit mode is set
|
// D3 was set to GPIO high to force slave into SD mode, until 4-bit mode is set
|
||||||
|
configure_pin(sdmmc_slot_info[slot].d3_gpio);
|
||||||
} else {
|
} else {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
@@ -601,4 +604,4 @@ esp_err_t sdmmc_host_pullup_en(int slot, int width)
|
|||||||
gpio_pullup_en(sdmmc_slot_info[slot].d7_gpio);
|
gpio_pullup_en(sdmmc_slot_info[slot].d7_gpio);
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user