mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
spi: move gpio direction config to common func for coinsistence
(MINOR CHANGE)
This commit is contained in:
parent
2600f43822
commit
e5ed450d95
@ -312,6 +312,7 @@ void spicommon_cs_initialize(spi_host_device_t host, int cs_io_num, int cs_num,
|
||||
gpio_iomux_out(cs_io_num, FUNC_SPI, false);
|
||||
} else {
|
||||
//Use GPIO matrix
|
||||
gpio_set_direction(cs_io_num, GPIO_MODE_INPUT_OUTPUT);
|
||||
gpio_matrix_out(cs_io_num, spi_periph_signal[host].spics_out[cs_num], false, false);
|
||||
if (cs_num == 0) gpio_matrix_in(cs_io_num, spi_periph_signal[host].spics_in, false);
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], FUNC_GPIO);
|
||||
|
@ -484,7 +484,6 @@ Specify ``SPI_DEVICE_NO_DUMMY`` to ignore this checking. Then you can output dat
|
||||
|
||||
//Set CS pin, CS options
|
||||
if (dev_config->spics_io_num >= 0) {
|
||||
gpio_set_direction(dev_config->spics_io_num, GPIO_MODE_OUTPUT);
|
||||
spicommon_cs_initialize(host, dev_config->spics_io_num, freecs, !(spihost[host]->flags&SPICOMMON_BUSFLAG_NATIVE_PINS));
|
||||
}
|
||||
if (dev_config->flags&SPI_DEVICE_CLK_AS_CS) {
|
||||
|
@ -136,7 +136,6 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b
|
||||
ret = err;
|
||||
goto cleanup;
|
||||
}
|
||||
gpio_set_direction(slave_config->spics_io_num, GPIO_MODE_INPUT);
|
||||
spicommon_cs_initialize(host, slave_config->spics_io_num, 0, !bus_is_iomux(spihost[host]));
|
||||
// The slave DMA suffers from unexpected transactions. Forbid reading if DMA is enabled by disabling the CS line.
|
||||
if (dma_chan != 0) freeze_cs(spihost[host]);
|
||||
|
Loading…
Reference in New Issue
Block a user