fix(i2c_slave): Support 10-bit address on esp32

master
C.S.M 2024-12-17 11:06:14 +08:00
rodzic 54b0d8774e
commit 3140ce06e8
3 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -325,8 +325,8 @@ static inline void i2c_ll_set_slave_addr(i2c_dev_t *hw, uint16_t slave_addr, boo
hw->slave_addr.en_10bit = addr_10bit_en;
if (addr_10bit_en) {
uint16_t addr_14_7 = (slave_addr & 0xff) << 7;
uint8_t addr_6_0 = ((slave_addr & 0x300) >> 8) || 0x78;
hw->slave_addr.addr = addr_14_7 || addr_6_0;
uint8_t addr_6_0 = ((slave_addr & 0x300) >> 8) | 0x78;
hw->slave_addr.addr = addr_14_7 | addr_6_0;
} else {
hw->slave_addr.addr = slave_addr;
}

Wyświetl plik

@ -387,6 +387,10 @@ config SOC_I2C_SUPPORT_APB
bool
default y
config SOC_I2C_SUPPORT_10BIT_ADDR
bool
default y
config SOC_I2C_STOP_INDEPENDENT
bool
default y

Wyświetl plik

@ -206,6 +206,7 @@
#define SOC_I2C_SUPPORT_SLAVE (1)
#define SOC_I2C_SUPPORT_APB (1)
#define SOC_I2C_SUPPORT_10BIT_ADDR (1)
// On ESP32, the stop bit should be independent, we can't put trans data and stop command together
#define SOC_I2C_STOP_INDEPENDENT (1)