Struct InputSignal

Source
pub struct InputSignal<'d> { /* private fields */ }
Available on crate feature unstable only.
Expand description

An input signal between a peripheral and a GPIO pin.

If the InputSignal was obtained from a pin driver such as Input, the GPIO driver will be responsible for configuring the pin with the correct settings, peripheral drivers will not be able to modify the pin settings.

Multiple input signals can be connected to one pin.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl<'d> InputSignal<'d>

Source

pub fn freeze(self) -> Self

Freezes the pin configuration.

This will prevent peripheral drivers using this signal from modifying the pin settings.

Source

pub unsafe fn unfreeze(&mut self)

Unfreezes the pin configuration.

This will enable peripheral drivers to modify the pin settings again.

§Safety

This function is unsafe because it allows peripherals to modify the pin configuration again. This can lead to undefined behavior if the pin is being configured by multiple peripherals at the same time. It can also lead to surprising behavior if the pin is passed to multiple peripherals that expect conflicting settings.

Source

pub fn gpio_number(&self) -> Option<u8>

Returns the GPIO number of the underlying pin.

Returns None if the signal is a constant level.

Source

pub fn is_input_high(&self) -> bool

Returns true if the input signal is high.

Note that this does not take Self::with_input_inverter into account.

Source

pub fn level(&self) -> Level

Returns the current signal level.

Note that this does not take Self::with_input_inverter into account.

Source

pub fn is_input_inverted(&self) -> bool

Returns true if the input signal is configured to be inverted.

Note that the hardware is not configured until the signal is actually connected to a peripheral.

Source

pub fn with_input_inverter(self, invert: bool) -> Self

Consumes the signal and returns a new one that inverts the peripheral’s input signal.

Source

pub fn with_gpio_matrix_forced(self, force: bool) -> Self

Consumes the signal and returns a new one that forces the GPIO matrix to be used.

Source

pub fn is_gpio_matrix_forced(&self) -> bool

Returns true if the input signal must be routed through the GPIO matrix.

Trait Implementations§

Source§

impl Clone for InputSignal<'_>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'d> From<Flex<'d>> for InputSignal<'d>

Source§

fn from(pin: Flex<'d>) -> Self

Converts to this type from the input type.
Source§

impl<'d> From<Input<'d>> for InputSignal<'d>

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

fn from(pin: Input<'d>) -> Self

Converts to this type from the input type.
Source§

impl From<Level> for InputSignal<'_>

Source§

fn from(level: Level) -> Self

Converts to this type from the input type.
Source§

impl From<NoPin> for InputSignal<'_>

Source§

fn from(_pin: NoPin) -> Self

Converts to this type from the input type.
Source§

impl<'d, P> From<P> for InputSignal<'d>
where P: Pin + 'd,

Source§

fn from(input: P) -> Self

Converts to this type from the input type.
Source§

impl<'d> PeripheralInput<'d> for InputSignal<'d>

Source§

impl<'d> PeripheralSignal<'d> for InputSignal<'d>

Auto Trait Implementations§

§

impl<'d> Freeze for InputSignal<'d>

§

impl<'d> RefUnwindSafe for InputSignal<'d>

§

impl<'d> Send for InputSignal<'d>

§

impl<'d> Sync for InputSignal<'d>

§

impl<'d> Unpin for InputSignal<'d>

§

impl<'d> !UnwindSafe for InputSignal<'d>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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.
§

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

Performs the conversion.