Skip to content

Commit 0bcd50b

Browse files
committed
refactor(split): move and rename Kconfig options
1 parent d89ec53 commit 0bcd50b

File tree

5 files changed

+42
-34
lines changed

5 files changed

+42
-34
lines changed

app/src/split/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,30 @@ if ZMK_SPLIT
99
config ZMK_SPLIT_ROLE_CENTRAL
1010
bool "Split central device"
1111

12+
if ZMK_SPLIT_ROLE_CENTRAL
13+
14+
config ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE
15+
int "Max number of key position state events to queue when received from peripherals"
16+
default 5
17+
18+
endif # ZMK_SPLIT_ROLE_CENTRAL
19+
20+
if !ZMK_SPLIT_ROLE_CENTRAL
21+
22+
config ZMK_SPLIT_PERIPHERAL_STACK_SIZE
23+
int "Split peripheral notify thread stack size"
24+
default 650
25+
26+
config ZMK_SPLIT_PERIPHERAL_PRIORITY
27+
int "Split peripheral notify thread priority"
28+
default 5
29+
30+
config ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE
31+
int "Max number of key position state events to queue to send to the central"
32+
default 10
33+
34+
endif #!ZMK_SPLIT_ROLE_CENTRAL
35+
1236
choice ZMK_SPLIT_TRANSPORT
1337
prompt "Split transport"
1438

app/src/split/bluetooth/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ config ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
2222
int "Number of peripherals that will connect to the central."
2323
default 1
2424

25-
config ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE
26-
int "Max number of key position state events to queue when received from peripherals"
27-
default 5
28-
2925
config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE
3026
int "BLE split central write thread stack size"
3127
default 512
@@ -50,18 +46,6 @@ endif # ZMK_SPLIT_ROLE_CENTRAL
5046

5147
if !ZMK_SPLIT_ROLE_CENTRAL
5248

53-
config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE
54-
int "BLE split peripheral notify thread stack size"
55-
default 650
56-
57-
config ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY
58-
int "BLE split peripheral notify thread priority"
59-
default 5
60-
61-
config ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE
62-
int "Max number of key position state events to queue to send to the central"
63-
default 10
64-
6549
config BT_MAX_PAIRED
6650
default 1
6751

app/src/split/central.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
1616

1717
K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed),
18-
CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4);
18+
CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE, 4);
1919

2020
void peripheral_event_work_callback(struct k_work *work) {
2121
struct zmk_position_state_changed ev;
@@ -34,7 +34,7 @@ void zmk_position_state_change_handle(struct zmk_position_state_changed *ev) {
3434

3535
#if ZMK_KEYMAP_HAS_SENSORS
3636
K_MSGQ_DEFINE(peripheral_sensor_event_msgq, sizeof(struct zmk_sensor_event),
37-
CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4);
37+
CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE, 4);
3838

3939
void peripheral_sensor_event_work_callback(struct k_work *work) {
4040
struct zmk_sensor_event ev;

app/src/split/service.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ static uint8_t position_state[ZMK_SPLIT_POS_STATE_LEN];
2020
static struct sensor_event last_sensor_event;
2121
#endif
2222

23-
K_THREAD_STACK_DEFINE(service_q_stack, CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE);
23+
K_THREAD_STACK_DEFINE(service_q_stack, CONFIG_ZMK_SPLIT_PERIPHERAL_STACK_SIZE);
2424

2525
struct k_work_q service_work_q;
2626

2727
K_MSGQ_DEFINE(position_state_msgq, sizeof(char[ZMK_SPLIT_POS_STATE_LEN]),
28-
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
28+
CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
2929

3030
void send_position_state_callback(struct k_work *work) {
3131
uint8_t state[ZMK_SPLIT_POS_STATE_LEN];
@@ -70,7 +70,7 @@ int zmk_split_position_released(uint8_t position) {
7070

7171
#if ZMK_KEYMAP_HAS_SENSORS
7272
K_MSGQ_DEFINE(sensor_state_msgq, sizeof(struct sensor_event),
73-
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
73+
CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
7474

7575
void send_sensor_state_callback(struct k_work *work) {
7676
while (k_msgq_get(&sensor_state_msgq, &last_sensor_event, K_NO_WAIT) == 0) {
@@ -120,7 +120,7 @@ int service_init(const struct device *_arg) {
120120
static const struct k_work_queue_config queue_config = {
121121
.name = "Split Peripheral Notification Queue"};
122122
k_work_queue_start(&service_work_q, service_q_stack, K_THREAD_STACK_SIZEOF(service_q_stack),
123-
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY, &queue_config);
123+
CONFIG_ZMK_SPLIT_PERIPHERAL_PRIORITY, &queue_config);
124124

125125
return 0;
126126
}

docs/docs/config/system.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ Note that `CONFIG_BT_MAX_CONN` and `CONFIG_BT_MAX_PAIRED` should be set to the s
104104

105105
Following split keyboard settings are defined in [zmk/app/src/split/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/Kconfig) (generic) and [zmk/app/src/split/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/src/split/bluetooth/Kconfig) (bluetooth).
106106

107-
| Config | Type | Description | Default |
108-
| ----------------------------------------------------- | ---- | ------------------------------------------------------------------------ | ------- |
109-
| `CONFIG_ZMK_SPLIT` | bool | Enable split keyboard support | n |
110-
| `CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS` | bool | Enable split keyboard support for passing indicator state to peripherals | n |
111-
| `CONFIG_ZMK_SPLIT_BLE` | bool | Use BLE to communicate between split keyboard halves | y |
112-
| `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` | bool | `y` for central device, `n` for peripheral | |
113-
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 |
114-
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
115-
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE` | int | Max number of behavior run events to queue to send to the peripheral(s) | 5 |
116-
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE` | int | Stack size of the BLE split peripheral notify thread | 650 |
117-
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY` | int | Priority of the BLE split peripheral notify thread | 5 |
118-
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue to send to the central | 10 |
107+
| Config | Type | Description | Default |
108+
| --------------------------------------------------- | ---- | ------------------------------------------------------------------------ | ------- |
109+
| `CONFIG_ZMK_SPLIT` | bool | Enable split keyboard support | n |
110+
| `CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS` | bool | Enable split keyboard support for passing indicator state to peripherals | n |
111+
| `CONFIG_ZMK_SPLIT_BLE` | bool | Use BLE to communicate between split keyboard halves | y |
112+
| `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` | bool | `y` for central device, `n` for peripheral | |
113+
| `CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 |
114+
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
115+
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE` | int | Max number of behavior run events to queue to send to the peripheral(s) | 5 |
116+
| `CONFIG_ZMK_SPLIT_PERIPHERAL_STACK_SIZE` | int | Stack size of the split peripheral notify thread | 650 |
117+
| `CONFIG_ZMK_SPLIT_PERIPHERAL_PRIORITY` | int | Priority of the split peripheral notify thread | 5 |
118+
| `CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue to send to the central | 10 |

0 commit comments

Comments
 (0)