[−][src]Struct rppal::gpio::Gpio
Provides access to the Raspberry Pi's GPIO peripheral.
Methods
impl Gpio[src]
pub fn new() -> Result<Gpio>[src]
Constructs a new Gpio.
pub fn get(&self, pin: u8) -> Result<Pin>[src]
Returns a Pin for the specified BCM GPIO pin number.
Retrieving a GPIO pin grants access to the pin through an owned Pin instance.
If the pin is already in use, or the GPIO peripheral doesn't expose a pin with the
specified number, get returns Err(Error::PinNotAvailable). After a Pin
(or a derived InputPin, OutputPin or IoPin) goes out of scope, it
can be retrieved again through another get call.
pub fn poll_interrupts<'a>(
&self,
pins: &[&'a InputPin],
reset: bool,
timeout: Option<Duration>
) -> Result<Option<(&'a InputPin, Level)>>[src]
&self,
pins: &[&'a InputPin],
reset: bool,
timeout: Option<Duration>
) -> Result<Option<(&'a InputPin, Level)>>
Blocks until an interrupt is triggered on any of the specified pins, or until a timeout occurs.
Only pins that have been previously configured for synchronous interrupts using InputPin::set_interrupt
can be polled. Asynchronous interrupt triggers are automatically polled on a separate thread.
Calling poll_interrupts blocks any other calls to poll_interrupts or InputPin::poll_interrupt until
it returns. If you need to poll multiple pins simultaneously on different threads, consider using
asynchronous interrupts with InputPin::set_async_interrupt instead.
Setting reset to false returns any cached interrupt trigger events if available. Setting reset to true
clears all cached events before polling for new events.
The timeout duration indicates how long the call to poll_interrupts will block while waiting
for interrupt trigger events, after which an Ok(None) is returned.
timeout can be set to None to wait indefinitely.
When an interrupt event is triggered, poll_interrupts returns
Ok((&InputPin, Level)) containing the corresponding pin and logic level. If multiple events trigger
at the same time, only the first one is returned. The remaining events are cached and will be returned
the next time InputPin::poll_interrupt or poll_interrupts is called.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Gpio
impl Send for Gpio
impl Sync for Gpio
impl Unpin for Gpio
impl UnwindSafe for Gpio
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,