kernel::hil::gpio

Struct InterruptValueWrapper

Source
pub struct InterruptValueWrapper<'a, IP: InterruptPin<'a>> { /* private fields */ }
Expand description

Standard implementation of InterruptWithValue: handles an gpio::Client::fired and passes it up as a gpio::ClientWithValue::fired.

Implementations§

Source§

impl<'a, IP: InterruptPin<'a>> InterruptValueWrapper<'a, IP>

Source

pub fn new(pin: &'a IP) -> Self

Source

pub fn finalize(&'static self) -> &'static Self

Trait Implementations§

Source§

impl<'a, IP: InterruptPin<'a>> Client for InterruptValueWrapper<'a, IP>

Source§

fn fired(&self)

Called when an interrupt occurs. The identifier will be the same value that was passed to enable_interrupt() when the interrupt was configured.
Source§

impl<'a, IP: InterruptPin<'a>> Configure for InterruptValueWrapper<'a, IP>

Source§

fn configuration(&self) -> Configuration

Return the current pin configuration.
Source§

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

Disable the pin as an output, returning the current configuration.
Source§

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

Disable the pin as an input, returning the current configuration.
Source§

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)

Set the floating state of the pin.
Source§

fn floating_state(&self) -> FloatingState

Return the current floating state of the pin.
Source§

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

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§

impl<'a, IP: InterruptPin<'a>> Input for InterruptValueWrapper<'a, IP>

Source§

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

Get the current state of a GPIO pin, for a given activation mode.
Source§

impl<'a, IP: InterruptPin<'a>> InterruptWithValue<'a> for InterruptValueWrapper<'a, IP>

Source§

fn set_value(&self, value: u32)

Set the value that will be passed to clients on an interrupt.
Source§

fn value(&self) -> u32

Return the value that is passed to clients on an interrupt.
Source§

fn set_client(&self, client: &'a dyn ClientWithValue)

Set the client for interrupt events.
Source§

fn is_pending(&self) -> bool

Return whether this interrupt is pending
Source§

fn enable_interrupts(&self, edge: InterruptEdge) -> Result<(), ErrorCode>

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. Returns: Ok(()) - the interrupt was set up properly FAIL - the interrupt was not set up properly; this is due to not having an underlying interrupt source yet, i.e. the struct is not yet fully initialized.
Source§

fn disable_interrupts(&self)

Disable interrupts for the GPIO pin.
Source§

impl<'a, IP: InterruptPin<'a>> Output for InterruptValueWrapper<'a, IP>

Source§

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)

Set the GPIO pin low. If the pin is not an output or input/output, this call is ignored.
Source§

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)

Activate or deactivate a GPIO pin, for a given activation mode.

Auto Trait Implementations§

§

impl<'a, IP> !Freeze for InterruptValueWrapper<'a, IP>

§

impl<'a, IP> !RefUnwindSafe for InterruptValueWrapper<'a, IP>

§

impl<'a, IP> !Send for InterruptValueWrapper<'a, IP>

§

impl<'a, IP> !Sync for InterruptValueWrapper<'a, IP>

§

impl<'a, IP> Unpin for InterruptValueWrapper<'a, IP>

§

impl<'a, IP> !UnwindSafe for InterruptValueWrapper<'a, IP>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T> InterruptValuePin<'a> for T
where T: Pin + InterruptWithValue<'a>,

Source§

impl<T> Pin for T
where T: Input + Output + Configure,