فهرست منبع

spi_master: correctly set cs polarity

All devices must be added to the same spi line before use.
Wielebny666 5 سال پیش
والد
کامیت
67d7fad764
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 2 2
      components/soc/esp32/include/hal/spi_ll.h
  2. 1 1
      components/soc/esp32s2beta/include/hal/spi_ll.h

+ 2 - 2
components/soc/esp32/include/hal/spi_ll.h

@@ -287,7 +287,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);
     }
 }
 
@@ -611,7 +611,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);
     }
 }
 

+ 1 - 1
components/soc/esp32s2beta/include/hal/spi_ll.h

@@ -322,7 +322,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);
     }
 }