pub struct PinScript { /* private fields */ }Expand description
A GPIO line that records the levels it is driven to and answers reads from a script.
Driving the pin appends to driven. Reading it returns the
next scripted level, or the level it was last driven to once the script is used up,
so a line that is only ever an output never runs dry.
§Examples
use pamoja_hal::digital::{InputPin, OutputPin, PinState};
use pamoja_hal::script::PinScript;
let mut pin = PinScript::new([PinState::Low, PinState::High]);
pin.set_high()?;
pin.set_low()?;
assert_eq!(pin.driven(), [PinState::High, PinState::Low]);
assert!(pin.is_low()?);
assert!(pin.is_high()?);Implementations§
Trait Implementations§
Source§impl StatefulOutputPin for PinScript
impl StatefulOutputPin for PinScript
Auto Trait Implementations§
impl Freeze for PinScript
impl RefUnwindSafe for PinScript
impl Send for PinScript
impl Sync for PinScript
impl Unpin for PinScript
impl UnsafeUnpin for PinScript
impl UnwindSafe for PinScript
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more