Struct embedded_hal_sync_pins::pins::PushPullPin [−][src]
pub struct PushPullPin { /* fields omitted */ }Expand description
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::blocking::{InputPin as HalInputPin, OutputPin};
use std::sync::Arc;
let state = Arc::new(AtomicPinState::new());
let mut pin = PushPullPin::new(state.clone());
pin.set_low().unwrap();
assert_eq!(Ok(true), pin.is_low());
pin.set_high().unwrap();
assert_eq!(Ok(true), pin.is_high());Implementations
Trait Implementations
type Error = Infallible
type Error = Infallible
Error type
Auto Trait Implementations
impl RefUnwindSafe for PushPullPin
impl Send for PushPullPin
impl Sync for PushPullPin
impl Unpin for PushPullPin
impl UnwindSafe for PushPullPin
Blanket Implementations
Mutably borrows from an owned value. Read more
