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.
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.
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 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.