[][src]Struct embedded_hal_sync_pins::pins::InputPin

pub struct InputPin { /* fields omitted */ }

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

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

Examples

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

let state = Arc::new(AtomicPinState::new_with_state(PinState::Low));
let pin = InputPin::new(state.clone());
assert_eq!(Ok(true), pin.try_is_low());
state.store(PinState::High, Ordering::SeqCst);
assert_eq!(Ok(true), pin.try_is_high());

Implementations

impl InputPin[src]

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

Creates a new input pin with a given PinState.

Trait Implementations

impl Clone for InputPin[src]

impl Debug for InputPin[src]

impl InputPin for InputPin[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.