Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
8b0efde9
Commit
8b0efde9
authored
Mar 25, 2024
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/natmod/framebuf: Enable FrameBuffer.poly method.
Signed-off-by:
Damien George
<
damien@micropython.org
>
parent
d2276f0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
examples/natmod/framebuf/framebuf.c
examples/natmod/framebuf/framebuf.c
+6
-4
extmod/modframebuf.c
extmod/modframebuf.c
+3
-4
No files found.
examples/natmod/framebuf/framebuf.c
View file @
8b0efde9
#define MICROPY_PY_ARRAY (1)
#define MICROPY_PY_FRAMEBUF (1)
#include "py/dynruntime.h"
...
...
@@ -12,7 +13,7 @@ mp_obj_full_type_t mp_type_framebuf;
#include "extmod/modframebuf.c"
mp_map_elem_t
framebuf_locals_dict_table
[
1
1
];
mp_map_elem_t
framebuf_locals_dict_table
[
1
2
];
static
MP_DEFINE_CONST_DICT
(
framebuf_locals_dict
,
framebuf_locals_dict_table
);
mp_obj_t
mpy_init
(
mp_obj_fun_bc_t
*
self
,
size_t
n_args
,
size_t
n_kw
,
mp_obj_t
*
args
)
{
...
...
@@ -30,9 +31,10 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
framebuf_locals_dict_table
[
5
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_rect
),
MP_OBJ_FROM_PTR
(
&
framebuf_rect_obj
)
};
framebuf_locals_dict_table
[
6
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_line
),
MP_OBJ_FROM_PTR
(
&
framebuf_line_obj
)
};
framebuf_locals_dict_table
[
7
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_ellipse
),
MP_OBJ_FROM_PTR
(
&
framebuf_ellipse_obj
)
};
framebuf_locals_dict_table
[
8
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_blit
),
MP_OBJ_FROM_PTR
(
&
framebuf_blit_obj
)
};
framebuf_locals_dict_table
[
9
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_scroll
),
MP_OBJ_FROM_PTR
(
&
framebuf_scroll_obj
)
};
framebuf_locals_dict_table
[
10
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_text
),
MP_OBJ_FROM_PTR
(
&
framebuf_text_obj
)
};
framebuf_locals_dict_table
[
8
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_poly
),
MP_OBJ_FROM_PTR
(
&
framebuf_poly_obj
)
};
framebuf_locals_dict_table
[
9
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_blit
),
MP_OBJ_FROM_PTR
(
&
framebuf_blit_obj
)
};
framebuf_locals_dict_table
[
10
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_scroll
),
MP_OBJ_FROM_PTR
(
&
framebuf_scroll_obj
)
};
framebuf_locals_dict_table
[
11
]
=
(
mp_map_elem_t
){
MP_OBJ_NEW_QSTR
(
MP_QSTR_text
),
MP_OBJ_FROM_PTR
(
&
framebuf_text_obj
)
};
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
));
...
...
extmod/modframebuf.c
View file @
8b0efde9
...
...
@@ -577,9 +577,7 @@ static mp_obj_t framebuf_ellipse(size_t n_args, const mp_obj_t *args_in) {
}
static
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
framebuf_ellipse_obj
,
6
,
8
,
framebuf_ellipse
);
#if MICROPY_PY_ARRAY && !MICROPY_ENABLE_DYNRUNTIME
// TODO: poly needs mp_binary_get_size & mp_binary_get_val_array which aren't
// available in dynruntime.h yet.
#if MICROPY_PY_ARRAY
static
mp_int_t
poly_int
(
mp_buffer_info_t
*
bufinfo
,
size_t
index
)
{
return
mp_obj_get_int
(
mp_binary_get_val_array
(
bufinfo
->
typecode
,
bufinfo
->
buf
,
index
));
...
...
@@ -696,7 +694,8 @@ static mp_obj_t framebuf_poly(size_t n_args, const mp_obj_t *args_in) {
return
mp_const_none
;
}
static
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
framebuf_poly_obj
,
5
,
6
,
framebuf_poly
);
#endif // MICROPY_PY_ARRAY && !MICROPY_ENABLE_DYNRUNTIME
#endif // MICROPY_PY_ARRAY
static
mp_obj_t
framebuf_blit
(
size_t
n_args
,
const
mp_obj_t
*
args_in
)
{
mp_obj_framebuf_t
*
self
=
MP_OBJ_TO_PTR
(
args_in
[
0
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment