GPIO monitoring


I’m doing some prototyping on an intel edison with an OLED block. I have written some rust code that constantly checks each individual gpio value file for changes and determines their current state. Right now this runs in an infinite loop that pauses every few milliseconds before reading the files contents and checking their values. I’m looking for a better implementation to gpio monitoring because I’m sure there are better ways to do than this. Any suggestions would be welcome.


When interfacing directly with hardware at this level, you’d typically use (hardware) interrupts for asynchronous event notification — the idea is that you’d update your program’s internal state only when the actual hardware state changes.

A quick Google search leads me to some interesting results. I know nothing about the Mraa library, but this article suggests it may provide the API needed do what you want in an interrupt-driven manner.

You’ll need to find or crate a Rust wrapper for the library, of course, before you can use it from Rust.


@insaneinside thanks for the assist. I’ll check it out and see where it gets me.