rustberry: the all-purpose rust library for raspberry pi

You've guessed it, I've started yet another project. I swear this time, I'm going to stick with it! This has been something that I've been trying to do for a long time, and finally, the pieces are coming together. I won't spoil exactly what the final product will be, but I'll be updating here whenever I make some progress.

As you may have inferred from the title, my latest and greatest endeavor is to write a fully-featured Rust library for the Raspberry Pi. I have dubbed it rustberry, which is (in my opinion) one of the greatest names I have ever given a project.

My plan for rustberry is quite complicated. It is difficult to design such a library in a way that conforms to the runtime safety that Rust guarantees. The model that I plan on using is a "reservation" system, where every GPIO pin and every PWM controller/SPI master, etc. is allocated to (and "owned" by) a single object. Once pin X or driver Y has been reserved, only that "reserving object" has access to that pin, guaranteeing that no one else may access it until the reserving object is dropped.

There are still some theoretical/conceptual issues. For example, our process has absolutely no control over other processes which may interact with the GPIO concurrently. It is impossible to completely guarantee that our process has sole access to a pin. The best we can do is make the assumption that we are the only process in direct control of GPIO, which, in my opinion, is a safe assumption to make. I've never seen anyone in their right mind try to run multiple programs that all interface with GPIO, so it should be reasonable to assume that nearly anyone who is developing in Rust has the same sensibility.

My roadmap for rustberry is still not well-defined. I would like to have it done by the time I finish this semester; however, that will still be far from a potential release candidate. I want to be able to test this library on as many models as possible, but due to my strict budget, I obviously can't buy every single model out there. As the project nears completion, I will be sending out a call for volunteer testers. There is currently no plan to officially support Pi clones, but I am keeping my options open. In fact, I do have that Orange Pi sitting around that may be used in the future...

If you are interested in what I am doing. If so, I would like to encourage you to follow the development of rustberry, and contribute if you can! While Rust is my primary language of choice nowadays, I'm still developing my best practices. If you see something that could be improved upon, please let me know by filing an issue or even submitting the merge request yourself. Help make this project truly open-source. It would be awesome to have an entire community supporting the project in the future.

links

social