Because `mp_tracked_calloc` does not survive a soft reset but the memory region will, resulting in half-initialised frankenclasses that behave unpredictably.
Using the class pattern fixes this since it's always guaranteed to be initialised when a user instantiates it, and __del__ can handle cleanup.
MicroPython has changed MP_REGISTER_MODULE to use only *two* args and now runs the preprocessing stage on files before running makemoduledefs.py.
This change avoids the build exploding, since the new regex matches the last two args as a single argument and generates a malformed module defs include.
The pattern here exploits the fact that 1.18 and below do not preprocess files, so *both* MP_REGISTER_MODULE lines are included in the source, but *only* the three arg version is matched by regex.
In >1.18 the files will be processed and the three arg version removed before makemoduledefs.py processes it.
This change appends the list dir and project root dir to CMAKE_MODULE_PATH so that it doesn't need prepended to each "include" directive.
All .mk files have been deleted, since these are completely redundant.
This change removes file-relative include paths and adds the project root as a global include path.
* Project root added to CMakeLists.txt so that all targets can find includes
* Project root added micropython.cmake so that targets used by the MicroPython build can find includes
Note: pico-boilerplate projects must set this include path
Using release 0.1.1 of pimoroni-pico-micropython, the picokeypad.clear() function does not seem to work. Looking through the code, it appears that clear is actually calling init instead.
The ../../../pimoroni-pico path was selecting the "pimoroni-pico" directory adjacent my "micropython" directory
However I was attempting to build against one in a different parent directory.
This resulted in the MicroPython modules including the wrong (old) header and exploding.
The upstream MicroPython rp2 port has re-enabled -Werror so we need to either fix warnings or,
in the case of those generated by C++/C MicroPython binding weirdness, suppress them.
Only *one* usermod directory can be specified, so the build command becomes something like:
make USER_C_MODULES=/path/to/pimoroni-pico/micropython/modules/
The `usermod.cmake` in the "modules" dir will then include all of the modules. Comment lines our here to disable them.
No need to configure anythign in `mpconfigport.h` since the defines are set by the `usermod.cmake` files.