Skip to content

Commit daaeb67

Browse files
committed
zephyr: Introduce Zephyr displays as framebuf.
Allows using zephyr displays as framebuf. Signed-off-by: Vdragon <mail@massdriver.space>
1 parent b7cfafc commit daaeb67

File tree

5 files changed

+440
-2
lines changed

5 files changed

+440
-2
lines changed

extmod/modframebuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct _mp_obj_framebuf_t {
4343
} mp_obj_framebuf_t;
4444

4545
#if !MICROPY_ENABLE_DYNRUNTIME
46-
static const mp_obj_type_t mp_type_framebuf;
46+
const mp_obj_type_t mp_type_framebuf;
4747
#endif
4848

4949
typedef void (*setpixel_t)(const mp_obj_framebuf_t *, unsigned int, unsigned int, uint32_t);
@@ -883,7 +883,7 @@ static const mp_rom_map_elem_t framebuf_locals_dict_table[] = {
883883
};
884884
static MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
885885

886-
static MP_DEFINE_CONST_OBJ_TYPE(
886+
MP_DEFINE_CONST_OBJ_TYPE(
887887
mp_type_framebuf,
888888
MP_QSTR_FrameBuffer,
889889
MP_TYPE_FLAG_NONE,

ports/zephyr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ set(MICROPY_SOURCE_PORT
5454
uart_core.c
5555
zephyr_device.c
5656
zephyr_storage.c
57+
zephyr_display.c
5758
mpthreadport.c
5859
)
5960
list(TRANSFORM MICROPY_SOURCE_PORT PREPEND ${MICROPY_PORT_DIR}/)

ports/zephyr/modzephyr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ static const mp_rom_map_elem_t mp_module_time_globals_table[] = {
8686
#ifdef CONFIG_FLASH_MAP
8787
{ MP_ROM_QSTR(MP_QSTR_FlashArea), MP_ROM_PTR(&zephyr_flash_area_type) },
8888
#endif
89+
#if defined(CONFIG_DISPLAY) && defined(MICROPY_PY_FRAMEBUF)
90+
{ MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&zephyr_display_type) },
91+
#endif
8992
};
9093

9194
static MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);

ports/zephyr/modzephyr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ extern const mp_obj_type_t zephyr_disk_access_type;
3737
extern const mp_obj_type_t zephyr_flash_area_type;
3838
#endif
3939

40+
#ifdef CONFIG_DISPLAY
41+
extern const mp_obj_type_t zephyr_display_type;
42+
#endif
43+
4044
#endif // MICROPY_INCLUDED_ZEPHYR_MODZEPHYR_H

0 commit comments

Comments
 (0)