How opensifli/zmk works
ZMK is Zephyr-based mechanical-keyboard firmware; this fork documents a split SF32LB52 keyboard target. The principal runtime path is physical key scanning into keymap behaviors, then HID output to a host, with split transport coordinating keyboard halves. Separate capabilities include pointing input, battery/status display, and ZMK Studio. The tree establishes these subsystems, but most implementation excerpts are unavailable, so uncertain runtime connections are shown as unverified rather than asserted.
Main entry points: keymap.c Keymap state · behavior.c Behavior engine · endpoints.c Output selection · central.c Split central
Components 22
Input and mapping
- GPIO key scan
app/module/drivers/kscan/kscan_gpio_matrix.c - Matrix transform
app/src/matrix_transform.c - Keymap state
app/src/keymap.c - Combos and layers
app/src/combo.c - Behavior engine
app/src/behavior.c - Key behaviors
app/src/behaviors/behavior_hold_tap.c
Host connectivity
- HID reports
app/src/hid.c - Output selection
app/src/endpoints.c - USB HID
app/src/usb_hid.c - Bluetooth HID
app/src/hog.c
Split keyboard
- Split central
app/src/split/central.c - Split peripheral
app/src/split/peripheral.c - Bluetooth split service
app/src/split/bluetooth/service.c - Wired split central
app/src/split/wired/central.c - Wired transport
app/src/split/wired/wired.c
Status and extensions
- Pointing input
app/src/pointing/input_listener.c - Battery sensing
app/module/drivers/sensor/max17048/max17048.c - Status display
app/src/display/main.c - Status screen
app/src/display/status_screen.c - Studio keymap RPC
app/src/studio/keymap_subsystem.c
Other components
- Keyboard user
- Host device
Connections 20
- Keyboard user → GPIO key scan: presses keys
- GPIO key scan → Matrix transform: reports positions
- Matrix transform → Keymap state: maps positions
- Keymap state → Combos and layers: resolves bindings
- Keymap state → Behavior engine: dispatches behaviors
- Behavior engine → Key behaviors: runs behavior
- Behavior engine → HID reports: updates reports
- HID reports → Output selection: selects output
- Output selection → USB HID: routes USB
- Output selection → Bluetooth HID: routes Bluetooth
- USB HID → Host device: sends reports
- Bluetooth HID → Host device: sends reports
- Split central → Bluetooth split service: uses GATT service
- Split central → Wired split central: supports wired role
- Wired split central → Wired transport: uses transport
- Split peripheral → Bluetooth split service: provides service
- Pointing input → Behavior engine: feeds input
- Status display → Status screen: loads screen
app/src/display/main.c - Battery sensing → Status display: supplies status
- Studio keymap RPC → Keymap state: updates keymap