News for hackers. Stuff that matters.
Re:Zig and Rust by bschwindHN on Monday March 27, 2023 @10:39PM (#35335169)
I'm not sure what was available to the author at the time of writing, but it feels like abstractions have gotten better and writing embedded Rust has gotten easier.

I also wrote keyboard firmware in Rust and thought it was great! I leaned on embedded-hal and the chip HAL crates (one layer of abstraction higher than the author in your link) and was able to get the majority of the firmware done in a day or two. For example, here is my key matrix scanning function:

https://github.com/bschwind/key-ripper/blob/d33db6144bbb6f80...

I also gave a small talk on the subject (aimed more at beginners) at a Rust meetup in Tokyo:

https://www.youtube.com/watch?v=x7LQevYn7d0

And finally, a (somewhat) dated article I wrote about using Rust for embedded work:

https://blog.tonari.no/rust-simple-hardware-project

Overall, it feels totally usable to me, and I love how Rust's ownership and lifetime concepts prevent me from doing stupid things like reusing a pin for two peripherals or configuring a peripheral with pins it can't work with.

There are no comments on this comment yet.