2 releases

0.1.1 Aug 2, 2021
0.1.0 Aug 2, 2021

#35 in #lcd

43 downloads per month

MIT license

325KB
106 lines

Matrix Keypad Driver

Screen

Provides an embedded Rust driver for a common numeric matrix keypad.

Example

let rows = (
    gpiob.pb15.into_pull_up_input(&mut gpiob.crh),
    gpioa.pa7.into_pull_up_input(&mut gpioa.crl),
    gpiob.pb6.into_pull_up_input(&mut gpiob.crl),
    gpioa.pa9.into_pull_up_input(&mut gpioa.crh),
);

let cols = (
    gpioa.pa8.into_open_drain_output(&mut gpioa.crh),
    gpiob.pb5.into_open_drain_output(&mut gpiob.crl),
    gpioc.pc7.into_open_drain_output(&mut gpioc.crl),
);

let mut keypad = Keypad::new(rows, cols);

let key = keypad.read_char(&mut delay);
if key != ' ' {
    ...
}

lib.rs:

Platform-agnostic driver for 3X4 numeric keypads

Provides a driver for reading from standard 3X4 keypads

Example

let rows = (
gpiob.pb15.into_pull_up_input(&mut gpiob.crh),
gpioa.pa7.into_pull_up_input(&mut gpioa.crl),
gpiob.pb6.into_pull_up_input(&mut gpiob.crl),
gpioa.pa9.into_pull_up_input(&mut gpioa.crh),
);

let cols = (
gpioa.pa8.into_open_drain_output(&mut gpioa.crh),
gpiob.pb5.into_open_drain_output(&mut gpiob.crl),
gpioc.pc7.into_open_drain_output(&mut gpioc.crl),
);

let mut keypad = Keypad::new(rows, cols);

let key = keypad.read_char(&mut delay);
if key != ' ' {
...
}

Dependencies