add support for micropython on RP2040 boards
what it do
- adds a build script
micropython/tools/qwiic-mpy/gen.pywhich can be used to generate and update bytecode (.mpy) files for micropython from the Qwiic_Py sources. - modifies
.gitignoreso that.mpyfiles are ignored except within themicropython/distdirectory, so that users can access pre-compiled files - adds
micropython/README.mdwhich explains the basics of how to use everything
dependencies add micropython RP2040 i2c driver - this is necessary b/c it contains the i2c driver for micropython/rp2040
status ✅ build script ✅ module compatibility with filesystem ✅ i2c driver seems to work ✅ device driver testing satisfactory ⚠️ additional boards can be added (non-blocking)
p.s. i have not included the pre-compiled binaries in the PR yet in case they change during testing. as a reviewer you will need to generate them yourself. fortunately it is as easy as:
- make sure you have
micropythonand have built mpy-crosscd raspberrypi/micropython/mpy-cross && make
- run the generate script from the
Qwiic_Pyroot directory and provide the-mflag to tell it where to find thempy-cross executable./micropython/tools/qwiic-mpy/gen.py -m ~/raspberrypi/micropython/mpy-cross/mpy-cross
p.s.s. perhaps this script could make a good candidate for continuous integration
latest pushes run on the rp2040, however there seems to be an issue with block reads that causes only zero to be read back. more information is needed at this time
addressing comments:
- moved "supported platforms" to the end of README so bytecode explanation comes sooner
- added clarification for rshell command usage
- added step to upload
boardfiles - added README about board files in
src/boards - vestigial file
micropythong/src/qwiic_i2c/init.pyremoved (was holdover from previous issues) - comments added to trickier bits of
mpygen.py
re: github actions
- yes i think the mpygen.py script would be a good candidate to automate with ci. the generate-variants script from the Apollo3_Arduino repo shows one way to do this (though it is not necessarily the best way or even a good way for all i know)
note: at the moment i am unable to add demo output to the README - i am away from my test hw. i will get back to this as soon as i can however it should be possible for others to modify this PR so anyone else may add it if they have demo output handy
Jumping in here with a question, as I’m working with MicroPython on ESP32. The board I have here has a Qwiic connector, would this PR be a starting point for having that supported in MP? / any progress on having this merged in general?