Trait rumcake::keyboard::KeyboardMatrix
source · pub trait KeyboardMatrix {
type Layout: MaybeKeyboardLayout = EmptyKeyboardLayout;
type PeripheralDeviceType: MaybePeripheralDevice = EmptyPeripheralDevice;
const MATRIX_COLS: usize;
const MATRIX_ROWS: usize;
const DEBOUNCE_MS: u16 = 5u16;
// Required method
fn get_matrix() -> &'static PollableMatrix<impl Pollable>;
// Provided method
fn remap_to_layout(row: u8, col: u8) -> (u8, u8) { ... }
}
Expand description
A trait that must be implemented for any device that needs to poll a switch matrix.
Provided Associated Types§
sourcetype PeripheralDeviceType: MaybePeripheralDevice = EmptyPeripheralDevice
type PeripheralDeviceType: MaybePeripheralDevice = EmptyPeripheralDevice
The peripheral device in a split keyboard setup to send matrix events to.
Required Associated Constants§
sourceconst MATRIX_COLS: usize
const MATRIX_COLS: usize
Number of matrix columns.
It is recommended to use one of the build_*_matrix
macros to set this constant.
sourceconst MATRIX_ROWS: usize
const MATRIX_ROWS: usize
Number of matrix rows.
It is recommended to use one of the build_*_matrix
macros to set this constant.
Provided Associated Constants§
sourceconst DEBOUNCE_MS: u16 = 5u16
const DEBOUNCE_MS: u16 = 5u16
Debounce setting.
Required Methods§
sourcefn get_matrix() -> &'static PollableMatrix<impl Pollable>
fn get_matrix() -> &'static PollableMatrix<impl Pollable>
Create the keyboard matrix by initializing a set of GPIO pins to use for columns and rows.
It is recommended to use one of the build_*_matrix
macros to set this constant.
Provided Methods§
sourcefn remap_to_layout(row: u8, col: u8) -> (u8, u8)
fn remap_to_layout(row: u8, col: u8) -> (u8, u8)
Optional function to remap a matrix position to a position on the keyboard layout defined
by KeyboardLayout::get_layout
.
This is useful in split keyboard setups, where all peripherals have a matrix, but only one of the devices stores the overall keyboard layout.