Struct shared_bus::AdcProxy
source · pub struct AdcProxy<'a, M> { /* private fields */ }
Expand description
Proxy type for ADC sharing.
The AdcProxy
implements OneShot trait so it can be passed to drivers instead of
ADC instance. Internally, it holds reference to the bus via a mutex, ensuring
that all accesses are strictly synchronized.
An AdcProxy
is created by calling BusManager::acquire_adc()
.
Note: The adc::OneShot
trait proxied by this type describes a
non-blocking contract for ADC read operation. However access to a shared ADC
unit can not be arbitrated in a completely non-blocking and concurrency safe way.
Any reading from a channel shall be completed before shared-bus
can allow the
next read from the same or another channel. So the current implementation breaks
the non-blocking contract of the trait and just busy-spins until a sample is
returned.