Skip to content

Commit e92b5f7

Browse files
authored
Merge pull request adafruit#2111 from tannewt/fix_ssd1306_hang
Fix I2CDisplay bus_free to not grab lock
2 parents b354998 + b53f169 commit e92b5f7

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

shared-module/displayio/Display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
9090
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1);
9191
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, data, data_size);
9292
}
93-
self->core.end_transaction(self->core.bus);
93+
displayio_display_core_end_transaction(&self->core);
9494
uint16_t delay_length_ms = 10;
9595
if (delay) {
9696
data_size++;

shared-module/displayio/I2CDisplay.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) {
9191
if (!common_hal_busio_i2c_try_lock(self->bus)) {
9292
return false;
9393
}
94+
common_hal_busio_i2c_unlock(self->bus);
9495
return true;
9596
}
9697

9798
bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) {
98-
return common_hal_displayio_i2cdisplay_bus_free(obj);
99+
displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj);
100+
return !common_hal_busio_i2c_try_lock(self->bus);
99101
}
100102

101103
void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) {

0 commit comments

Comments
 (0)