Skip to main content

OutputPin

Trait OutputPin 

pub trait OutputPin: ErrorType {
    // Required methods
    fn set_low(&mut self) -> Result<(), Self::Error>;
    fn set_high(&mut self) -> Result<(), Self::Error>;

    // Provided method
    fn set_state(&mut self, state: PinState) -> Result<(), Self::Error> { ... }
}
Expand description

Single digital push-pull output pin.

Required Methods§

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

Drives the pin low.

NOTE the actual electrical state of the pin may not actually be low, e.g. due to external electrical sources.

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

Drives the pin high.

NOTE the actual electrical state of the pin may not actually be high, e.g. due to external electrical sources.

Provided Methods§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value.

NOTE the actual electrical state of the pin may not actually be high or low, e.g. due to external electrical sources.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<T> OutputPin for &mut T
where T: OutputPin + ?Sized,

§

fn set_low(&mut self) -> Result<(), <&mut T as ErrorType>::Error>

§

fn set_high(&mut self) -> Result<(), <&mut T as ErrorType>::Error>

§

fn set_state( &mut self, state: PinState, ) -> Result<(), <&mut T as ErrorType>::Error>

Implementors§