Python Library for AML-S905X-CC

Can we get an ‘RPi.GPIO’ python lib for this SBC? love the hardware… less in love with the tools…

Our boards use the industry standard gpiod. RPi.GPIO is an obsolete poorly designed library that won’t even be supported by Pi 5 since it makes too many assumptions to be portable. We have the lgpio tool to do looking of chip and line numbers relative to header and pin. See libretech-wiring-tool. It basically reads a CSV text GPIO mapping file aptly named If you want to create a library, we would recommend that you search for the board name based on DMI and just load the entries in a simple lookup table and use that to map header/pin combinations to chip/line combinations for libgpiod. libgpiod has an official existing python library.

1 Like

Great! commit that to the specs section of the boards documentation…

$ cat /proc/device-tree/smbios/smbios/system/manufacturer
$ cat /proc/device-tree/smbios/smbios/system/product
$ cat /opt/librecomputer/libretech-wiring-tool/libre-computer/aml-s905x-cc/

You should load the file based on the DMI path and the header name is column 1, the pin is column 2, the libgpiod chip and line are columns 3 and 4 respectively. That should be all you need to implement a GPIO library. The first header in the file is always the 40-pin GPIO header if the board has that.

you can use python with adafruit’s blinka, i got it working and even got a 32x8 MAX7291 to work, blinka basically allows you to use circut python libraries on sbc’s, and the le potato is supported, it relies on libgpiod.

use thonny and you have run it with root access by running “sudo thonny” in terminal and then it will run with root.

the pins in the main 40 pin header are called “board.P[PIN]” so if you want to use pin 22 in your code, you call it (board.P22), but for other headers its (board.[HEADER][PIN]) so pin 5 in the 2J3 header is (board.2J25)

usefull links:

if you are stuck, im ready to help!

1 Like