Struct OutputSignal

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

An (input and) output signal between a peripheral and a GPIO pin.

If the OutputSignal was obtained from a pin driver such as Output, 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.

Note that connecting this to a peripheral input will enable the input stage of the GPIO pin.

Multiple pins can be connected to one output signal.

§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> OutputSignal<'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_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 is_output_inverted(&self) -> bool

Returns true if the output 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_output_inverter(self, invert: bool) -> Self

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

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.

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 is_set_high(&self) -> bool

Returns true if the output signal is set high.

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

Trait Implementations§

Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<Level> for OutputSignal<'_>

Source§

fn from(level: Level) -> Self

Converts to this type from the input type.
Source§

impl From<NoPin> for OutputSignal<'_>

Source§

fn from(_pin: NoPin) -> Self

Converts to this type from the input type.
Source§

impl<'d> From<Output<'d>> for OutputSignal<'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: Output<'d>) -> Self

Converts to this type from the input type.
Source§

impl<'d, P> From<P> for OutputSignal<'d>
where P: OutputPin + 'd,

Source§

fn from(output: P) -> Self

Converts to this type from the input type.
Source§

impl<'d> PeripheralOutput<'d> for OutputSignal<'d>

Source§

impl<'d> PeripheralSignal<'d> for OutputSignal<'d>

Auto Trait Implementations§

§

impl<'d> Freeze for OutputSignal<'d>

§

impl<'d> RefUnwindSafe for OutputSignal<'d>

§

impl<'d> Send for OutputSignal<'d>

§

impl<'d> Sync for OutputSignal<'d>

§

impl<'d> Unpin for OutputSignal<'d>

§

impl<'d> !UnwindSafe for OutputSignal<'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> 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.