summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-10-04 22:42:12 +1100
committerDamien George <damien@micropython.org>2023-10-16 12:18:43 +1100
commit8eb7721b4aa838608d6e3b28b96992e3d2db42b4 (patch)
tree02a95ddc7d6d8ba056e13738c30eebae5860f730
parent03a9fa227d323da7b239a1ef3fa84b0ef45a1621 (diff)
extmod/modframebuf: Remove FrameBuffer1 from natmod build.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
-rw-r--r--examples/natmod/framebuf/framebuf.c1
-rw-r--r--extmod/modframebuf.c2
-rw-r--r--tests/extmod/framebuf1.py5
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c
index 32b67eabc..badc7ab46 100644
--- a/examples/natmod/framebuf/framebuf.c
+++ b/examples/natmod/framebuf/framebuf.c
@@ -36,7 +36,6 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
MP_OBJ_TYPE_SET_SLOT(&mp_type_framebuf, locals_dict, (void*)&framebuf_locals_dict, 2);
mp_store_global(MP_QSTR_FrameBuffer, MP_OBJ_FROM_PTR(&mp_type_framebuf));
- mp_store_global(MP_QSTR_FrameBuffer1, MP_OBJ_FROM_PTR(&legacy_framebuffer1_obj));
mp_store_global(MP_QSTR_MVLSB, MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB));
mp_store_global(MP_QSTR_MONO_VLSB, MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB));
mp_store_global(MP_QSTR_RGB565, MP_OBJ_NEW_SMALL_INT(FRAMEBUF_RGB565));
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index c62ac4fe3..92313bd4b 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -864,6 +864,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif
+#if !MICROPY_ENABLE_DYNRUNTIME
// This factory function is provided for backwards compatibility with the old
// FrameBuffer1 class which did not support a format argument.
STATIC mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args_in) {
@@ -872,7 +873,6 @@ STATIC mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(legacy_framebuffer1_obj, 3, 4, legacy_framebuffer1);
-#if !MICROPY_ENABLE_DYNRUNTIME
STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_framebuf) },
{ MP_ROM_QSTR(MP_QSTR_FrameBuffer), MP_ROM_PTR(&mp_type_framebuf) },
diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py
index b1173d536..f5e92579f 100644
--- a/tests/extmod/framebuf1.py
+++ b/tests/extmod/framebuf1.py
@@ -106,8 +106,9 @@ except ValueError:
print("ValueError")
# test legacy constructor
-fbuf = framebuf.FrameBuffer1(buf, w, h)
-fbuf = framebuf.FrameBuffer1(buf, w, h, w)
+if hasattr(framebuf, "FrameBuffer1"):
+ fbuf = framebuf.FrameBuffer1(buf, w, h)
+ fbuf = framebuf.FrameBuffer1(buf, w, h, w)
print(framebuf.MVLSB == framebuf.MONO_VLSB)
# test get-buffer (returns the original buffer)