Trait switch_hal::IntoSwitch [−][src]
pub trait IntoSwitch { fn into_switch<ActiveLevel>(self) -> Switch<Self, ActiveLevel>
where
Self: Sized; fn into_active_low_switch(self) -> Switch<Self, ActiveLow>
where
Self: Sized, { ... } fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>
where
Self: Sized, { ... } }
Expand description
Convenience functions for converting InputPin and OutputPin to a Switch.
The type of Switch returned,
InputSwitch or OutputSwitch is
determined by whether the IoPin
being consumed is an InputPin
or OutputPin.
Required methods
fn into_switch<ActiveLevel>(self) -> Switch<Self, ActiveLevel> where
Self: Sized,
[src]
fn into_switch<ActiveLevel>(self) -> Switch<Self, ActiveLevel> where
Self: Sized,
[src]Consumes the IoPin
returning a Switch of the appropriate ActiveLevel
.
This method exists so other, more convenient functions, can have blanket implementations.
Prefer into_active_low_switch and into_active_high_switch.
Examples
Active High
use switch_hal::{ActiveHigh, OutputSwitch, IntoSwitch}; let led = pin.into_switch::<ActiveHigh>();
Active Low
use switch_hal::{ActiveLow, InputSwitch, IntoSwitch}; let button = pin.into_switch::<ActiveLow>();
Provided methods
fn into_active_low_switch(self) -> Switch<Self, ActiveLow> where
Self: Sized,
[src]
fn into_active_low_switch(self) -> Switch<Self, ActiveLow> where
Self: Sized,
[src]Consumes the IoPin
returning a Switch<IoPin, ActiveLow>
.
Examples
use switch_hal::IntoSwitch; let led = pin.into_active_low_switch();
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh> where
Self: Sized,
[src]
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh> where
Self: Sized,
[src]Consumes the IoPin
returning a Switch<IoPin, ActiveHigh>
.
Examples
use switch_hal::IntoSwitch; let button = pin.into_active_high_switch();