ryankurte / rust-driver-pal

Rust embedded SPI helper / testing package
1 stars 6 forks source link

Split control pins into explicit types. #2

Closed berkowski closed 5 years ago

berkowski commented 5 years ago

Attempt to address issue #1:

berkowski commented 5 years ago

Not the best ergonomics for Wrapper::new. I tried figuring out how to implement a builder pattern to reserve the with_busy style of adding additional capability but didn't have any real success. In the end you don't regularly add control pins to a peripheral after "setup" so it may not be too big a deal.

The crate could use a run through rustfmt too, but I didn't want to make the merge commit any more confusing.

berkowski commented 5 years ago

Yep, sorry. Missed that because I have my target set to armv6 with --no-default-features, so utils and ffi aren't being built.

DeviceConfig::load in utils.rs will need some thought to refactor since Wrapper now has discrete types depending on the presence of control pins.

ryankurte commented 5 years ago

DeviceConfig::load in utils.rs will need some thought to refactor since Wrapper now has discrete types depending on the presence of control pins.

hmm yes this is an,, interesting, problem. i guess we could provide busy/ready always, or have different constructors, any other ideas?

ryankurte commented 5 years ago

sorry for the delay on this! i refactored and split the load methods and merged it all in. good luck / do let me know how it all goes ^_^