espressif: i2c: initialize "has_lock"
Otherwise, a stack-constructed i2c instance might get some other value here.
This commit is contained in:
parent
747b6e8d2e
commit
03141d40af
|
@ -82,6 +82,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
||||||
self->sda_pin = sda;
|
self->sda_pin = sda;
|
||||||
self->scl_pin = scl;
|
self->scl_pin = scl;
|
||||||
self->i2c_num = peripherals_i2c_get_free_num();
|
self->i2c_num = peripherals_i2c_get_free_num();
|
||||||
|
self->has_lock = 0;
|
||||||
|
|
||||||
if (self->i2c_num == I2C_NUM_MAX) {
|
if (self->i2c_num == I2C_NUM_MAX) {
|
||||||
mp_raise_ValueError(translate("All I2C peripherals are in use"));
|
mp_raise_ValueError(translate("All I2C peripherals are in use"));
|
||||||
|
|
Loading…
Reference in New Issue