mciantyre / teensy4-rs

Rust support for the Teensy 4
Apache License 2.0
271 stars 31 forks source link

add an example of a function accepting an arbitrary Pin and returning an Input GPIO #114

Closed dhiltonp closed 2 years ago

dhiltonp commented 2 years ago

I'm a n00b, and this function signature took me an embarrassingly long time to figure out.

Maybe rust IDEs give suggestions for function signatures based on the types used?

I think this example is both useful and correct.

dhiltonp commented 2 years ago

give me a sec, I'm missing something...

dhiltonp commented 2 years ago

Oh, it's ok. I just made another mistake while testing it.

dhiltonp commented 2 years ago

Oh, I discovered from #104 that examples can actually be compiled using something like cargo build --example configure_pin_function --target thumbv7em-none-eabihf --features="rt"

I found a couple of missed imports and unused code and cleaned it up.

dhiltonp commented 2 years ago

Thanks for your help @mciantyre.

I've added an entry to examples, and also removed IOMUX.