As a long time C programmer this is not very convincing. A C program to do the same requires far less voodoo. All you need to do is take the address of the GPIO register then toggle the bit. No name mangling. No error handlers to override. Don't get me wrong I know rust does have some compelling features. It does seem odd to me that so many of what would be compiler options in C are hard coded.
As a C programmer who fiddles with low level stuff I wonder why people get exciting about such trivial thing.<p>Don't get me wrong. Rust is an interesting language. The thing described in this post is well within its capability, i.e. IMO there isn't really anything that worths bragging about. Such trivial thing neither demonstrates the real potential of Rust, nor answers important questions from real world engineering perspective.<p>I'm all for having better tool to write low level stuff. I have dabbled with Rust and the experience was eye-opening. I think Rust still have a lot to catch up though.
I have the perfect project for this! Generate a signal using the GPIO ports to drive a mirror and camera in a synchronized fashion.<p>Does anyone know if the RPi GPIOs can be driven at around 80KHz? I've seen reports that this is possible, but that the USB or video driver tends to lock the CPU for long times, messing with timings - but hopefully running on bare metal would take care of that.
Outside of C, are there any other languages or platforms that can do this? I'd like something modern, but I haven't liked what I've seen with Rust personally.
I remember reading a couple months ago that bare metal using Rust was in a bad state. If I recall correctly the outputs were prohibitively large, among other issues.<p>Has that changed?
If you want to play around with the code in this post that requires nightly, multirust makes it much more pleasant to use nightly and / or stable rust.<p><a href="https://github.com/brson/multirust" rel="nofollow">https://github.com/brson/multirust</a>