Skip to content

Commit 367d380

Browse files
committed
Return false if we already have the lock
1 parent c3d1256 commit 367d380

File tree

1 file changed

+3
-0
lines changed
  • ports/esp32s2/common-hal/busio

1 file changed

+3
-0
lines changed

ports/esp32s2/common-hal/busio/I2C.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
163163
}
164164

165165
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
166+
if (self->has_lock) {
167+
return false;
168+
}
166169
self->has_lock = xSemaphoreTake(&self->semaphore, 0) == pdTRUE;
167170
return self->has_lock;
168171
}

0 commit comments

Comments
 (0)