Struct imxrt_hal::gpio::Output

source ·
pub struct Output<P> { /* private fields */ }
Expand description

An output GPIO.

Implementations§

source§

impl<P> Output<P>

source

pub fn set(&self)

Set the GPIO high.

source

pub fn clear(&self)

Set the GPIO low.

source

pub fn toggle(&self)

Alternate the GPIO pin output.

toggle is implemented in hardware, so it will be more efficient than implementing in software.

source

pub fn is_set(&self) -> bool

Returns true if the GPIO is set.

source

pub fn release(self) -> P

Release the underlying pin object.

source

pub fn pin(&self) -> &P

Access the underlying pin.

source

pub fn pin_mut(&mut self) -> &mut P

Mutably access the underling pin.

source§

impl Output<()>

source

pub fn without_pin<const N: u8>(port: &mut Port<N>, offset: u32) -> Self

Allocate an output GPIO without a pin.

Prefer using Port::output to create a GPIO ouptut with a pin resource. That method ensures that pin resources are managed throughout your program, and that the pin is configured to operate as a GPIO output.

You may use this method to allocate duplicate Output object for the same physical GPIO output. This is considered safe, since the Output API is reentrant.

If you use this constructor, you’re responsible for configuring the IOMUX multiplexer register.

Trait Implementations§

source§

impl<P> OutputPin for Output<P>

§

type Error = Infallible

Error type
source§

fn set_high(&mut self) -> Result<(), Self::Error>

Drives the pin high Read more
source§

fn set_low(&mut self) -> Result<(), Self::Error>

Drives the pin low Read more
source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value Read more
source§

impl<P: Send> Send for Output<P>

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for Output<P>

§

impl<P> !Sync for Output<P>

§

impl<P> Unpin for Output<P>
where P: Unpin,

§

impl<P> !UnwindSafe for Output<P>

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>,

§

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>,

§

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.