Trait Output

Source
pub trait Output {
    // Required methods
    fn set_channel(&mut self, channel: u8);
    fn enable(&mut self);
    fn disable(&mut self);
    fn num_channels(&self) -> u8;
}
Expand description

A trait so we can support both 8-channel and 16-channel multiplexers simultaneously by merely instantiating them with a 5 (16-channel) or 4 (8-channel) member tuple of OutputPins.

Required Methods§

Source

fn set_channel(&mut self, channel: u8)

Source

fn enable(&mut self)

Source

fn disable(&mut self)

Source

fn num_channels(&self) -> u8

Implementations on Foreign Types§

Source§

impl<E, S0: OutputPin<Error = E>, S1: OutputPin<Error = E>, S2: OutputPin<Error = E>, EN: OutputPin<Error = E>> Output for (S0, S1, S2, EN)

A 4-pin implementation to support 8-channel multiplexers (e.g. 74HC4051)

Source§

fn set_channel(&mut self, channel: u8)

Sets the current active channel on the multiplexer (0-7)

Source§

fn enable(&mut self)

Brings the EN pin low to enable the multiplexer

Source§

fn disable(&mut self)

Brings the EN pin high to disable the multiplexer

Source§

fn num_channels(&self) -> u8

Returns the number of channels supported by this multiplexer (so you can easily iterate over them).

Source§

impl<E, S0: OutputPin<Error = E>, S1: OutputPin<Error = E>, S2: OutputPin<Error = E>, S3: OutputPin<Error = E>, EN: OutputPin<Error = E>> Output for (S0, S1, S2, S3, EN)

A 5-pin implementation to support 16-channel multiplexers (e.g. 74HC4067)

Source§

fn set_channel(&mut self, channel: u8)

Sets the current active channel on the multiplexer (0-15)

Source§

fn enable(&mut self)

Brings the EN pin low to enable the multiplexer

Source§

fn disable(&mut self)

Brings the EN pin high to disable the multiplexer

Source§

fn num_channels(&self) -> u8

Returns the number of channels supported by this multiplexer (so you can easily iterate over them).

Implementors§