From 1adfcf92bf96cd6453e6bb3ae8cc3b2d1fa8caa4 Mon Sep 17 00:00:00 2001 From: Xudong Zheng <7pkvm5aw@slicealias.com> Date: Mon, 29 May 2023 00:28:45 -0400 Subject: [PATCH] refactor(split): fix inconsistency in Kconfig names --- app/include/zmk/ble.h | 2 +- app/src/keymap.c | 2 +- app/src/split/bluetooth/Kconfig | 4 ++-- app/src/split/bluetooth/central.c | 12 ++++++------ docs/docs/config/system.md | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/include/zmk/ble.h b/app/include/zmk/ble.h index 4380a33a..1c84777d 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -15,7 +15,7 @@ #if ZMK_BLE_IS_CENTRAL #define ZMK_BLE_PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1) -#define ZMK_BLE_SPLIT_PERIPHERAL_COUNT 1 +#define ZMK_SPLIT_BLE_PERIPHERAL_COUNT 1 #else #define ZMK_BLE_PROFILE_COUNT CONFIG_BT_MAX_PAIRED #endif diff --git a/app/src/keymap.c b/app/src/keymap.c index 909fd20d..da25fc09 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -218,7 +218,7 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position #endif case BEHAVIOR_LOCALITY_GLOBAL: #if ZMK_BLE_IS_CENTRAL - for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) { + for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) { zmk_split_bt_invoke_behavior(i, &binding, event, pressed); } #endif diff --git a/app/src/split/bluetooth/Kconfig b/app/src/split/bluetooth/Kconfig index 53119d82..005d75fd 100644 --- a/app/src/split/bluetooth/Kconfig +++ b/app/src/split/bluetooth/Kconfig @@ -21,11 +21,11 @@ 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_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE +config ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE int "BLE split central write thread stack size" default 512 -config ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE +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 diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index ac073c59..a7c0d8a9 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -47,7 +47,7 @@ struct peripheral_slot { uint8_t changed_positions[POSITION_STATE_DATA_LEN]; }; -static struct peripheral_slot peripherals[ZMK_BLE_SPLIT_PERIPHERAL_COUNT]; +static struct peripheral_slot peripherals[ZMK_SPLIT_BLE_PERIPHERAL_COUNT]; static const struct bt_uuid_128 split_service_uuid = BT_UUID_INIT_128(ZMK_SPLIT_BT_SERVICE_UUID); @@ -65,7 +65,7 @@ void peripheral_event_work_callback(struct k_work *work) { K_WORK_DEFINE(peripheral_event_work, peripheral_event_work_callback); int peripheral_slot_index_for_conn(struct bt_conn *conn) { - for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) { + for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) { if (peripherals[i].conn == conn) { return i; } @@ -84,7 +84,7 @@ struct peripheral_slot *peripheral_slot_for_conn(struct bt_conn *conn) { } int release_peripheral_slot(int index) { - if (index < 0 || index >= ZMK_BLE_SPLIT_PERIPHERAL_COUNT) { + if (index < 0 || index >= ZMK_SPLIT_BLE_PERIPHERAL_COUNT) { return -EINVAL; } @@ -131,7 +131,7 @@ int release_peripheral_slot(int index) { } int reserve_peripheral_slot() { - for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) { + for (int i = 0; i < ZMK_SPLIT_BLE_PERIPHERAL_COUNT; i++) { if (peripherals[i].state == PERIPHERAL_SLOT_STATE_OPEN) { // Be sure the slot is fully reinitialized. release_peripheral_slot(i); @@ -504,7 +504,7 @@ static struct bt_conn_cb conn_callbacks = { }; K_THREAD_STACK_DEFINE(split_central_split_run_q_stack, - CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE); + CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE); struct k_work_q split_central_split_run_q; @@ -515,7 +515,7 @@ struct zmk_split_run_behavior_payload_wrapper { K_MSGQ_DEFINE(zmk_split_central_split_run_msgq, sizeof(struct zmk_split_run_behavior_payload_wrapper), - CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE, 4); + CONFIG_ZMK_SPLIT_BLE_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; diff --git a/docs/docs/config/system.md b/docs/docs/config/system.md index a5347b96..5a5ae5a5 100644 --- a/docs/docs/config/system.md +++ b/docs/docs/config/system.md @@ -97,8 +97,8 @@ Following split keyboard settings are defined in [zmk/app/src/split/Kconfig](htt | `CONFIG_ZMK_SPLIT_BLE` | bool | Use BLE to communicate between split keyboard halves | y | | `CONFIG_ZMK_SPLIT_ROLE_CENTRAL` | bool | `y` for central device, `n` for peripheral | | | `CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 5 | -| `CONFIG_ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE` | int | Stack size of the BLE split central write thread | 512 | -| `CONFIG_ZMK_BLE_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_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 |