Skip to content

Commit e5f2ed1

Browse files
authored
changes to compile as component of IDF branch release/v5.3
1 parent dbfde15 commit e5f2ed1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cores/esp32/esp32-hal-i2c-slave.c

+10
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,14 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
335335
}
336336
#endif // !defined(CONFIG_IDF_TARGET_ESP32P4)
337337

338+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 3)
339+
i2c_ll_set_mode(i2c->dev, I2C_BUS_MODE_SLAVE);
340+
i2c_ll_enable_pins_open_drain(i2c->dev, true);
341+
i2c_ll_enable_fifo_mode(i2c->dev, true);
342+
#else
338343
i2c_ll_slave_init(i2c->dev);
339344
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
345+
#endif
340346
i2c_ll_set_slave_addr(i2c->dev, slaveID, false);
341347
i2c_ll_set_tout(i2c->dev, I2C_LL_MAX_TIMEOUT);
342348
i2c_slave_set_frequency(i2c, frequency);
@@ -357,7 +363,11 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
357363

358364
i2c_ll_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
359365
i2c_ll_clear_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
366+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 3)
367+
i2c_ll_enable_fifo_mode(i2c->dev, true);
368+
#else
360369
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
370+
#endif
361371

362372
if (!i2c->intr_handle) {
363373
uint32_t flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED;

0 commit comments

Comments
 (0)