[][src]Trait switch_hal::OutputSwitch

pub trait OutputSwitch {
    type Error;
    fn on(&mut self) -> Result<(), Self::Error>;
fn off(&mut self) -> Result<(), Self::Error>; }

Represents an output switch, such as a LED "switch" or transitor

Associated Types

type Error

Loading content...

Required methods

fn on(&mut self) -> Result<(), Self::Error>

Turns the switch on

Examples

use switch_hal::{OutputSwitch, Switch, IntoSwitch};
let mut led = pin.into_active_high_switch();
led.on().ok();

fn off(&mut self) -> Result<(), Self::Error>

Turns the switch off

Examples

use switch_hal::{OutputSwitch, Switch, IntoSwitch};
let mut led = pin.into_active_high_switch();
led.off().ok();
Loading content...

Implementors

impl<T: OutputPin> OutputSwitch for Switch<T, ActiveHigh>[src]

type Error = <T as OutputPin>::Error

impl<T: OutputPin> OutputSwitch for Switch<T, ActiveLow>[src]

type Error = <T as OutputPin>::Error

Loading content...