This section covers the basic keyboard identification and physical matrix configuration in your keyboard.toml file.
The [matrix] section defines your keyboard's physical key matrix wiring. This tells RMK which GPIO pins connect to your key switches.
Skip [matrix] section for split keyboards. Use the [split.central/peripheral.matrix] section to define matrix configuration for split central and peripherals.
A keyboard matrix uses diodes to enable multiple key detection. Here's how it works:
By default, RMK assumes that your pins are col2row, meaning that the output pins (anodes) represent the columns and the input pins (cathodes) represent the rows. If your schematic shows the opposite, you need to change the configuration to row2col
For keyboards using a traditional diode matrix:
GPIO pin names vary by microcontroller. Here are the correct formats for each supported chip series:
Examples by Chip Series:
PA0, PB1, PC2, etc.P0_00, P0_01, P1_15, etc.PIN_0, PIN_1, PIN_28, etc.GPIO0, GPIO1, GPIO21, etc.Finding Pin Names:
embassy-stm32/stm32h750xb)
RMK supports two matrix types:
For keyboards where each switch connects directly to a GPIO pin (no matrix):
Direct Pin Behavior:
true (default): The pin is pulled high by default, pressing a key pulls it to lowfalse: The pin is pulled low by default, pressing a key pulls it to high"_" or "trns" for unused positions in the matrixRMK has two debouncer modes, "default" and "fast":
If no debouncer is set, the matrix will default to default mode.
[host] SectionFor enhanced security, Vial locks certain functions (like matrix testing) by default. You can set a key combination to unlock it. This configuration is part of the [host] section which controls host-side tools and features.
::: tip
Wrong GPIO Pin Names:
P0_00 (nRF52), PIN_0 (RP2040), PA0 (STM32), GPIO0 (ESP32)P0_09/P0_10 are used as NFC pins by default. To use it as a normal pin in matrix, you should enable corresponding features(for example, nfc-pins-as-gpio) for embassy-nrf dependency.Matrix Not Working:
row2col = true, add it to your matrix section if you needDirect Pins Not Working:
matrix_type = "direct_pin" is setdirect_pin_low_active setting matches your hardware"_" or "trns"