Skip to content

Commit 3a65ff9

Browse files
committed
Allow use of displayio.Display subclasses in _stage
1 parent 608bf50 commit 3a65ff9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

shared-bindings/_stage/__init__.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
8383
uint16_t *buffer = bufinfo.buf;
8484
size_t buffer_size = bufinfo.len / 2; // 16-bit indexing
8585

86-
if (!MP_OBJ_IS_TYPE(args[6], &displayio_display_type)) {
86+
mp_obj_t native_display = mp_instance_cast_to_native_base(args[6],
87+
&displayio_display_type);
88+
if (!MP_OBJ_IS_TYPE(native_display, &displayio_display_type)) {
8789
mp_raise_TypeError(translate("argument num/types mismatch"));
8890
}
89-
displayio_display_obj_t *display = MP_OBJ_TO_PTR(args[6]);
91+
displayio_display_obj_t *display = MP_OBJ_TO_PTR(native_display);
9092

9193
while (!displayio_display_begin_transaction(display)) {
9294
#ifdef MICROPY_VM_HOOK_LOOP

0 commit comments

Comments
 (0)