Skip to content

feat: split: add asymmetric geometry support via split_mapping - #1136

Open
haricane8133 wants to merge 3 commits into
KMKfw:mainfrom
haricane8133:main
Open

haricane8133 wants to merge 3 commits into
KMKfw:mainfrom
haricane8133:main

Conversation

@haricane8133

Copy link
Copy Markdown

This change adds first-class asymmetric split support to KMK Split using one new optional parameter: split_mapping.

Current split auto-mapping is symmetric-oriented and assumes equivalent geometry across halves. Asymmetric keyboards require fragile workarounds (dummy matrix definitions or hand-crafted mappings).

Add split_mapping as a single, additive configuration input. When provided, Split computes keyboard.coord_mapping internally from geometry.

split_mapping fields:

  • rows

  • left_cols

  • right_cols

  • right_start (optional, for custom logical indexing schemes)

  • split_flip (optional)

  • If split_mapping is present: use computed asymmetric mapping.

  • If absent: preserve current auto-mapping behavior.

  • Backward-compatible for existing users.

  • No transport behavior changes.

  • Existing split configs continue to work unchanged.

  1. PR Description (KMK clean)

Adds asymmetric split mapping support to KMK Split through a single optional parameter: split_mapping.

Split auto-mapping currently favors symmetric geometries. Asymmetric builds often need fragile setup patterns (dummy definitions/manual mappings), which increases user error and maintenance cost.

split = Split(
    split_type=SplitType.UART,
    split_side=SplitSide.LEFT,   # or RIGHT
    split_target_left=True,
    split_mapping={
        "rows": 6,
        "left_cols": 7,
        "right_cols": 11,
        "right_start": 66,       # optional
        "split_flip": False,     # optional
    },
    data_pin=...,
    data_pin2=...,
)

- Add split_mapping to Split.
- Add internal mapping generation for asymmetric geometry.
- During boot, if split_mapping exists, compute and set keyboard.coord_mapping.
- Keep existing auto-mapping path unchanged when split_mapping is not supplied.

- Additive API only.
- Existing split users are unaffected unless they opt in.

- Verified successful firmware compile.
- Verified asymmetric left/right mapping correctness in a real split setup.

Parrot90 integration example: https://github.com/haricane8133/parrot90

haricane8133 added a commit to haricane8133/parrot90 that referenced this pull request Mar 22, 2026
…around

This commit updates Parrot90 split firmware to use the newly introduced
KMK asymmetric split mapping support via `split_mapping`.

We have raised a PR to KMK here -
KMKfw/kmk_firmware#1136

- Replaced manual/dummy asymmetric split handling with `split_mapping` in both halves.
- Removed dependency on padded/dummy matrix assumptions for split compatibility.
- Kept existing keymap indexing behavior by explicitly setting right-half base index.
- Updated split config on both `code_L.py` and `code_R.py` to use:
  - `rows`
  - `left_cols`
  - `right_cols`
  - `right_start`
  - `split_flip`

The previous approach required brittle matrix padding; large static mapping assumptions.
This new config is explicit, easier, and directly models the physical keyboard geometry.

- Left-half mapping verified.
- Right-half mapping corrected and verified after right-side base alignment.
- Firmware compiles successfully after changes.
@regicidalplutophage

Copy link
Copy Markdown
Member

We do have a mechanism which allows for asymmetric splits. It may not be very intuitive but it also allows for empty matrix intersections, which your PR doesn't seem to.

This change adds first-class asymmetric split support to KMK `Split`
using one new optional parameter: `split_mapping`.

Current split auto-mapping is symmetric-oriented and assumes equivalent geometry across halves.
Asymmetric keyboards require fragile workarounds (dummy matrix definitions or hand-crafted mappings).

Add `split_mapping` as a single, additive configuration input.
When provided, `Split` computes `keyboard.coord_mapping` internally from geometry.

`split_mapping` fields:
- `rows`
- `left_cols`
- `right_cols`
- `right_start` (optional, for custom logical indexing schemes)
- `split_flip` (optional)

- If `split_mapping` is present: use computed asymmetric mapping.
- If absent: preserve current auto-mapping behavior.

- Backward-compatible for existing users.
- No transport behavior changes.
- Existing split configs continue to work unchanged.

3) PR Description (KMK clean)

Adds asymmetric split mapping support to KMK `Split`
through a single optional parameter: `split_mapping`.

Split auto-mapping currently favors symmetric geometries.
Asymmetric builds often need fragile setup patterns (dummy definitions/manual mappings),
which increases user error and maintenance cost.

```python
split = Split(
    split_type=SplitType.UART,
    split_side=SplitSide.LEFT,   # or RIGHT
    split_target_left=True,
    split_mapping={
        "rows": 6,
        "left_cols": 7,
        "right_cols": 11,
        "right_start": 66,       # optional
        "split_flip": False,     # optional
    },
    data_pin=...,
    data_pin2=...,
)

- Add split_mapping to Split.
- Add internal mapping generation for asymmetric geometry.
- During boot, if split_mapping exists, compute and set keyboard.coord_mapping.
- Keep existing auto-mapping path unchanged when split_mapping is not supplied.

- Additive API only.
- Existing split users are unaffected unless they opt in.

- Verified successful firmware compile.
- Verified asymmetric left/right mapping correctness in a real split setup.

Parrot90 integration example: https://github.com/haricane8133/parrot90
@haricane8133
haricane8133 force-pushed the main branch 2 times, most recently from c76c849 to ddb3f4c Compare September 13, 2026 13:01
KMK already supports asymmetric splits via a hand-written keyboard.coord_mapping;
a documented example is a better fit than a new Split parameter.

This reverts commit e7cef4b7ce40c3fe1d92e3fd4bc5cc1fdbf5c7ee.
@haricane8133

Copy link
Copy Markdown
Author

@regicidalplutophage, yes you are right. I have reverted my commit and made just a docs change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants