diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-07-01 14:35:25 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-07-01 14:35:25 -0700 |
| commit | 367d3800fc501bfe3ec05b4b517ed195cf8d07c4 (patch) | |
| tree | 3e92cf2edb7d1ec1c9c216355ad9af0c90950cc9 /ports/esp32s2 | |
| parent | c3d1256d765a7de12d787c2641017de25dbde7d0 (diff) | |
Return false if we already have the lock
Diffstat (limited to 'ports/esp32s2')
| -rw-r--r-- | ports/esp32s2/common-hal/busio/I2C.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/busio/I2C.c b/ports/esp32s2/common-hal/busio/I2C.c index 74b3896fc..57270372f 100644 --- a/ports/esp32s2/common-hal/busio/I2C.c +++ b/ports/esp32s2/common-hal/busio/I2C.c @@ -163,6 +163,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { } bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) { + if (self->has_lock) { + return false; + } self->has_lock = xSemaphoreTake(&self->semaphore, 0) == pdTRUE; return self->has_lock; } |
