Fix cardputer boot loop, and do some cleanup. · MicroPythonNexus/circuitpython@de2efe0 · GitHub
Skip to content

Commit de2efe0

Browse files
committed
Fix cardputer boot loop, and do some cleanup.
- For `cardputer_keyboard.c`, allocate `DemuxKeyMatrix` it creates and the objects it holds (all the way down) on the port heap, because it lives past VM's. - To do the above, add support for non-VM heap for `DemuxKeyMatrix` and the `keypad` allocations it needs by passing an arg `use_gc_allocator`, as is done in `lvfontio`. - Add `mp_obj_port_malloc()`, `mp_obj_port_malloc_var()`, `mp_obj_new_port_tuple()`, all of which allocate on the port heap, not the VM heap. - Add `port_malloc_zero()`, because `port_malloc()` did not zero out its allocation, unlike VM heap allocations. I got caught by this. - Move `port_gc_collect()` from `main.c` to `supervisor/port.c` for consistency. This function is not actually used by anyone, but I was considering using it. - Add an `MP_WEAK` `mp_board_init()`, for board-specific initializations needed when a VM starts. Also considered, but not used. Added anyway for possible future use. - Add an `MP_WEAK` `board_gc_collect()`, for board-specific gc. Not used. - Add an `MP_WEAK` `port_gc_collect()`, for port-specific gc. Not used. - Don't duplicate keyboard code between `boards/m5stack_cardputer` and `boards/m5stack_cardputer_ros`. Instead, add a `ports/espressif/module` directory for this code, in the style of a port-specific `module` directory, like the port-specific `bindings` directories.
1 parent 0707e28 commit de2efe0

23 files changed

Lines changed: 140 additions & 509 deletions

File tree

main.c

Lines changed: 4 additions & 4 deletions

ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion

ports/espressif/boards/m5stack_cardputer_ros/cardputer_keyboard.c

Lines changed: 0 additions & 238 deletions
This file was deleted.

0 commit comments

Comments
 (0)