We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 87d97ae + 5472f41 commit a39f0cfCopy full SHA for a39f0cf
shared-module/bitbangio/I2C.c
@@ -49,9 +49,11 @@ STATIC void scl_release(bitbangio_i2c_obj_t *self) {
49
uint32_t count = self->us_timeout;
50
delay(self);
51
// For clock stretching, wait for the SCL pin to be released, with timeout.
52
+ common_hal_digitalio_digitalinout_switch_to_input(&self->scl, PULL_UP);
53
for (; !common_hal_digitalio_digitalinout_get_value(&self->scl) && count; --count) {
54
common_hal_mcu_delay_us(1);
55
}
56
+ common_hal_digitalio_digitalinout_switch_to_output(&self->scl, true, DRIVE_MODE_OPEN_DRAIN);
57
// raise exception on timeout
58
if (count == 0) {
59
mp_raise_msg(&mp_type_TimeoutError, translate("Clock stretch too long"));
0 commit comments