diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-03-06 13:45:48 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-03-06 13:45:48 -0500 |
| commit | c854f6617a0b343333635fe0cc91419daff7cdd5 (patch) | |
| tree | e784d33bdf651927f5ea71029327ce966ae83c49 /shared-bindings | |
| parent | 2eaa98ad7103ea4a03fc10fbcee7d2ec7a045a70 (diff) | |
check display-bus transaction status and act accordingly
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/displayio/Display.h | 2 | ||||
| -rw-r--r-- | shared-bindings/displayio/FourWire.c | 7 | ||||
| -rw-r--r-- | shared-bindings/displayio/ParallelBus.c | 7 |
3 files changed, 13 insertions, 3 deletions
diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index ee9106f77..8c9e7fc13 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -48,7 +48,7 @@ void common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_ void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self); -void displayio_display_start_region_update(displayio_display_obj_t* self, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); +bool displayio_display_start_region_update(displayio_display_obj_t* self, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); void displayio_display_finish_region_update(displayio_display_obj_t* self); bool displayio_display_frame_queued(displayio_display_obj_t* self); diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 56baa534b..70cd42747 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -110,7 +110,12 @@ STATIC mp_obj_t displayio_fourwire_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_buffer_info_t bufinfo; mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ); - common_hal_displayio_fourwire_begin_transaction(self); + // Wait for display bus to be available. + while (!common_hal_displayio_fourwire_begin_transaction(self)) { +#ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP ; +#endif + } common_hal_displayio_fourwire_send(self, true, &command, 1); common_hal_displayio_fourwire_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_fourwire_end_transaction(self); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index a54a84471..6a499ed06 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -114,7 +114,12 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o mp_buffer_info_t bufinfo; mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ); - common_hal_displayio_parallelbus_begin_transaction(self); + // Wait for display bus to be available. + while (!common_hal_displayio_parallelbus_begin_transaction(self)) { +#ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP ; +#endif + } common_hal_displayio_parallelbus_send(self, true, &command, 1); common_hal_displayio_parallelbus_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_parallelbus_end_transaction(self); |
