From c3136f4f32df28cc29596fc9ba76dcc0bfd533f0 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 6 Apr 2019 14:02:18 +0200 Subject: Enable displayio for uGame10 board Also, make the _stage library work with the fourwire bus, to re-use the display. --- shared-bindings/_stage/__init__.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'shared-bindings') diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 24a359664..95cbda846 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -28,6 +28,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" #include "shared-module/_stage/__init__.h" #include "Layer.h" #include "Text.h" @@ -85,12 +86,18 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { uint16_t *buffer = bufinfo.buf; size_t buffer_size = bufinfo.len / 2; // 16-bit indexing - busio_spi_obj_t *spi = MP_OBJ_TO_PTR(args[6]); + displayio_fourwire_obj_t *bus = MP_OBJ_TO_PTR(args[6]); + while (!common_hal_displayio_fourwire_begin_transaction(bus)) { +#ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP ; +#endif + } if (!render_stage(x0, y0, x1, y1, layers, layers_size, - buffer, buffer_size, spi)) { + buffer, buffer_size, bus->bus)) { mp_raise_OSError(MP_EIO); } + common_hal_displayio_fourwire_end_transaction(bus); return mp_const_none; } -- cgit v1.2.3