pub struct GPIOPin<'a> { /* private fields */ }
Implementations§
Source§impl<'a> GPIOPin<'a>
impl<'a> GPIOPin<'a>
pub const fn new(pin: Pin) -> GPIOPin<'a>
pub fn set_client(&self, client: &'a dyn Client)
pub fn select_peripheral(&self, function: PeripheralFunction)
pub fn enable(&self)
pub fn disable(&self)
pub fn is_pending(&self) -> bool
pub fn enable_output(&self)
pub fn disable_output(&self)
pub fn enable_pull_down(&self)
pub fn disable_pull_down(&self)
pub fn enable_pull_up(&self)
pub fn disable_pull_up(&self)
Sourcepub fn set_interrupt_mode(&self, mode: u8)
pub fn set_interrupt_mode(&self, mode: u8)
Sets the interrupt mode registers. Interrupts may fire on the rising or falling edge of the pin or on both.
The mode is a two-bit value based on the mapping from section 23.7.13 of the SAM4L datasheet (page 563):
mode value | Interrupt Mode |
---|---|
0b00 | Pin change |
0b01 | Rising edge |
0b10 | Falling edge |
pub fn enable_interrupt(&self)
pub fn disable_interrupt(&self)
pub fn handle_interrupt(&self)
pub fn disable_schmidtt_trigger(&self)
pub fn enable_schmidtt_trigger(&self)
pub fn read(&self) -> bool
pub fn toggle(&self) -> bool
pub fn set(&self)
pub fn clear(&self)
Trait Implementations§
Source§impl Configure for GPIOPin<'_>
impl Configure for GPIOPin<'_>
Source§fn set_floating_state(&self, mode: FloatingState)
fn set_floating_state(&self, mode: FloatingState)
Set the floating state of the pin.
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 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 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_output(&self) -> Configuration
fn disable_output(&self) -> Configuration
Disable the pin as an output, returning the current configuration.
Source§fn disable_input(&self) -> Configuration
fn disable_input(&self) -> Configuration
Disable the pin as an input, returning the current configuration.
Source§fn is_input(&self) -> bool
fn is_input(&self) -> bool
Return whether the pin is an input (reading from
the Input trait will return valid results). Returns
true if the pin is in Configuration::Input or
Configuration::InputOutput.
Source§fn is_output(&self) -> bool
fn is_output(&self) -> bool
Return whether the pin is an output (writing to
the Output trait will change the output of the pin).
Returns true if the pin is in Configuration::Output or
Configuration::InputOutput.
Source§fn floating_state(&self) -> FloatingState
fn floating_state(&self) -> FloatingState
Return the current floating state of the pin.
Source§fn configuration(&self) -> Configuration
fn configuration(&self) -> Configuration
Return the current pin configuration.
Source§impl Controller for GPIOPin<'_>
impl Controller for GPIOPin<'_>
Source§impl Input for GPIOPin<'_>
impl Input for GPIOPin<'_>
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<'a> Interrupt<'a> for GPIOPin<'a>
impl<'a> Interrupt<'a> for GPIOPin<'a>
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§fn set_client(&self, client: &'a dyn Client)
fn set_client(&self, client: &'a 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§impl Output for GPIOPin<'_>
impl Output for GPIOPin<'_>
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 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 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<'a> !Freeze for GPIOPin<'a>
impl<'a> !RefUnwindSafe for GPIOPin<'a>
impl<'a> !Send for GPIOPin<'a>
impl<'a> !Sync for GPIOPin<'a>
impl<'a> Unpin for GPIOPin<'a>
impl<'a> !UnwindSafe for GPIOPin<'a>
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