1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/sdcard_spi: make use of spi_deinit_pins()

Make sure to de-init the SPI bus before using the pins as GPIO.

Once all archs implement periph_spi_reconfigure, we can drop mosi,
miso and clk pins from the `card->params` and just use the bus
getter functions.
This commit is contained in:
Benjamin Valentin 2020-05-27 13:15:27 +02:00
parent 3e91914831
commit f3e28c0350
2 changed files with 4 additions and 0 deletions

View File

@ -651,6 +651,7 @@ endif
ifneq (,$(filter sdcard_spi,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_spi
FEATURES_OPTIONAL += periph_spi_reconfigure
DEFAULT_MODULE += auto_init_storage
USEMODULE += checksum
USEMODULE += xtimer

View File

@ -84,6 +84,9 @@ static sd_init_fsm_state_t _init_sd_fsm_step(sdcard_spi_t *card, sd_init_fsm_sta
case SD_INIT_START:
DEBUG("SD_INIT_START\n");
#ifdef MODULE_PERIPH_SPI_RECONFIGURE
spi_deinit_pins(card->params.spi_dev);
#endif
if ((gpio_init(card->params.mosi, GPIO_OUT) == 0) &&
(gpio_init(card->params.clk, GPIO_OUT) == 0) &&
(gpio_init(card->params.cs, GPIO_OUT) == 0) &&