Looking for some help writing drivers

I have been working on a spinoff of the official MicroPython Binding with 2 goals, The first goal is to make it easier for user to compile and the second was to create a driver framework that has a common API across the different ports and allows for mixing of hardware connection drivers and IC drivers.

I think I have been successful at tacking the first goal. The second goal I am part way there. I have come up with a framework to handle higher level IC drivers things like display IC’s and touch IC’s and those drivers not being dependent on the type of connection they have to an MCU. I have also come up with an API for the “bus” or connection drivers. These drivers are written in C code and are exposed in python using that API. This allows a user to create the connection and pass that connection to an IC driver. The higher level IC drivers are written in Python code which is what makes it really easy for a user to “monkey path” a driver if it needs some tweaking to make it work with their display.

The drivers are written for the ESP32 line of MCU’s and they work. What I need help with is writing the bus drivers for other MCU’s like the STM32 and the RP2040. I do not know enough about the hardware to be able to write the drivers and it would take a long while for me to learn about the hardware to be able to write the drivers properly. If there is anyone out there that has a really good working knowledge of MCU’s other than the ESP32 that are supported ports in MicroPython I really could use some help. I know the MicroPython end of things, you would not need to learn anything about MicroPython as I can write the wrapper code for the drivers to make everything work with MicroPython.

There are some requirements these drivers need to follow. They MUST be written so they can be used at runtime and not at compile time. What I mean by that is all of the functionality available must be compiled into the firmware and the user chooses what they will use when the compiled code is running. For example. I8080 interfaces support up to 16 lanes of IO. if the user only needs to have 8 lanes they should be able to tell the driver that they are only using 8 lanes after the program has started running. It is not chosen when compiling.

The reason why this is important is the ability to change out hardware without needing to recompile the firmware. It allows a user to “hot” swap hardware. It also allows a user to write a single UI that will work across supported MCU’s and even desktop PC’s.

The key thing with Python is it is supposed to be easy to use. Having a different API between drivers and between ports is not something that I would consider to be easy.

I can make it worth while by offering some cash to help with the work.

Here is the code.

This is what the API looks like for the drivers that need to be written…

Here is the code for the binding between Python and C code for the drivers. There is little to no port specific code seen there and that is because the driver front end should be the same across the different ports. Using callback functions is how the different pieces are “registered” to be used.

Here is an example of one of the bus drivers for the ESP32.

If I have to alter the API so they will provide functionality I don’t have an issues with doing that. The key thing is to keep the API identical across all ports so even if things are not used the API will still remain the same.

if you are interested in helping respond to this topic or send me a PM. I will answer any questions you may have.

Thanks again for taking to consider helping out.

–Kevin

I used AI to generate the drivers following your .pyi files. Its just an starting point.
The STM32/RP2040 SPI and I2C lcd drivers probably work with few fixes. The others Im not sure.

micropython_drivers.zip (65.5 KB)