diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-04-12 13:26:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-12 13:26:51 -0700 |
| commit | c064deaaf5a80dab681027aaf09e058a760dbf01 (patch) | |
| tree | e9545075de2c3dda5e2f640a72bdb7380655cf06 /shared-module/_stage | |
| parent | 22ca98501bb90f6878e9002bcee0f85542479af6 (diff) | |
| parent | 7aab3e8c9394ad8f07d101b426d13ec59c36c01c (diff) | |
Merge pull request #1785 from pewpew-game/ugame-displayio
Enable displayio for the ugame10 board
Diffstat (limited to 'shared-module/_stage')
| -rw-r--r-- | shared-module/_stage/__init__.c | 14 | ||||
| -rw-r--r-- | shared-module/_stage/__init__.h | 6 |
2 files changed, 7 insertions, 13 deletions
diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index 86f5ee795..1af279e92 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -31,10 +31,10 @@ #include "shared-bindings/_stage/Text.h" -bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, +void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - busio_spi_obj_t *spi) { + displayio_display_obj_t *display) { size_t index = 0; for (uint16_t y = y0; y < y1; ++y) { @@ -55,19 +55,13 @@ bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, index += 1; // The buffer is full, send it. if (index >= buffer_size) { - if (!common_hal_busio_spi_write(spi, - ((uint8_t*)buffer), buffer_size * 2)) { - return false; - } + display->send(display->bus, false, ((uint8_t*)buffer), buffer_size * 2); index = 0; } } } // Send the remaining data. if (index) { - if (!common_hal_busio_spi_write(spi, ((uint8_t*)buffer), index * 2)) { - return false; - } + display->send(display->bus, false, ((uint8_t*)buffer), index * 2); } - return true; } diff --git a/shared-module/_stage/__init__.h b/shared-module/_stage/__init__.h index d56a26940..d263302b4 100644 --- a/shared-module/_stage/__init__.h +++ b/shared-module/_stage/__init__.h @@ -27,16 +27,16 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE__STAGE_H #define MICROPY_INCLUDED_SHARED_MODULE__STAGE_H -#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/Display.h" #include <stdint.h> #include <stdbool.h> #include "py/obj.h" #define TRANSPARENT (0x1ff8) -bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, +void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - busio_spi_obj_t *spi); + displayio_display_obj_t *display); #endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE |
