golemparts / rppal

A Rust library that provides access to the Raspberry Pi's GPIO, I2C, PWM, SPI and UART peripherals.
MIT License
1.24k stars 98 forks source link

Banana Pi M5 support #128

Closed Chris2m closed 1 year ago

Chris2m commented 1 year ago

What would it take to make the library compatible with the Banana Pi M5? Looking for the GPIO functionality specifically. I understand I would likely have to implement the DeviceInfo. Willing to contribute but need pointers.

golemparts commented 1 year ago

Unfortunately the GPIO functionality would probably be incompatible. RPPAL accesses the GPIO registers on the Raspberry Pi directly through /dev/gpiomem. Considering the Banana Pi M5 uses a different SoC, it's possible they copied the same register layout for compatibility reasons, but unlikely.

First thing I'd check is if a /dev/gpiomem device even exists. If it does, comparing any technical documentation specific to the GPIO would be a good second step.

At some point we'll likely move away from using /dev/gpiomem in favor of /dev/gpiochip which would make it easier to support other SBCs. If I remember correctly, last time I dove into gpiochip, there were some issues that prevented me from completely switching over. I'll have to recheck those. Adding compatibility for the Banana Pi M5 would definitely be a lot easier after that switch.

Chris2m commented 1 year ago

Thanks for getting to me so swiftly. I checked and both a /dev/gpiomem and also /dev/gpiochip0 device exist. Given you're planning to move away from gpiomemat some point, it sounds like it does not make sense to put effort until after that change has been made.