[][src]Struct embedded_hal_sync_pins::pins::PushPullPin

pub struct PushPullPin { /* fields omitted */ }

A mutable output pin that can be safely shared between threads.

This pin implements embedded_hal::OutputPin and can be used to share an AtomicPinState with an embedded_hal implementation.

It also implements embedded_hal::InputPin, so it is possible to also read the internal state.

Examples

use embedded_hal_sync_pins::pins::{AtomicPinState, PushPullPin, PinState};
use embedded_hal::digital::{InputPin as HalInputPin, OutputPin};
use std::sync::Arc;

let state = Arc::new(AtomicPinState::new());
let mut pin = PushPullPin::new(state.clone());
pin.try_set_low().unwrap();
assert_eq!(Ok(true), pin.try_is_low());
pin.try_set_high().unwrap();
assert_eq!(Ok(true), pin.try_is_high());

Implementations

impl PushPullPin[src]

pub fn new(state: Arc<AtomicPinState>) -> Self[src]

Trait Implementations

impl Clone for PushPullPin[src]

impl Debug for PushPullPin[src]

impl InputPin for PushPullPin[src]

type Error = Infallible

Error type

impl OutputPin for PushPullPin[src]

type Error = Infallible

Error type

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.