CircuitPython on Linux & Orange Pi
The next obvious step is to bring CircuitPython back to 'desktop Python'. We've got tons of projects, libraries and example code for CircuitPython on microcontrollers, and thanks to the flexibility and power of Python its pretty easy to get it working with micro-computers like Orange Pi or other 'Linux with GPIO pins available' single board computers.
We'll use a special library called adafruit_blinka (named after Blinka, the CircuitPython mascot) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. For example, on Orange Pi we use the python libgpiod bindings. For any I2C interfacing we'll use ioctl messages to the /dev/i2c
device. For SPI we'll use the spidev
python library, etc. These details don't matter so much because they all happen underneath the adafruit_blinka layer.
The upshot is that any code we have for CircuitPython will be instantly and easily runnable on Linux computers like Orange Pi.
In particular, we'll be able to use all of our device drivers - the sensors, led controllers, motor drivers, HATs, bonnets, etc. And nearly all of these use I2C or SPI!
Wait, isn't there already something that does this - WiringOP?
WiringOP, a modification of WiringPi, is for GPIO usage only, it doesn't work well for various I2C or SPI devices.
By letting you use CircuitPython on Raspberry Pi via adafruit_blinka, you can unlock all of the drivers and example code we wrote! And you can keep using WiringOP for pins, buttons and LEDs. We save time and effort so we can focus on getting code that works in one place, and you get to reuse all the code we've written already.
What about other Linux SBCs or other Orange Pi's?
Yep! Blinka can easily be updated to add other boards. We've started with the one we've got, so we could test it thoroughly. If you have an OrangePi or other SBC board you'd like to adapt check out the adafruit_blinka code on github, pull requests are welcome as there's a ton of different Linux boards out there!
Page last edited March 08, 2024
Text editor powered by tinymce.