bugfix: esp32: spi: correct idle polarity and mode configuration

Possible fix for incorrection spi mode configuration
on esp32 (#61866)

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
This commit is contained in:
Martin Kiepfer 2023-08-24 21:34:56 +02:00 committed by Carles Cufí
parent 8a9b33729b
commit bda6656eca

View file

@ -331,11 +331,10 @@ static int IRAM_ATTR spi_esp32_configure(const struct device *dev,
/* SPI mode */
hal_dev->mode = 0;
if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) {
if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) {
hal_dev->mode = BIT(0);
}
if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) {
if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) {
hal_dev->mode |= BIT(1);
}