Trait switch_hal::ToggleableOutputSwitch

source ·
pub trait ToggleableOutputSwitch {
    type Error;

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

Toggles the switch from it’s current state to it’s opposite state.

§Notes

This is only available if the underlying hal has implemented ToggleableOutputPin

Required Associated Types§

Required Methods§

source

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

Toggles the current state of the OutputSwitch

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

Implementors§

source§

impl<T: OutputPin + ToggleableOutputPin, ActiveLevel> ToggleableOutputSwitch for Switch<T, ActiveLevel>