Rust for Low Power Digital Signal Processing | Interrupt

Like many firmware developers, I’ve been curious about the potential Rust can have in the embedded space. After reading James Munns’ great article, I decided to find a project I could use Rust for to learn.

This is a companion discussion topic for the original entry at

Did you try using crate-type = ["staticlib", "rlib"]?

Excellent work!!!
Just a clarification, I dont know the inner-workings of APP_ERROR_CHECK_BOOL, but in the mean_rs == mean_c comparison, floats should never compare by value directly due the lack of precision of that type of data.

The difference between the values should be compared to be less than an acceptable error tolerance.

Something like:

const float32 TOLERANCE = 0.0001;
 float32 diff = abs(mean_rs - mean_c);


You’re correct. In this case, it works because we’re running on the same MCU with the same FPU. FP math is imprecise, but it is deterministic.

I think that would work, though what we really want is the ability to set crate type based on target. This is an open issue against cargo: