Return false if we already have the lock
This commit is contained in:
parent
c3d1256d76
commit
367d3800fc
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue