Wiring Pi (for Raspberry Pi, Odroid etc)

#1

Wiring Pi

This is only avaiable for C and python. Is there something equivilant for Rust?

#2

A good starting point is https://crates.io/ then search for raspberry and you may find what you are looking for.
-> https://crates.io/crates/rppal

#3

Would this also be compatible for Odroid and other open boards?

#4

My answer was a little quick, I just thought of the Raspberry. I haven’t tested it, but I don’t think so.
But it use embedded-hal which is an Hardware Abstraction Layer (HAL)

#5

Oh ok thanks,

I got another question, say if I was programming a laser sensor for the Raspberry Pi using Rust, if I were run the exact same code for the Odroid or other open board like computers, then would the code run properly for the laser (other than ajusting the GPIO pins)?

#6

This is exactly the idea of embedded-hal (which @kurdy) mentions. HALs for specific SoCs tend to be based on the abstractions in this crate, such as InputPin and OutputPin for GPIOs. Code that is written using these abstractions, and separated from setup code for the specific SoC, can be used with any supported board.
See, for example, platform-agnostic device drivers like the SSD1306 one: https://github.com/jamwaffles/ssd1306

1 Like
#7

Is it Beta software?

#8

In a sense. Although level of completeness differs enormously per board (rPi, STM are most popular so sees the most effort) and a lot of it is usable, none of the crates in the embedded rust ecosystem (https://github.com/rust-embedded/awesome-embedded-rust gives a good overview) have reached 1.x yet, which means the APIs have not been fully stabilized. This might take a long time.

1 Like