Board Pin Control
This page exists to provide a guide to Pin Control for ZMK users and designers. Refer to Zephyr's page on Pin Control for elaboration and more details on any of the points raised here.
A basic keyboard design as introduced in the new shield guide only uses its pins for the keyboard matrix. Many keyboard designs make use of advanced components or functionality, such as displays or shift registers. This results in the keyboard making use of communication protocols such as (but not limited to) SPI, I2C, or UART. Configuring pins for the usage of advanced functionality such as drivers for the previously named protocols is referred to as "Pin Control".
The details of pin control can vary from vendor to vendor. An attempt was made to be as general as possible, but it isn't possible to cover all possible cases. The approaches for the nRF52840 and RP2040 MCUs/SoCs are documented in their entirety below. For other MCUs/SoCs, please refer to the Zephyr documentation and the examples and other files found in-tree of ZMK and ZMK's fork of Zephyr.