CircuitPython Libraries on Linux & 96Boards DragonBoard
The next obvious step is to bring CircuitPython ease of use 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 microcomputers like the DragonBoard 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 the DragonBoard we use the python libgpiod bindings. For any I2C interfacing we'll use ioctl messages to the /dev/i2c
device. 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 the DragonBoard.
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 - libgpiod?
libgpiod is a python hardware interface class that works on the DragonBoard. It works just fine for I2C, SPI and GPIO but doesn't work with our drivers as it's a different API
By letting you use CircuitPython libraries on the DragonBoard via adafruit_blinka, you can unlock all of the drivers and example code we wrote! And you can keep using libgpiod if you like. 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?
Yep! Blinka can easily be updated to add other boards. We've started with the ones we've got, so we could test them thoroughly. If you have 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.