[][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::{ActiveHigh, OutputSwitch, Switch};
let mut led = Switch::<_, ActiveHigh>::new(pin);
led.on().ok();

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

Turns the switch off

Examples

use switch_hal::{ActiveHigh, OutputSwitch, Switch};
let mut led = Switch::<_, ActiveHigh>::new(pin);
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...