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.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Error type returned by ADC methods
Request that the ADC begin a conversion on the specified pin Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.