From 3dd5b574ee1906d166b639afdeab587923726aae Mon Sep 17 00:00:00 2001 From: Wielebny666 <31576684+Wielebny666@users.noreply.github.com> Date: Tue, 23 Jun 2020 16:02:50 +0200 Subject: [PATCH] spi_master: correctly set cs polarity All devices must be added to the same spi line before use. --- components/soc/src/esp32/include/hal/spi_ll.h | 4 ++-- components/soc/src/esp32s2/include/hal/spi_ll.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/soc/src/esp32/include/hal/spi_ll.h b/components/soc/src/esp32/include/hal/spi_ll.h index bfcc9e7360..953a93546a 100644 --- a/components/soc/src/esp32/include/hal/spi_ll.h +++ b/components/soc/src/esp32/include/hal/spi_ll.h @@ -291,7 +291,7 @@ static inline void spi_ll_master_set_pos_cs(spi_dev_t *hw, int cs, uint32_t pos_ if (pos_cs) { hw->pin.master_cs_pol |= (1 << cs); } else { - hw->pin.master_cs_pol &= (1 << cs); + hw->pin.master_cs_pol &= ~(1 << cs); } } @@ -615,7 +615,7 @@ static inline void spi_ll_master_set_cksel(spi_dev_t *hw, int cs, uint32_t cksel if (cksel) { hw->pin.master_ck_sel |= (1 << cs); } else { - hw->pin.master_ck_sel &= (1 << cs); + hw->pin.master_ck_sel &= ~(1 << cs); } } diff --git a/components/soc/src/esp32s2/include/hal/spi_ll.h b/components/soc/src/esp32s2/include/hal/spi_ll.h index f719202a0a..28a4d89817 100644 --- a/components/soc/src/esp32s2/include/hal/spi_ll.h +++ b/components/soc/src/esp32s2/include/hal/spi_ll.h @@ -316,7 +316,7 @@ static inline void spi_ll_master_set_pos_cs(spi_dev_t *hw, int cs, uint32_t pos_ if (pos_cs) { hw->misc.master_cs_pol |= (1 << cs); } else { - hw->misc.master_cs_pol &= (1 << cs); + hw->misc.master_cs_pol &= ~(1 << cs); } }