switch_hal

Trait OutputSwitch

Source
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§