Use displayio.Display directly · MicroPythonNexus/circuitpython@d39e7e7 · GitHub
Skip to content

Commit d39e7e7

Browse files
committed
Use displayio.Display directly
1 parent dabbded commit d39e7e7

5 files changed

Lines changed: 20 additions & 28 deletions

File tree

shared-bindings/_stage/__init__.c

Lines changed: 11 additions & 13 deletions

shared-module/_stage/__init__.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include "shared-bindings/_stage/Text.h"
3232

3333

34-
bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
34+
void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
3535
mp_obj_t *layers, size_t layers_size,
3636
uint16_t *buffer, size_t buffer_size,
37-
busio_spi_obj_t *spi) {
37+
displayio_display_obj_t *display) {
3838

3939
size_t index = 0;
4040
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,
5555
index += 1;
5656
// The buffer is full, send it.
5757
if (index >= buffer_size) {
58-
if (!common_hal_busio_spi_write(spi,
59-
((uint8_t*)buffer), buffer_size * 2)) {
60-
return false;
61-
}
58+
display->send(display->bus, false, ((uint8_t*)buffer), buffer_size * 2);
6259
index = 0;
6360
}
6461
}
6562
}
6663
// Send the remaining data.
6764
if (index) {
68-
if (!common_hal_busio_spi_write(spi, ((uint8_t*)buffer), index * 2)) {
69-
return false;
70-
}
65+
display->send(display->bus, false, ((uint8_t*)buffer), index * 2);
7166
}
72-
return true;
7367
}

shared-module/_stage/__init__.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
#ifndef MICROPY_INCLUDED_SHARED_MODULE__STAGE_H
2828
#define MICROPY_INCLUDED_SHARED_MODULE__STAGE_H
2929

30-
#include "shared-bindings/busio/SPI.h"
30+
#include "shared-bindings/displayio/Display.h"
3131
#include <stdint.h>
3232
#include <stdbool.h>
3333
#include "py/obj.h"
3434

3535
#define TRANSPARENT (0x1ff8)
3636

37-
bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
37+
void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
3838
mp_obj_t *layers, size_t layers_size,
3939
uint16_t *buffer, size_t buffer_size,
40-
busio_spi_obj_t *spi);
40+
displayio_display_obj_t *display);
4141

4242
#endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE

supervisor/supervisor.mk

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)