Skip to main content

EncoderSwitch

Struct EncoderSwitch 

Source
pub struct EncoderSwitch<'peripherals> {
    col: u8,
    debounce: Duration,
    last_pressed: bool,
    pin: ExtiInput<'peripherals, Async>,
    row: u8,
}
Expand description

Debounced encoder switch exposed as an input device.

Fields§

§col: u8

Logical column index reported to the input system.

§debounce: Duration

Debounce duration applied to state changes.

§last_pressed: bool

Last debounced logical state of the switch.

§pin: ExtiInput<'peripherals, Async>

External interrupt–backed input pin for the switch.

§row: u8

Logical row index reported to the input system.

Implementations§

Source§

impl<'peripherals> EncoderSwitch<'peripherals>

Source

pub const fn new(pin: ExtiInput<'peripherals, Async>, row: u8, col: u8) -> Self

Create a new encoder switch input wrapper.

Source

async fn read_keyboard_event(&mut self) -> KeyboardEvent

Wait for the next debounced encoder switch event.

Trait Implementations§

Source§

impl<'peripherals> InputDevice for EncoderSwitch<'peripherals>

Source§

type Event = KeyboardEvent

The event type produced by this input device
Source§

async fn read_event(&mut self) -> Self::Event

Read the raw input event
Source§

impl<'peripherals> Runnable for EncoderSwitch<'peripherals>

Source§

async fn run(&mut self) -> !

Auto Trait Implementations§

§

impl<'peripherals> Freeze for EncoderSwitch<'peripherals>

§

impl<'peripherals> RefUnwindSafe for EncoderSwitch<'peripherals>

§

impl<'peripherals> Send for EncoderSwitch<'peripherals>

§

impl<'peripherals> Sync for EncoderSwitch<'peripherals>

§

impl<'peripherals> Unpin for EncoderSwitch<'peripherals>

§

impl<'peripherals> UnsafeUnpin for EncoderSwitch<'peripherals>

§

impl<'peripherals> !UnwindSafe for EncoderSwitch<'peripherals>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.