mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
cpu/sam0_common: SPI: only mux MISO on spi_acquire()
This commit is contained in:
parent
00a467e86d
commit
31bf0c5257
@ -356,11 +356,9 @@ void spi_init_pins(spi_t bus)
|
||||
}
|
||||
|
||||
gpio_init(spi_config[bus].mosi_pin, GPIO_OUT);
|
||||
gpio_init_mux(spi_config[bus].mosi_pin, spi_config[bus].mosi_mux);
|
||||
|
||||
gpio_init(spi_config[bus].clk_pin, GPIO_OUT);
|
||||
/* clk_pin will be muxed during acquire / release */
|
||||
|
||||
/* mosi_pin, clk_pin will be muxed during acquire / release */
|
||||
mutex_unlock(&locks[bus]);
|
||||
}
|
||||
|
||||
@ -371,7 +369,6 @@ void spi_deinit_pins(spi_t bus)
|
||||
if (gpio_is_valid(spi_config[bus].miso_pin)) {
|
||||
gpio_disable_mux(spi_config[bus].miso_pin);
|
||||
}
|
||||
gpio_disable_mux(spi_config[bus].mosi_pin);
|
||||
}
|
||||
|
||||
int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
|
||||
@ -391,6 +388,7 @@ int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
|
||||
}
|
||||
|
||||
/* mux clk_pin to SPI peripheral */
|
||||
gpio_init_mux(spi_config[bus].mosi_pin, spi_config[bus].mosi_mux);
|
||||
gpio_init_mux(spi_config[bus].clk_pin, spi_config[bus].clk_mux);
|
||||
|
||||
return SPI_OK;
|
||||
@ -398,9 +396,11 @@ int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
|
||||
|
||||
void spi_release(spi_t bus)
|
||||
{
|
||||
/* Demux clk_pin back to GPIO_OUT function. Otherwise it will get HIGH-Z
|
||||
* and lead to unexpected current draw by SPI salves. */
|
||||
/* Demux clk_pin and mosi_pin back to GPIO_OUT function.
|
||||
* Otherwise it will get HIGH-Z and lead to unexpected current draw by SPI salves.
|
||||
*/
|
||||
gpio_disable_mux(spi_config[bus].clk_pin);
|
||||
gpio_disable_mux(spi_config[bus].mosi_pin);
|
||||
|
||||
if (_is_qspi(bus)) {
|
||||
_qspi_release();
|
||||
|
Loading…
Reference in New Issue
Block a user