pub trait OutputSwitch {
    type Error;

    // Required methods
    fn on(&mut self) -> Result<(), Self::Error>;
    fn off(&mut self) -> Result<(), Self::Error>;
}
Expand description

Represents an output switch, such as a LED “switch” or transitor

Required Associated Types§

Required Methods§

source

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();
source

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();

Implementors§