Skip to content

Commit a750c5f

Browse files
authored
Merge pull request #10838 from dhalbert/espressif-fix-i2c-deinit
Espressif I2C: check for deinit() in unlock()
2 parents 0eddc63 + 0a18d1d commit a750c5f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
132132
xSemaphoreGive(self->xSemaphore);
133133
vSemaphoreDelete(self->xSemaphore);
134134
self->xSemaphore = NULL;
135+
self->has_lock = false;
135136

136137
common_hal_reset_pin(self->sda_pin);
137138
common_hal_reset_pin(self->scl_pin);
@@ -165,6 +166,9 @@ bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) {
165166
}
166167

167168
void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
169+
if (common_hal_busio_i2c_deinited(self)) {
170+
return;
171+
}
168172
xSemaphoreGive(self->xSemaphore);
169173
self->has_lock = false;
170174
}

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jinja2
44
typer
55

66
sh
7-
click
7+
click<8.2.0
88
cpp-coveralls
99

1010
requests

0 commit comments

Comments
 (0)