Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ports/espressif/common-hal/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "shared-bindings/busio/I2C.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "py/runtime.h"

#include "components/driver/i2c/include/driver/i2c.h"
Expand Down Expand Up @@ -134,6 +135,12 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {

bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
esp_err_t result = i2c_master_probe(self->handle, addr, 10);

#if defined(CONFIG_IDF_TARGET_ESP32S2)
// ESP32-S2 gives spurious results when probe is called multiple times in succession without this delay.
mp_hal_delay_ms(1);
#endif

return result == ESP_OK;
}

Expand Down