ExampleKeypad

Struct ExampleKeypad 

Source
pub struct ExampleKeypad { /* private fields */ }
Expand description

Example output of keypad_struct!()- for documentation purposes only!

You shouldn’t try to use ExampleKeypad outside of this crate.

This struct is the result of this macro invocation:

use mock_hal::{self, Input, OpenDrain, Output, PullUp};
use core::convert::Infallible;

keypad_struct!{
    pub struct ExampleKeypad <Error = Infallible> {
        rows: (
            mock_hal::gpioa::PA0<Input<PullUp>>,
            mock_hal::gpioa::PA1<Input<PullUp>>,
            mock_hal::gpioa::PA2<Input<PullUp>>,
            mock_hal::gpioa::PA3<Input<PullUp>>,
        ),
        columns: (
            mock_hal::gpioa::PA4<Output<OpenDrain>>,
            mock_hal::gpioa::PA5<Output<OpenDrain>>,
            mock_hal::gpioa::PA6<Output<OpenDrain>>,
            mock_hal::gpioa::PA7<Output<OpenDrain>>,
            mock_hal::gpioa::PA8<Output<OpenDrain>>,
        ),
    }
}

Implementations§

Source§

impl ExampleKeypad

Source

pub fn decompose<'a>(&'a self) -> [[KeypadInput<'a, Infallible>; 5]; 4]

Get a 2d array of embedded-hal input pins, each representing one key in the keypad matrix.

Source

pub fn release( self, ) -> ((PA0<Input<PullUp>>, PA1<Input<PullUp>>, PA2<Input<PullUp>>, PA3<Input<PullUp>>), (RefCell<PA4<Output<OpenDrain>>>, RefCell<PA5<Output<OpenDrain>>>, RefCell<PA6<Output<OpenDrain>>>, RefCell<PA7<Output<OpenDrain>>>, RefCell<PA8<Output<OpenDrain>>>))

Give back ownership of the row and column pins.

This consumes the keypad struct. All references to its virtual KeypadInput pins must have gone out of scope before you try to call .release(), or it will fail to compile.

The column pins will be returned inside of RefCells (because macros are hard). You can use .into_inner() to extract each column pin from its RefCell.

Auto Trait Implementations§

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.