rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
2.01k stars 202 forks source link

SPI `ExclusiveDevice`: access the bus object #467

Closed bugadani closed 1 year ago

bugadani commented 1 year ago

Sometimes it might be necessary/useful to access the SPI bus object that is held by an ExclusiveDevice. One such case might be adjusting SCLK speed based on some data read from the SPI device.

Dirbaio commented 1 year ago

This was discussed a bit in today's meeting. Sounds like a good feature to have. Could you send a PR?

bugadani commented 1 year ago

Definitely, if something like an inner_ref()/inner_mut() pair sound good. I'm on a vacation, though, so earliest is next week.

Dirbaio commented 1 year ago

I htink the convention is inner(), inner_mut()? We might want to do into_inner() too, to deconstruct it.