refactor(split): move and rename Kconfig options
This commit is contained in:
parent
07bc3b6a9e
commit
5f0c8af83e
7 changed files with 61 additions and 43 deletions
|
@ -6,9 +6,49 @@ menuconfig ZMK_SPLIT
|
|||
|
||||
if ZMK_SPLIT
|
||||
|
||||
config ZMK_SPLIT_INIT_PRIORITY
|
||||
int "Split Init Priority"
|
||||
default 50
|
||||
|
||||
config ZMK_SPLIT_ROLE_CENTRAL
|
||||
bool "Split central device"
|
||||
|
||||
if ZMK_SPLIT_ROLE_CENTRAL
|
||||
|
||||
config ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE
|
||||
int "Max number of key position state events to queue when received from peripherals"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE
|
||||
int "Split central write thread stack size"
|
||||
default 512
|
||||
|
||||
config ZMK_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE
|
||||
int "Max number of behavior run events to queue to send to the peripheral(s)"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_CENTRAL_PRIORITY
|
||||
int "Split central thread priority"
|
||||
default 5
|
||||
|
||||
endif # ZMK_SPLIT_ROLE_CENTRAL
|
||||
|
||||
if !ZMK_SPLIT_ROLE_CENTRAL
|
||||
|
||||
config ZMK_SPLIT_PERIPHERAL_STACK_SIZE
|
||||
int "Split peripheral notify thread stack size"
|
||||
default 756
|
||||
|
||||
config ZMK_SPLIT_PERIPHERAL_PRIORITY
|
||||
int "Split peripheral notify thread priority"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE
|
||||
int "Max number of key position state events to queue to send to the central"
|
||||
default 10
|
||||
|
||||
endif #!ZMK_SPLIT_ROLE_CENTRAL
|
||||
|
||||
choice ZMK_SPLIT_TRANSPORT
|
||||
prompt "Split transport"
|
||||
|
||||
|
|
|
@ -46,18 +46,6 @@ config ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY
|
|||
|
||||
endif
|
||||
|
||||
config ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE
|
||||
int "Max number of key position state events to queue when received from peripherals"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE
|
||||
int "BLE split central write thread stack size"
|
||||
default 512
|
||||
|
||||
config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE
|
||||
int "Max number of behavior run events to queue to send to the peripheral(s)"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_BLE_PREF_INT
|
||||
int "Connection interval to use for split central/peripheral connection"
|
||||
default 6
|
||||
|
@ -74,18 +62,6 @@ endif # ZMK_SPLIT_ROLE_CENTRAL
|
|||
|
||||
if !ZMK_SPLIT_ROLE_CENTRAL
|
||||
|
||||
config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE
|
||||
int "BLE split peripheral notify thread stack size"
|
||||
default 756
|
||||
|
||||
config ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY
|
||||
int "BLE split peripheral notify thread priority"
|
||||
default 5
|
||||
|
||||
config ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE
|
||||
int "Max number of key position state events to queue to send to the central"
|
||||
default 10
|
||||
|
||||
config BT_MAX_PAIRED
|
||||
default 1
|
||||
|
||||
|
|
|
@ -798,4 +798,4 @@ static int zmk_split_bt_central_init(void) {
|
|||
#endif // IS_ENABLED(CONFIG_SETTINGS)
|
||||
}
|
||||
|
||||
SYS_INIT(zmk_split_bt_central_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
||||
SYS_INIT(zmk_split_bt_central_init, APPLICATION, CONFIG_ZMK_SPLIT_INIT_PRIORITY);
|
||||
|
|
|
@ -193,4 +193,4 @@ static int zmk_peripheral_ble_init(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(zmk_peripheral_ble_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
||||
SYS_INIT(zmk_peripheral_ble_init, APPLICATION, CONFIG_ZMK_SPLIT_INIT_PRIORITY);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed),
|
||||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4);
|
||||
CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE, 4);
|
||||
|
||||
void peripheral_event_work_callback(struct k_work *work) {
|
||||
struct zmk_position_state_changed ev;
|
||||
|
@ -38,7 +38,7 @@ void zmk_position_state_change_handle(struct zmk_position_state_changed *ev) {
|
|||
|
||||
#if ZMK_KEYMAP_HAS_SENSORS
|
||||
K_MSGQ_DEFINE(peripheral_sensor_event_msgq, sizeof(struct zmk_sensor_event),
|
||||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4);
|
||||
CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE, 4);
|
||||
|
||||
void peripheral_sensor_event_work_callback(struct k_work *work) {
|
||||
struct zmk_sensor_event ev;
|
||||
|
@ -57,13 +57,13 @@ void zmk_sensor_event_handle(struct zmk_sensor_event *ev) {
|
|||
#endif /* ZMK_KEYMAP_HAS_SENSORS */
|
||||
|
||||
K_THREAD_STACK_DEFINE(split_central_split_run_q_stack,
|
||||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE);
|
||||
CONFIG_ZMK_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE);
|
||||
|
||||
struct k_work_q split_central_split_run_q;
|
||||
|
||||
K_MSGQ_DEFINE(zmk_split_central_split_run_msgq,
|
||||
sizeof(struct zmk_split_run_behavior_payload_wrapper),
|
||||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_QUEUE_SIZE, 4);
|
||||
CONFIG_ZMK_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE, 4);
|
||||
|
||||
void split_central_split_run_callback(struct k_work *work) {
|
||||
struct zmk_split_run_behavior_payload_wrapper payload_wrapper;
|
||||
|
@ -123,8 +123,8 @@ int zmk_split_invoke_behavior(uint8_t source, struct zmk_behavior_binding *bindi
|
|||
static int zmk_split_central_init(void) {
|
||||
k_work_queue_start(&split_central_split_run_q, split_central_split_run_q_stack,
|
||||
K_THREAD_STACK_SIZEOF(split_central_split_run_q_stack),
|
||||
CONFIG_ZMK_BLE_THREAD_PRIORITY, NULL);
|
||||
CONFIG_ZMK_SPLIT_CENTRAL_PRIORITY, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(zmk_split_central_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
||||
SYS_INIT(zmk_split_central_init, APPLICATION, CONFIG_ZMK_SPLIT_INIT_PRIORITY);
|
||||
|
|
|
@ -20,12 +20,12 @@ static uint8_t position_state[ZMK_SPLIT_POS_STATE_LEN];
|
|||
static struct sensor_event last_sensor_event;
|
||||
#endif
|
||||
|
||||
K_THREAD_STACK_DEFINE(service_q_stack, CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE);
|
||||
K_THREAD_STACK_DEFINE(service_q_stack, CONFIG_ZMK_SPLIT_PERIPHERAL_STACK_SIZE);
|
||||
|
||||
struct k_work_q service_work_q;
|
||||
|
||||
K_MSGQ_DEFINE(position_state_msgq, sizeof(char[ZMK_SPLIT_POS_STATE_LEN]),
|
||||
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
|
||||
CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
|
||||
|
||||
void send_position_state_callback(struct k_work *work) {
|
||||
uint8_t state[ZMK_SPLIT_POS_STATE_LEN];
|
||||
|
@ -70,7 +70,7 @@ int zmk_split_position_released(uint8_t position) {
|
|||
|
||||
#if ZMK_KEYMAP_HAS_SENSORS
|
||||
K_MSGQ_DEFINE(sensor_state_msgq, sizeof(struct sensor_event),
|
||||
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
|
||||
CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE, 4);
|
||||
|
||||
void send_sensor_state_callback(struct k_work *work) {
|
||||
while (k_msgq_get(&sensor_state_msgq, &last_sensor_event, K_NO_WAIT) == 0) {
|
||||
|
@ -120,9 +120,9 @@ static int service_init(void) {
|
|||
static const struct k_work_queue_config queue_config = {
|
||||
.name = "Split Peripheral Notification Queue"};
|
||||
k_work_queue_start(&service_work_q, service_q_stack, K_THREAD_STACK_SIZEOF(service_q_stack),
|
||||
CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY, &queue_config);
|
||||
CONFIG_ZMK_SPLIT_PERIPHERAL_PRIORITY, &queue_config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(service_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
||||
SYS_INIT(service_init, APPLICATION, CONFIG_ZMK_SPLIT_INIT_PRIORITY);
|
||||
|
|
|
@ -129,9 +129,11 @@ Following [split keyboard](../features/split-keyboards.md) settings are defined
|
|||
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING` | bool | Enable fetching split peripheral battery levels to the central side | n |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY` | bool | Enable central reporting of split battery levels to hosts | n |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_QUEUE_SIZE` | int | Max number of battery level events to queue when received from peripherals | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS` |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
|
||||
| `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 |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE` | int | Stack size of the BLE split peripheral notify thread | 650 |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY` | int | Priority of the BLE split peripheral notify thread | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue to send to the central | 10 |
|
||||
| `CONFIG_ZMK_SPLIT_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 |
|
||||
| `CONFIG_ZMK_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE` | int | Max number of behavior run events to queue to send to the peripheral(s) | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_CENTRAL_PRIORITY` | int | Priority of the split central thread | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_PERIPHERAL_STACK_SIZE` | int | Stack size of the split peripheral notify thread | 756 |
|
||||
| `CONFIG_ZMK_SPLIT_PERIPHERAL_PRIORITY` | int | Priority of the split peripheral notify thread | 5 |
|
||||
| `CONFIG_ZMK_SPLIT_PERIPHERAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue to send to the central | 10 |
|
||||
| `CONFIG_ZMK_SPLIT_INIT_PRIORITY` | int | Split init priority | 50 |
|
||||
|
|
Loading…
Add table
Reference in a new issue