pub struct LiteXGPIOPin<'controller, 'client, R: LiteXSoCRegisterConfiguration> { /* private fields */ }
Expand description
Single GPIO pin of a LiteXGPIOController
Can be obtained by calling LiteXGPIOController::get_gpio_pin
.
Only one LiteXGPIOPin
instance may exist per GPIO pin. To
deregister this instance, call LiteXGPIOPin::destroy
(or drop it).
Implementations§
Source§impl<'controller, 'client, R: LiteXSoCRegisterConfiguration> LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R: LiteXSoCRegisterConfiguration> LiteXGPIOPin<'controller, 'client, R>
Sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
Index of this GPIO pin in the LiteXGPIOController
GPIO array
Sourcepub fn controller(&self) -> &'controller LiteXGPIOController<'client, R>
pub fn controller(&self) -> &'controller LiteXGPIOController<'client, R>
Returns a reference to the LiteXGPIOController
of this GPIO
Sourcepub fn destroy(self)
pub fn destroy(self)
Destroy (deregister & consume) the LiteXGPIOPin
Trait Implementations§
Source§impl<R: LiteXSoCRegisterConfiguration> Configure for LiteXGPIOPin<'_, '_, R>
impl<R: LiteXSoCRegisterConfiguration> Configure for LiteXGPIOPin<'_, '_, R>
Source§fn configuration(&self) -> Configuration
fn configuration(&self) -> Configuration
Return the current pin configuration.
Source§fn make_output(&self) -> Configuration
fn make_output(&self) -> Configuration
Make the pin an output, returning the current configuration,
which should be either
Configuration::Output
or
Configuration::InputOutput
.Source§fn disable_output(&self) -> Configuration
fn disable_output(&self) -> Configuration
Disable the pin as an output, returning the current configuration.
Source§fn make_input(&self) -> Configuration
fn make_input(&self) -> Configuration
Make the pin an input, returning the current configuration,
which should be ither
Configuration::Input
or
Configuration::InputOutput
.Source§fn disable_input(&self) -> Configuration
fn disable_input(&self) -> Configuration
Disable the pin as an input, returning the current configuration.
Source§fn deactivate_to_low_power(&self)
fn deactivate_to_low_power(&self)
Put a pin into its lowest power state, with no guarantees on
if it is enabled or not. Implementations are free to use any
state (e.g. input, output, disable, etc.) the hardware pin
supports to ensure the pin is as low power as possible.
Re-enabling the pin requires reconfiguring it (i.e. the state
of its enabled configuration is not stored).
Source§fn set_floating_state(&self, _state: FloatingState)
fn set_floating_state(&self, _state: FloatingState)
Set the floating state of the pin.
Source§fn floating_state(&self) -> FloatingState
fn floating_state(&self) -> FloatingState
Return the current floating state of the pin.
Source§impl<R: LiteXSoCRegisterConfiguration> Drop for LiteXGPIOPin<'_, '_, R>
impl<R: LiteXSoCRegisterConfiguration> Drop for LiteXGPIOPin<'_, '_, R>
Source§impl<R: LiteXSoCRegisterConfiguration> Input for LiteXGPIOPin<'_, '_, R>
impl<R: LiteXSoCRegisterConfiguration> Input for LiteXGPIOPin<'_, '_, R>
Source§fn read(&self) -> bool
fn read(&self) -> bool
Get the current state of an input GPIO pin. For an output
pin, return the output; for an input pin, return the input;
for disabled or function pins the value is undefined.
Source§fn read_activation(&self, mode: ActivationMode) -> ActivationState
fn read_activation(&self, mode: ActivationMode) -> ActivationState
Get the current state of a GPIO pin, for a given activation mode.
Source§impl<'client, R: LiteXSoCRegisterConfiguration> Interrupt<'client> for LiteXGPIOPin<'_, 'client, R>
impl<'client, R: LiteXSoCRegisterConfiguration> Interrupt<'client> for LiteXGPIOPin<'_, 'client, R>
Source§fn set_client(&self, client: &'client dyn Client)
fn set_client(&self, client: &'client dyn Client)
Set the client for interrupt events.
Source§fn is_pending(&self) -> bool
fn is_pending(&self) -> bool
Return whether this interrupt is pending
Source§fn enable_interrupts(&self, mode: InterruptEdge)
fn enable_interrupts(&self, mode: InterruptEdge)
Enable an interrupt on the GPIO pin. This does not
configure the pin except to enable an interrupt: it
should be separately configured as an input, etc.
Source§fn disable_interrupts(&self)
fn disable_interrupts(&self)
Disable interrupts for the GPIO pin.
Source§impl<R: LiteXSoCRegisterConfiguration> Output for LiteXGPIOPin<'_, '_, R>
impl<R: LiteXSoCRegisterConfiguration> Output for LiteXGPIOPin<'_, '_, R>
Source§fn set(&self)
fn set(&self)
Set the GPIO pin high. If the pin is not an output or
input/output, this call is ignored.
Source§fn clear(&self)
fn clear(&self)
Set the GPIO pin low. If the pin is not an output or
input/output, this call is ignored.
Source§fn toggle(&self) -> bool
fn toggle(&self) -> bool
Toggle the GPIO pin. If the pin was high, set it low. If
the pin was low, set it high. If the pin is not an output or
input/output, this call is ignored. Return the new value
of the pin.
Source§fn write_activation(&self, state: ActivationState, mode: ActivationMode)
fn write_activation(&self, state: ActivationState, mode: ActivationMode)
Activate or deactivate a GPIO pin, for a given activation mode.
Auto Trait Implementations§
impl<'controller, 'client, R> Freeze for LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R> !RefUnwindSafe for LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R> !Send for LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R> !Sync for LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R> Unpin for LiteXGPIOPin<'controller, 'client, R>
impl<'controller, 'client, R> !UnwindSafe for LiteXGPIOPin<'controller, 'client, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more