RPi Pico port (#42)
based on work of @jgpeiro https://forum.lvgl.io/t/build-lvgl-for-raspberry-pi-pico/5543 . * add brief documentation on building the port Related PR: https://github.com/lvgl/lv_binding_micropython/pull/174
This commit is contained in:
parent
e71a9729cc
commit
7eb31fc924
@ -58,6 +58,15 @@ For more details please refer to [Micropython ESP32 README](https://github.com/m
|
||||
|
||||
Refer to the README of the `lvgl_javascript` branch: https://github.com/lvgl/lv_micropython/tree/lvgl_javascript#for-javascript-port
|
||||
|
||||
### For Raspberry Pi Pico port
|
||||
|
||||
This port uses [Micropython infrastructure for C modules](https://docs.micropython.org/en/latest/develop/cmodules.html#compiling-the-cmodule-into-micropython) and `USER_C_MODULES` must be given:
|
||||
|
||||
```
|
||||
cd ports/rp2
|
||||
make USER_C_MODULES=../../lv_bindings/bindings.cmake
|
||||
```
|
||||
|
||||
## Super Simple Example
|
||||
|
||||
First, LVGL needs to be imported and initialized
|
||||
|
||||
@ -33,6 +33,9 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#define MICROPY_PY_LVGL (1)
|
||||
#define MICROPY_PY_LODEPNG (1)
|
||||
|
||||
// Board and hardware specific configuration
|
||||
#define MICROPY_HW_MCU_NAME "RP2040"
|
||||
#define MICROPY_HW_ENABLE_UART_REPL (0) // useful if there is no USB
|
||||
@ -162,6 +165,22 @@ extern const struct _mp_obj_module_t mp_module_onewire;
|
||||
extern const struct _mp_obj_module_t mp_module_rp2;
|
||||
extern const struct _mp_obj_module_t mp_module_uos;
|
||||
extern const struct _mp_obj_module_t mp_module_utime;
|
||||
extern const struct _mp_obj_module_t mp_module_lvgl;
|
||||
extern const struct _mp_obj_module_t mp_module_lodepng;
|
||||
|
||||
#if MICROPY_PY_LVGL
|
||||
#define MICROPY_PORT_LVGL_DEF \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_lvgl), (mp_obj_t)&mp_module_lvgl },
|
||||
|
||||
#else
|
||||
#define MICROPY_PORT_LVGL_DEF
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_LODEPNG
|
||||
#define MICROPY_PORT_LODEPNG_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_lodepng), (mp_obj_t)&mp_module_lodepng },
|
||||
#else
|
||||
#define MICROPY_PORT_LODEPNG_DEF
|
||||
#endif
|
||||
|
||||
#define MICROPY_PORT_BUILTIN_MODULES \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
|
||||
@ -169,8 +188,24 @@ extern const struct _mp_obj_module_t mp_module_utime;
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR__rp2), (mp_obj_t)&mp_module_rp2 }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
|
||||
MICROPY_PORT_LVGL_DEF \
|
||||
MICROPY_PORT_LODEPNG_DEF \
|
||||
|
||||
#if MICROPY_PY_LVGL
|
||||
#ifndef MICROPY_INCLUDED_PY_MPSTATE_H
|
||||
#define MICROPY_INCLUDED_PY_MPSTATE_H
|
||||
#include "lib/lv_bindings/lvgl/src/misc/lv_gc.h"
|
||||
#undef MICROPY_INCLUDED_PY_MPSTATE_H
|
||||
#else
|
||||
#include "lib/lv_bindings/lvgl/src/misc/lv_gc.h"
|
||||
#endif
|
||||
#else
|
||||
#define LV_ROOTS
|
||||
#endif
|
||||
|
||||
#define MICROPY_PORT_ROOT_POINTERS \
|
||||
LV_ROOTS \
|
||||
void *mp_lv_user_data; \
|
||||
const char *readline_hist[8]; \
|
||||
void *machine_pin_irq_obj[30]; \
|
||||
void *rp2_pio_irq_obj[2]; \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user