rumcake

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§

source

type Layout: MaybeKeyboardLayout = EmptyKeyboardLayout

The layout to send matrix events to.

source

type PeripheralDeviceType: MaybePeripheralDevice = EmptyPeripheralDevice

The peripheral device in a split keyboard setup to send matrix events to.

Required Associated Constants§

source

const MATRIX_COLS: usize

Number of matrix columns.

It is recommended to use one of the build_*_matrix macros to set this constant.

source

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§

source

const DEBOUNCE_MS: u16 = 5u16

Debounce setting.

Required Methods§

source

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§

source

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.

Object Safety§

This trait is not object safe.

Implementors§