|
| 1 | +## Spike Outcomes |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +**Title:** Extending SplashKit Library to Support Raspberry Pi 5 and Generic Linux SBCs |
| 6 | + |
| 7 | +**Author:** Jonathan Tynan |
| 8 | + |
| 9 | +## Goals / Deliverables |
| 10 | + |
| 11 | +- This report documenting findings and recommendations. |
| 12 | + |
| 13 | +## Tasks undertaken |
| 14 | + |
| 15 | +- Confirming that pigpio does not support Raspberry Pi 5. |
| 16 | +- Develop overview of major projects that fit our requirements. |
| 17 | +- Explored gpiod/libgpiod for GPIO control on Raspberry Pi 5. |
| 18 | +- Investigated lgpio/rgpio for remote GPIO operations and PWM support. |
| 19 | +- Evaluating the availability and suitability of C/C++ bindings for each library. |
| 20 | + |
| 21 | +## What we found out |
| 22 | + |
| 23 | +Through this spike, we explored various libraries and interfaces for GPIO and PWM control across Raspberry Pi 5 and generic Linux SBCs. Below are our detailed findings: |
| 24 | + |
| 25 | +### [WiringPi](https://github.com/WiringPi/WiringPi/) |
| 26 | + |
| 27 | +- Pros: |
| 28 | + - Supports both GPIO and PWM operations on Raspberry Pi models, including the Raspberry Pi 5. |
| 29 | + - Offers a simple interface well-suited to SplashKit's existing structure, facilitating straightforward integration. |
| 30 | + - Community-driven forks are still maintained, providing ongoing updates. |
| 31 | +- Cons: |
| 32 | + - Lacks support for remote GPIO operations, a crucial feature for SplashKit. |
| 33 | + - Since the original project was deprecated, relying on community-maintained forks raises concerns about long-term support and stability. |
| 34 | + - May not be a reliable choice for future development due to potential abandonment. |
| 35 | + |
| 36 | +### [lgpio/rgpio](https://github.com/joan2937/lg) |
| 37 | + |
| 38 | +- Pros: |
| 39 | + - Developed by the same creator as pigpio, offering a familiar interface and functionality. |
| 40 | + - Supports remote GPIO operations out-of-the-box, aligning with SplashKit's requirements. |
| 41 | + - Provides basic PWM functionality. |
| 42 | + - Compatible with the Raspberry Pi 5 and a range of Linux SBCs beyond Raspberry Pi. |
| 43 | + - Has C/C++ bindings suitable for our project. |
| 44 | +- Cons: |
| 45 | + - Being a newer project, it lacks the maturity and extensive community support of pigpio. |
| 46 | + - Potential risks in terms of long-term support and unanticipated bugs. |
| 47 | + - Limited documentation could extend the integration and development timeline. |
| 48 | + |
| 49 | +### [gpiod/libgpiod](https://github.com/brgl/libgpiod) |
| 50 | + |
| 51 | +- Pros: |
| 52 | + - The new Linux kernel interface for GPIO control, providing a unified approach across different Linux-based SBCs. |
| 53 | + - Offers broad compatibility with modern Linux systems, making it future-proof. |
| 54 | + - Supports Raspberry Pi 5 and generic SBCs. |
| 55 | + - Provides C bindings compatible with our C/C++ project. |
| 56 | +- Cons: |
| 57 | + - Integration may be complex due to structural differences from SplashKit’s current setup, requiring significant refactoring. |
| 58 | + - Does not natively support PWM; implementing PWM would require a custom solution using the sysfs interface or gpiomem, which are more complex and less performant. |
| 59 | + - Lacks remote GPIO support, limiting its utility in replacing pigpio in SplashKit. |
| 60 | + |
| 61 | +These libraries, in the writers opinion, are currently the most suitable for enable GPIO operations on the Raspberry Pi 5, and potentially on other linux SBC's. |
| 62 | +Whether they are ready for integration into SplashKit, is another question entirely. |
| 63 | + |
| 64 | +## Open issues/risks |
| 65 | + |
| 66 | +- PWM Functionality: |
| 67 | + - Implementing PWM with gpiod/libgpiod requires a custom solution, potentially leading to increased complexity and maintenance overhead. |
| 68 | + - The performance of such a custom implementation may not meet SplashKit's requirements. |
| 69 | + |
| 70 | +- Remote GPIO Operations: |
| 71 | + - Maintaining remote GPIO capabilities is crucial for SplashKit. |
| 72 | + - WiringPi and gpiod/libgpiod lack this feature, necessitating either a hybrid approach or alternative libraries. |
| 73 | + |
| 74 | +- Library Maturity and Support: |
| 75 | + - Both lgpio/rgpio and gpiod/libgpiod are relatively new, and this may pose risks regarding long-term support. |
| 76 | + - Limited documentation might increase the learning curve and integration time. |
| 77 | + |
| 78 | + |
| 79 | +## Recommendations |
| 80 | + |
| 81 | +- Further Evaluation of lgpio/rgpio: |
| 82 | + - Given its support for GPIO control, remote operations, PWM functionality, and C/C++ bindings, lgpio/rgpio is a strong candidate. |
| 83 | + - Conduct comprehensive testing to assess performance, stability, and compatibility with SplashKit. |
| 84 | + |
| 85 | +- Explore Alternatives: |
| 86 | + - This is by no means an exhaustive list of options; other libraries may better fulfill SplashKit's requirements. |
| 87 | + - Investigate additional libraries that can provide the needed functionalities, possibly with more mature ecosystems. |
| 88 | + |
| 89 | +- Additional Spikes and Testing: |
| 90 | + - Plan further spikes focused on integrating and testing different GPIO libraries. |
| 91 | + - Perform performance benchmarking, especially for time-sensitive operations like PWM and remote GPIO control. |
| 92 | + |
| 93 | +- Long-Term Strategy: |
| 94 | + - Monitor updates to pigpio or its forks for potential future support of Raspberry Pi 5 and generic SBCs. |
| 95 | + - Stay informed about emerging libraries and technologies that could meet SplashKit's evolving requirements. |
| 96 | + |
| 97 | + |
| 98 | +## Additional Resources |
| 99 | + |
| 100 | +- [lgpio/rgpio website](https://abyz.me.uk/lg/index.html) |
| 101 | +- [gpiod/libgpiod additional information](https://docs.kernel.org/userspace-api/gpio/chardev.html) |
| 102 | + - Note: libgpiod is the library provided by the kernel to interact with the linux GPIO character device. |
| 103 | +- [Additional Linux Kernel GPIO drivers](https://docs.kernel.org/driver-api/gpio/drivers-on-gpio.html) |
| 104 | + |
0 commit comments