Using Breakout Modules in CircuitPython

I’m building a macro keypad using the Keybow 2040, RGB Encoder and round LCD. My plan is to use the Keybow CircuitPython binary and ideally the MicroPython modules in the Pimoroni Pico image.

I’m not sure of the best way to go about this. Should I attempt to make a custom image which includes the relevant Pimoroni modules or should I try and build the C source code as mpy files and include them in my CircuitPython lib folder?

You need to decide between MicroPython (the modules you find in the Pimoroni repo) and CircuitPython. Since the KeyBow is CircuitPython based, I would not bother with the modules from Pimoroni. Porting them from MP to CP is usually simple, but in most cases not necessary. CP has 400+ libraries, all of them are extremely easy to install.

The C-source does not build as mpy - these files are precompiled .py files. You can build your own version of CircuitPython though (very simple thanks to Github codespaces), but again this is not really necessary since you can probably just use the existing libs for your breakout modules.

What he said. The Pimoroni Micro Python libraries etc, won’t work in Adafruits Circuit Python. I have had some luck using Adafruit code on Pimoorni breakouts. i2c stuff like BME breakouts. Haven’t ried to adapt any SPI stuff just yet. My only Circuit Python device is my RGB Keypad, which is the enconomy version of the keybow.
Have you seen this?
Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED [ADABOX019 Essentials] : ID 5128 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Thanks both, that’s been really helpful. I found a CircuitPython driver for the ST7789 display that the round LCD uses and managed to get some images displaying on the LCD using the displayio and busio modules. There’s a couple of helpful examples for Pimoroni displays, see below.

Simple test — Adafruit ST7789 Library 1.0 documentation (circuitpython.org)

Pretty confident I can get the encoder running using the I2C drivers in the CircuitPython modules.

I had a look at the Adafruit Macropad but decided I wanted something a bit more bespoke to try and challenge myself!

I have a few “I did it my way” builds kicking around. Same thing but slightly different from the original offering.

The macro pad code may be worth looking at. Might save you some time?

When your are already into CP, take a look at circup. Library installation is really very simple with this tool. It analyses your code and automagically installs all necessary driver modules. So you would e.g. copy some sample code from somewhere in the web, run circup and your ready to go.

1 Like

Circup looks great, thanks for that. Think that will be useful for the encoder side of things.

@alphanumeric I’ve got all the parts already, so mostly looking to fit the software around that. That’s okay though, I was looking for a bit of a challenge!