Io

Struct Io 

Source
pub struct Io<B, const N: u32, R, D>
where B: Bank<R>, R: GpioRegisters,
{ /* private fields */ }
Expand description

Typed GPIO pin handle.

Generic parameters:

  • N: constant pin index within the bank.
  • B: bank type which implements Bank<R>.
  • R: register block implementing GpioRegisters.
  • D: direction marker type (Input or Output).

Implementations§

Source§

impl<B, const N: u32, R, D> Io<B, N, R, D>
where B: Bank<R>, R: GpioRegisters, D: Direction,

Source

pub fn init() -> Self

Initialize the typed IO for pin N.

This configures the hardware direction using the marker types Input and Output.

Source§

impl<B, const N: u32, R> Io<B, N, R, Input>
where B: Bank<R>, R: GpioRegisters,

Source

pub fn set_interrupt(&mut self, interrupt: Interrupt)

Set the interrupt configuration for this input pin.

Source

pub fn read(&self) -> Level

Read the current logical level of the pin.

Source

pub fn interrupt_pending(&self) -> bool

Read whether an interrupt is pending for this pin.

Source§

impl<B, const N: u32, R, Mode: OutputMode> Io<B, N, R, Output<Mode>>
where B: Bank<R>, R: GpioRegisters,

Source

pub fn activate(&mut self)

Activate the pin (drive to active state).

Source

pub fn deactivate(&mut self)

Deactivate the pin (drive to inactive state).

Auto Trait Implementations§

§

impl<B, const N: u32, R, D> Freeze for Io<B, N, R, D>

§

impl<B, const N: u32, R, D> RefUnwindSafe for Io<B, N, R, D>

§

impl<B, const N: u32, R, D> Send for Io<B, N, R, D>

§

impl<B, const N: u32, R, D> Sync for Io<B, N, R, D>

§

impl<B, const N: u32, R, D> Unpin for Io<B, N, R, D>

§

impl<B, const N: u32, R, D> UnwindSafe for Io<B, N, R, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.