forked from zmkfirmware/zmk
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(split): Add full-duplex wired split support
* 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.
- Loading branch information
1 parent
fd2a15b
commit 6e7d12e
Showing
12 changed files
with
1,031 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2024 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
description: | | ||
Complete specification of wired split connetion | ||
compatible: "zmk,wired-split" | ||
|
||
properties: | ||
device: | ||
type: phandle | ||
required: true | ||
description: The UART device for wired split communication | ||
|
||
half-duplex: | ||
type: boolean | ||
description: Enable half-duplex protocol mode. | ||
|
||
dir-gpios: | ||
type: phandle-array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
# SPDX-License-Identifier: MIT | ||
|
||
rsource "bluetooth/Kconfig.defaults" | ||
rsource "wired/Kconfig.defaults" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target_sources(app PRIVATE wired.c) | ||
target_sources_ifdef(CONFIG_ZMK_SPLIT_ROLE_CENTRAL app PRIVATE central.c) | ||
target_sources_ifndef(CONFIG_ZMK_SPLIT_ROLE_CENTRAL app PRIVATE peripheral.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
if ZMK_SPLIT_WIRED | ||
|
||
choice ZMK_SPLIT_WIRED_UART_MODE_DEFAULT | ||
prompt "Default UART Mode" | ||
|
||
config ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_ASYNC | ||
bool "Async (DMA) Mode" | ||
depends on SERIAL_SUPPORT_ASYNC | ||
select UART_ASYNC_API | ||
|
||
config ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_INTERRUPT | ||
bool "Interrupt Mode" | ||
depends on SERIAL_SUPPORT_INTERRUPT | ||
select UART_INTERRUPT_DRIVEN | ||
|
||
config ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_POLLING | ||
bool "Polling Mode" | ||
|
||
endchoice | ||
|
||
if ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_POLLING | ||
|
||
config ZMK_SPLIT_WIRED_POLLING_RX_PERIOD | ||
int "Ticks between RX polls" | ||
|
||
endif | ||
|
||
if ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_ASYNC | ||
|
||
config ZMK_SPLIT_WIRED_ASYNC_RX_TIMEOUT | ||
int "RX Timeout (in microseconds) before reporting received data" | ||
|
||
endif | ||
|
||
config ZMK_SPLIT_WIRED_CMD_BUFFER_ITEMS | ||
int "Number of central commands to buffer for TX/RX" | ||
|
||
config ZMK_SPLIT_WIRED_EVENT_BUFFER_ITEMS | ||
int "Number of peripheral events to buffer for TX/RX" | ||
|
||
config ZMK_SPLIT_WIRED_HALF_DUPLEX_RX_TIMEOUT | ||
int "RX timeout (in ticks) when polling peripheral(s)" | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
if ZMK_SPLIT_WIRED | ||
|
||
config ZMK_SPLIT_WIRED_CMD_BUFFER_ITEMS | ||
default 4 | ||
|
||
config ZMK_SPLIT_WIRED_EVENT_BUFFER_ITEMS | ||
default 16 | ||
|
||
|
||
if ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_POLLING | ||
|
||
config ZMK_SPLIT_WIRED_POLLING_RX_PERIOD | ||
default 10 | ||
|
||
endif | ||
|
||
|
||
if ZMK_SPLIT_WIRED_UART_MODE_DEFAULT_ASYNC | ||
|
||
config ZMK_SPLIT_WIRED_ASYNC_RX_TIMEOUT | ||
default 100 | ||
|
||
endif | ||
|
||
config ZMK_SPLIT_WIRED_HALF_DUPLEX_RX_TIMEOUT | ||
default 50 | ||
|
||
endif |
Oops, something went wrong.