pub struct InputSignal<'d> { /* private fields */ }
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>
impl<'d> InputSignal<'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_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 level(&self) -> Level
pub fn level(&self) -> Level
Returns the current signal level.
Note that this does not take Self::with_input_inverter
into account.
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 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.
Trait Implementations§
Source§impl Clone for InputSignal<'_>
impl Clone for InputSignal<'_>
Source§impl<'d> From<Flex<'d>> for InputSignal<'d>
impl<'d> From<Flex<'d>> for InputSignal<'d>
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.
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§impl From<Level> for InputSignal<'_>
impl From<Level> for InputSignal<'_>
Source§impl From<NoPin> for InputSignal<'_>
impl From<NoPin> for InputSignal<'_>
Source§impl<'d, P> From<P> for InputSignal<'d>where
P: Pin + 'd,
impl<'d, P> From<P> for InputSignal<'d>where
P: Pin + 'd,
impl<'d> PeripheralInput<'d> for InputSignal<'d>
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit
)