Simply because Rene has done an incredible work on
rppal. It provides first class support for the Raspberry Pis. Instead of trying to (poorly) reimplement the features, I think it is best to build upon the
rppal. More importantly, Rene just added support for
embedded-hal drivers which is going to make adding more components to
rust_gpiozero much easier by leveraging already existing drivers. You should definitely check out
The main goal for this release was to provide software-based PWM components. At first I experimented with
wiring_pi. Fortunately, Rene added softpwm in
rppal v0.11.0 after I requested which made implementing the following components a breeze:
There are some API changes in existing components. Also, the
beeping methods now run in a background thread and do not block the main thread by default.
rust_gpiozero as an educational project and this release was very instructive:
I worked with threads in Rust which helped me better understand the borrowing, thread safety and closures. I worked with
std::sync::Mutex. However, I think there is still more to learn and discover.
macro_rules!for the first time. While previously using
traits, I felt not being able to override functions and also have access to struct data implementing the traits a challenge. With
macro_rules!, I wrote organised common implementations accordingly and implemented them where needed. It also made the code “DRYer”.
I got a better understanding of Pulse Width Modulation
I formatted the code with
I am going to write some tutorials on how to use the new features and components. I will also update Physical Computing with Rust to use the new version of
I hope to release more new features soon. You can also test the new version and provide feedback.
Want to get updates on these blog posts?
Enjoyed this post?Buy me a coffee