Firmware

Firmware Design Overview

A summary of the split keyboard firmware design built around QMK, RP2040, MCP I/O expanders, mirror layers, and Raw HID integration.

Overview

Control Program Overview

This firmware is a QMK-based control program designed for the Take&Clock Works split keyboard. With an RP2040 at the center, it reads the left and right key matrices through I2C-connected MCP I/O expanders and operates as a 4-row by 14-column split keyboard. In addition to normal Japanese-layout input, it includes Fn layers, a symbol layer, and mirror layers for one-handed input. Even though it is a left-right split keyboard, the right-hand layout can be mirrored onto the left-hand side so that the main keys can still be used with one hand.

Firmware design overview diagram

Features

Main Features

  • Keyboard control using RP2040 and QMK Firmware
  • A 4-row by 14-column key matrix, with 7 columns on each side
  • Left and right key scanning through I2C-connected MCP I/O expanders
  • Base / Fn1 / Fn2 layers for Japanese-layout input
  • Mirror layers for one-handed input
  • Custom Fn key behavior that separates short press and long press actions
  • Layer state notification for external applications through Raw HID

Layers

Layer Design

The keymap is built from six layers. Internally, the current input state is managed as a Base / Fn1 / Fn2 slot plus a Normal / Mirror mode. This keeps normal input and one-handed input under the same switching model.

  • Base: normal Japanese QWERTY input
  • Fn1: numbers, function keys, and navigation keys
  • Fn2: symbol input
  • Base Mirror: mirrored normal input for one-handed use
  • Fn1 Mirror: mirrored numbers and function keys
  • Fn2 Mirror: mirrored symbol keys

Fn Keys

Fn Key Behavior

The firmware defines three custom Fn keys and gives each one a separate short-press and long-press role. A short press changes the keyboard's own input layer, while a press of one second or longer sends F21 through F23. This lets the same physical keys handle both keyboard-side operation and host-side application integration.

  • FN1: short press switches the Fn1 layer, long press sends F21
  • FN2: short press switches the Fn2 layer, long press sends F22
  • FN3: short press switches Mirror mode, long press sends F23

Integration

External Integration

Raw HID is used to notify an external application of the current keyboard state. The notification includes whether Mirror mode is active, the current layer slot, and the actual active layer number. This makes it possible for a PC-side application or Web UI to show which layer is currently active, or to display support information that follows the keyboard state. The firmware is also designed to work with a dedicated resident layer-display app by having the keyboard report its current state to the host side.

Hardware

Hardware Control

The key matrix scan is implemented in a custom matrix.c. The left I/O expander is handled as 0x20 and the right one as 0x21. Columns are pulled Low one by one, and row inputs are read for each column. If the right-side unit is not found during startup, the firmware keeps trying to reconnect at intervals, which improves recovery and day-to-day usability as a split keyboard.

A separate explanation page for the dedicated resident layer-display app is planned. For the actual implementation, check the key assignments, matrix positions, and I2C addresses together across the wiring diagram, keymap.c, matrix.c, and config.h.