[−][src]Struct analog_multiplexer::Multiplexer
Provides an interface for setting the active channel
and enabling/disabling an 8-channel (74HC4051) or
16-channel (74HC4067) analog multiplexer. It also
keeps track of which channel is currently active
(active_channel
) and provides a convenient
num_channels
field that can be used to iterate
over all the multiplexer's channels.
Fields
pins: Pins
num_channels: u8
active_channel: u8
enabled: bool
Implementations
impl<Pins: Output> Multiplexer<Pins>
[src]
pub fn new(pins: Pins) -> Self
[src]
Given a 5 or 4-member tuple, (s0, s1, s2, s3, en)
or
(s0, s1, s2, en)
where every member is an OutputPin
,
returns a new instance of Multiplexer
for a
16-channel or 8-channel analog multiplexer, respectively.
NOTE: Some multiplexers label S0-S3 as A-D. They're the same thing.
pub fn set_channel(&mut self, channel: u8)
[src]
Sets the current active channel on the multiplexer
(0 up to num_channels
) and records that state in
self.active_channel
pub fn enable(&mut self)
[src]
Enables the multiplexer and sets self.enabled = true
pub fn disable(&mut self)
[src]
Disables the multiplexer and sets self.enabled = false
Auto Trait Implementations
impl<Pins> Send for Multiplexer<Pins> where
Pins: Send,
Pins: Send,
impl<Pins> Sync for Multiplexer<Pins> where
Pins: Sync,
Pins: Sync,
impl<Pins> Unpin for Multiplexer<Pins> where
Pins: Unpin,
Pins: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,