I am going to make a subclass of framebuf class in my C user module.
I think it is possible by pointing `mp_type_framebuf` from `parent` of my class, but it fails to build because `mp_type_framebuf` is declared as `STATIC.`
Code: Select all
include "py/runtime.h"
extern mp_obj_type_t mp_type_framebuf;
STATIC const mp_rom_map_elem_t rp2x_vgafb_locals_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(rp2x_vgafb_locals, rp2x_vgafb_locals_table);
const mp_obj_type_t rp2x_vgafb_type = {
{ &mp_type_type },
.name = MP_QSTR_VGAfb,
.locals_dict = (mp_obj_t)&rp2x_vgafb_locals,
.parent = &mp_type_framebuf,
};
Code: Select all
STATIC const mp_obj_type_t mp_type_framebuf = {
{ &mp_type_type },
.name = MP_QSTR_FrameBuffer,
.make_new = framebuf_make_new,
.buffer_p = { .get_buffer = framebuf_get_buffer },
.locals_dict = (mp_obj_dict_t *)&framebuf_locals_dict,
};
However, I wonder why `mp_type_framebuf` is declared as STATIC.
Any thoughts?