pub struct OutputSignal<'d> { /* private fields */ }
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>
impl<'d> OutputSignal<'d>
Sourcepub fn freeze(self) -> Self
pub fn freeze(self) -> Self
Freezes the pin configuration.
This will prevent peripheral drivers using this signal from modifying the pin settings.
Sourcepub unsafe fn unfreeze(&mut self)
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.
Sourcepub fn gpio_number(&self) -> Option<u8>
pub fn gpio_number(&self) -> Option<u8>
Returns the GPIO number of the underlying pin.
Returns None
if the signal is a constant level.
Sourcepub fn is_input_inverted(&self) -> bool
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.
Sourcepub fn is_output_inverted(&self) -> bool
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.
Sourcepub fn with_output_inverter(self, invert: bool) -> Self
pub fn with_output_inverter(self, invert: bool) -> Self
Consumes the signal and returns a new one that inverts the peripheral’s output signal.
Sourcepub fn with_input_inverter(self, invert: bool) -> Self
pub fn with_input_inverter(self, invert: bool) -> Self
Consumes the signal and returns a new one that inverts the peripheral’s input signal.
Sourcepub fn with_gpio_matrix_forced(self, force: bool) -> Self
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.
Sourcepub fn is_gpio_matrix_forced(&self) -> bool
pub fn is_gpio_matrix_forced(&self) -> bool
Returns true
if the input signal must be routed through the GPIO
matrix.
Sourcepub fn is_input_high(&self) -> bool
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.
Sourcepub fn is_set_high(&self) -> bool
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>
impl<'d> From<Flex<'d>> for OutputSignal<'d>
Source§impl From<Level> for OutputSignal<'_>
impl From<Level> for OutputSignal<'_>
Source§impl From<NoPin> for OutputSignal<'_>
impl From<NoPin> for OutputSignal<'_>
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.
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.