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
impl ExampleKeypad
Sourcepub fn decompose<'a>(&'a self) -> [[KeypadInput<'a, Infallible>; 5]; 4]
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.
Sourcepub 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>>>))
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§
impl !Freeze for ExampleKeypad
impl !RefUnwindSafe for ExampleKeypad
impl Send for ExampleKeypad
impl !Sync for ExampleKeypad
impl Unpin for ExampleKeypad
impl UnwindSafe for ExampleKeypad
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