NOP0 / rustmatic

PLC programming in Rust!
Apache License 2.0
35 stars 2 forks source link

WIP: Linux GPIO device #6

Closed Michael-F-Bryan closed 4 years ago

Michael-F-Bryan commented 4 years ago

This builds on top of the Device code from #4 to implement a Device that uses the Linux GPIO interface under the hood.

Michael-F-Bryan commented 4 years ago

I'm surprised how it was to make the naive Device implementation. If you ignore all the cruft from #4, all of the implementation fit into a single, rather straightforward commit (a2d93e6).

I'm not satisfied with how the GpioPin is constructed though. It assumes you've already got an InputNumber (or OutputNumber), but until now we've never even talked about where that'll come from. There's a good chance we'll run into a chicken-and-egg problem... GpioPin requires an InputNumber, but you only get that after the GpioPin has been constructed and told the IO system which inputs and outputs it uses.

NOP0 commented 4 years ago

Yes, it's was quite clean to implement a new device. Nice solution with the Registrar trait. Promising! :+1: Yeah, I agree there's a chicken and egg-problem there.