Fix I2CDisplay bus_free to not grab lock

Fixes #2098
This commit is contained in:
Scott Shawcroft 2019-09-03 14:46:47 -07:00
parent b3549980aa
commit b53f169824
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
2 changed files with 4 additions and 2 deletions

View File

@ -90,7 +90,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1);
self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, data, data_size);
}
self->core.end_transaction(self->core.bus);
displayio_display_core_end_transaction(&self->core);
uint16_t delay_length_ms = 10;
if (delay) {
data_size++;

View File

@ -91,11 +91,13 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) {
if (!common_hal_busio_i2c_try_lock(self->bus)) {
return false;
}
common_hal_busio_i2c_unlock(self->bus);
return true;
}
bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) {
return common_hal_displayio_i2cdisplay_bus_free(obj);
displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj);
return !common_hal_busio_i2c_try_lock(self->bus);
}
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) {