Posts

Showing posts from August, 2019

Embedded Rust

I want to become fluent in Rust, and I have a few things I'd like to do with embedded systems, so I figured I'd combine the two. This has got a lot easier since I first thought about it: there's a book . The thing I specifically want to do is regularly sample the ADC, using non-blocking APIs. This is sort of supported: There are some standardised HAL API s, and they use nb  which is a generalised non-blocking mechanism. This does mean, however, that you end up needing a spin loop that tries everything you are waiting for. You can handle interrupts, so perhaps there's a sleep function that wakes up after an interrupt has been processed? Then I could add something like Chibios events: the interrupt would set the right event flag, and the main loop would act on each event flag that was set, each time it woke up. I don't need to do this, because the RTFM framework does it already, and statically analyses your program for deadlocks. RTFM lets you define '