Skip to content

Commit

Permalink
ports/espressif/common-hal/busio/I2C.c: add delay after probe
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Jan 8, 2025
1 parent 26283dc commit 395ebaf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 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,8 @@ 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);
// ESP32-S2 gives spurious results when probe is called multiple times in succession without this delay.
mp_hal_delay_ms(1);
return result == ESP_OK;
}

Expand Down

0 comments on commit 395ebaf

Please sign in to comment.