Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Full-Duplex Wired Split #2766

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Jan 14, 2025

Opening this as a draft for now, pending more extensive testing, documentation, etc.

I've tested this with a very basic ZMK Uno setup, but nothing extensive dailying on a keyboard, etc.

Preview docs: https://deploy-preview-2766--zmk.netlify.app/docs/config/split#wired-splits

Has gotten a fair amount of testing at this point, so moving this out of Draft.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

Other To-Dos

  • Investigate report of stuck/broken taps on peripheral Cirque. Recovered by restarting left side only.
  • Address stack size issues for RP2040 exacerbated by this PR?

@petejohanson petejohanson added enhancement New feature or request split labels Jan 14, 2025
@petejohanson petejohanson self-assigned this Jan 14, 2025
@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch 6 times, most recently from ffd742c to 47b7001 Compare January 17, 2025 22:07
@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from 45d95af to be7ded8 Compare January 21, 2025 23:52
@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from 3fea122 to 6baa960 Compare February 1, 2025 03:54
@caksoylar
Copy link
Contributor

Related: #1110.

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch 5 times, most recently from 64ce23f to acd57d2 Compare February 10, 2025 18:32
Copy link
Contributor

@Nick-Munnich Nick-Munnich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of notes on the first commit. Haven't dealt with the split ble code bits enough to be a trustworthy reviewer there, but those bits look fine at a glance.

Not looked at the second commit at all.

}
}

int zmk_split_central_invoke_behavior(uint8_t source, struct zmk_behavior_binding *binding,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int zmk_split_central_invoke_behavior(uint8_t source, struct zmk_behavior_binding *binding,
int zmk_split_central_invoke_behavior(uint8_t target, struct zmk_behavior_binding *binding,

Minor suggestion, but I just remembered thinking the other day that this name for this variable (and similar variables in functions around the transport) would be nicer. Feel free to ignore and hit resolve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on the fence on this one... It requires just a tad bit more mental load to understand source/target are the same thing, just from different perspectives, but I can see where you are coming from. Leaving unresolved for now to sleep on it. Thanks.

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch 3 times, most recently from b365a19 to c10e8fe Compare February 14, 2025 22:51
@petejohanson petejohanson marked this pull request as ready for review February 14, 2025 22:56
@petejohanson petejohanson requested review from a team as code owners February 14, 2025 22:56
@petejohanson
Copy link
Contributor Author

Ok, taking this out of draft at this point, since it's gotten a fair amount of use and testing by myself and a few others. I just pushed some of the initial docs work as well, which needs review still.

Copy link
Contributor

@Nick-Munnich Nick-Munnich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments on the docs.

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from fb46879 to 6b09605 Compare February 18, 2025 20:51
Copy link
Contributor

@Nick-Munnich Nick-Munnich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments. Still working my way through codey-bits slowly, but can't seem to write two reviews at the same time.

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from 484ce4e to 3e71bc8 Compare February 19, 2025 23:18
@caksoylar
Copy link
Contributor

Note for docs: https://zmk.dev/docs/faq#does-zmk-support-wired-split needs to be updated (in this PR or a future one)

@petejohanson
Copy link
Contributor Author

Note for docs: https://zmk.dev/docs/faq#does-zmk-support-wired-split needs to be updated (in this PR or a future one)

Tweaked that note, would appreciate feedback. Thanks!


:::warning[Hot Plugging Cables]

Many popular cables, in particular, TRRS/TRS cables, can cause irreparable damage to controllers if they are inserted or removed when power is already present on them. Whether or not you are using the wired split functionality or not, _never_ insert or remove such a cable when a controller is powered by USB _or_ battery.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Many popular cables, in particular, TRRS/TRS cables, can cause irreparable damage to controllers if they are inserted or removed when power is already present on them. Whether or not you are using the wired split functionality or not, _never_ insert or remove such a cable when a controller is powered by USB _or_ battery.
Many popular wired interconnects used between split keyboards, in particular, TRRS/TRS cables, can cause irreparable damage to controllers if they are inserted or removed when power is already present on them. Whether or not you are using the wired split functionality or not, _never_ insert or remove such a cable when a controller is powered by USB _or_ battery.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on the fence using "interconnect" here since we use that term elsewhere to describe board/shield abstractions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, maybe something like "physical connectors" instead of "wired interconnects"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think this particular warning should be made more specific, not less, as this problem specifically affects TRS-style cables. Things like USB, RJ45, MIDI, etc are all exempt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think this particular warning should be made more specific, not less, as this problem specifically affects TRS-style cables. Things like USB, RJ45, MIDI, etc are all exempt.

Beyond my original wording?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but I was thinking about it a bunch yesterday and I couldn't find a phrasing I liked. Essentially making the warning sound more explicit towards the "bad" cable types, rather than warning against all. I think it's fine as-is though.

What I was also considering is a "unless explicitly stated otherwise by the designer" because I think you can create a circuit which doesn't have this sort of flaw. I worry that might overcomplicate the warning and invite lots of questions from inexperienced folks though, opening up a can of worms we dont want to tackle (yet)

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from 339ad0d to 76f97ef Compare February 20, 2025 18:17
Copy link
Contributor

@caksoylar caksoylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last note, otherwise docs LGTM.

@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from f165bbd to c72ec43 Compare February 21, 2025 18:30
Copy link
Contributor

@Nick-Munnich Nick-Munnich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last pair of minor queries from me. I think it's unlikely I'll notice any further things from looking at it more.

I will say I don't think this should be merged until we've had another release, which I consider #2729 to be a prerequisite for.

Copy link

@paulshir paulshir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving comments here as opposed to discord as it's easier to point to the issues. Tested and debugged the latest changes in polling mode with a rpi pico. Events and commands working with the changes I commented on here.

petejohanson and others added 6 commits March 2, 2025 17:34
Extract central/peripheral code to allow for plugging in alternate
transports, instead of tying all split logic to BT.
* Depends on full-duplex hardware UART for communication.
* Supports all existing central commands/peripheral events, including
  sensors/inputs from peripherals.
* Only one wired split peripheral supported (for now)
* Relies on chosen `zmk,split-uart` referencing the UART device.
Migrate split to its own dedicated config file, and add details
on wired split config.

Co-authored-by: Nicolas Munnich <[email protected]>
Move the system work queue stack size override on RP2040 ouf of
a `ZMK_BLE` conditional so it is properly applied generally for that
SoC.
@petejohanson petejohanson force-pushed the split/wired-split-first-pass branch from c00c7c6 to 4843ce1 Compare March 2, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request split
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants