spi: move gpio direction config to common func for coinsistence
(MINOR CHANGE)
This commit is contained in:
parent
3c532e4532
commit
a5a692ef8c
3 changed files with 1 additions and 2 deletions
|
@ -329,6 +329,7 @@ void spicommon_cs_initialize(spi_host_device_t host, int cs_io_num, int cs_num,
|
|||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], 1);
|
||||
} else {
|
||||
//Use GPIO matrix
|
||||
gpio_set_direction(cs_io_num, GPIO_MODE_INPUT_OUTPUT);
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], PIN_FUNC_GPIO);
|
||||
gpio_matrix_out(cs_io_num, io_signal[host].spics_out[cs_num], false, false);
|
||||
if (cs_num == 0) gpio_matrix_in(cs_io_num, io_signal[host].spics_in, false);
|
||||
|
|
|
@ -271,7 +271,6 @@ esp_err_t spi_bus_add_device(spi_host_device_t host, spi_device_interface_config
|
|||
|
||||
//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]->no_gpio_matrix == false);
|
||||
}
|
||||
if (dev_config->flags&SPI_DEVICE_CLK_AS_CS) {
|
||||
|
|
|
@ -96,7 +96,6 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b
|
|||
spihost[host]->id = host;
|
||||
|
||||
spicommon_bus_initialize_io(host, bus_config, dma_chan, SPICOMMON_BUSFLAG_SLAVE, &native);
|
||||
gpio_set_direction(slave_config->spics_io_num, GPIO_MODE_INPUT);
|
||||
spicommon_cs_initialize(host, slave_config->spics_io_num, 0, native==false);
|
||||
// The slave DMA suffers from unexpected transactions. Forbid reading if DMA is enabled by disabling the CS line.
|
||||
if (dma_chan != 0) spicommon_freeze_cs(host);
|
||||
|
|
Loading…
Reference in a new issue