summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/CMakeLists.txt12
-rw-r--r--app/Kconfig15
-rw-r--r--app/boards/shields/corne/Kconfig.defconfig7
-rw-r--r--app/boards/shields/corne/corne_left.conf2
-rw-r--r--app/boards/shields/corne/corne_right.conf2
-rw-r--r--app/boards/shields/cradio/Kconfig.defconfig10
-rw-r--r--app/boards/shields/cradio/cradio_left.conf3
-rw-r--r--app/boards/shields/cradio/cradio_right.conf2
-rw-r--r--app/boards/shields/iris/Kconfig.defconfig10
-rw-r--r--app/boards/shields/iris/iris_left.conf2
-rw-r--r--app/boards/shields/iris/iris_right.conf2
-rw-r--r--app/boards/shields/jian/Kconfig.defconfig4
-rw-r--r--app/boards/shields/jian/jian_left.conf2
-rw-r--r--app/boards/shields/jian/jian_right.conf2
-rw-r--r--app/boards/shields/jorne/Kconfig.defconfig3
-rw-r--r--app/boards/shields/jorne/jorne_left.conf2
-rw-r--r--app/boards/shields/jorne/jorne_right.conf2
-rw-r--r--app/boards/shields/kyria/Kconfig.defconfig3
-rw-r--r--app/boards/shields/kyria/kyria_left.conf2
-rw-r--r--app/boards/shields/kyria/kyria_right.conf2
-rw-r--r--app/boards/shields/lily58/Kconfig.defconfig7
-rw-r--r--app/boards/shields/lily58/lily58_left.conf3
-rw-r--r--app/boards/shields/lily58/lily58_right.conf3
-rw-r--r--app/boards/shields/microdox/Kconfig.defconfig3
-rw-r--r--app/boards/shields/microdox/microdox_left.conf2
-rw-r--r--app/boards/shields/microdox/microdox_right.conf2
-rw-r--r--app/boards/shields/quefrency/Kconfig.defconfig10
-rw-r--r--app/boards/shields/quefrency/quefrency_left.conf2
-rw-r--r--app/boards/shields/quefrency/quefrency_right.conf2
-rw-r--r--app/boards/shields/sofle/Kconfig.defconfig7
-rw-r--r--app/boards/shields/sofle/sofle_left.conf3
-rw-r--r--app/boards/shields/sofle/sofle_right.conf3
-rw-r--r--app/boards/shields/splitreus62/Kconfig.defconfig6
-rw-r--r--app/boards/shields/splitreus62/splitreus62_left.conf2
-rw-r--r--app/boards/shields/splitreus62/splitreus62_right.conf2
-rw-r--r--app/src/ble.c25
36 files changed, 92 insertions, 79 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 5174576..9e0612d 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -39,7 +39,7 @@ target_sources(app PRIVATE src/events/sensor_event.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c)
-if (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
@@ -57,9 +57,13 @@ target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c)
-target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split_listener.c)
-target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split/bluetooth/service.c)
-target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL app PRIVATE src/split/bluetooth/central.c)
+if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
+ target_sources(app PRIVATE src/split_listener.c)
+ target_sources(app PRIVATE src/split/bluetooth/service.c)
+endif()
+if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
+ target_sources(app PRIVATE src/split/bluetooth/central.c)
+endif()
target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
diff --git a/app/Kconfig b/app/Kconfig
index ec043bf..acb288c 100644
--- a/app/Kconfig
+++ b/app/Kconfig
@@ -83,7 +83,6 @@ menu "Split Support"
config ZMK_SPLIT
bool "Split keyboard support"
- default n
if ZMK_SPLIT
@@ -95,19 +94,12 @@ config ZMK_SPLIT_BLE
if ZMK_SPLIT_BLE
-choice ZMK_SPLIT_BLE_ROLE
- bool "BLE Role For Split Communication"
- default ZMK_SPLIT_BLE_ROLE_CENTRAL
-
config ZMK_SPLIT_BLE_ROLE_CENTRAL
bool "Central"
select BT_CENTRAL
select BT_GATT_CLIENT
-config ZMK_SPLIT_BLE_ROLE_PERIPHERAL
- bool "Peripheral"
-
-if ZMK_SPLIT_BLE_ROLE_PERIPHERAL
+if !ZMK_SPLIT_BLE_ROLE_CENTRAL
config ZMK_USB
default n
@@ -121,12 +113,9 @@ config BT_MAX_CONN
config BT_GAP_AUTO_UPDATE_CONN_PARAMS
default n
-#ZMK_SPLIT_BLE_ROLE_PERIPHERAL
+#!ZMK_SPLIT_BLE_ROLE_CENTRAL
endif
-#ZMK_SPLIT_BLE_ROLE
-endchoice
-
#ZMK_SPLIT_BLE
endif
diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig
index 0355c77..9e33e08 100644
--- a/app/boards/shields/corne/Kconfig.defconfig
+++ b/app/boards/shields/corne/Kconfig.defconfig
@@ -1,11 +1,12 @@
-
if SHIELD_CORNE_LEFT
config ZMK_KEYBOARD_NAME
- default "Corne Left"
+ default "Corne"
-endif
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+endif
if SHIELD_CORNE_RIGHT
diff --git a/app/boards/shields/corne/corne_left.conf b/app/boards/shields/corne/corne_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/corne/corne_left.conf
+++ b/app/boards/shields/corne/corne_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/corne/corne_right.conf b/app/boards/shields/corne/corne_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/corne/corne_right.conf
+++ b/app/boards/shields/corne/corne_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/cradio/Kconfig.defconfig b/app/boards/shields/cradio/Kconfig.defconfig
index 81246ba..5e826bf 100644
--- a/app/boards/shields/cradio/Kconfig.defconfig
+++ b/app/boards/shields/cradio/Kconfig.defconfig
@@ -6,6 +6,9 @@ if SHIELD_CRADIO_LEFT
config ZMK_KEYBOARD_NAME
default "cradio left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_CRADIO_RIGHT
@@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME
default "cradio right"
endif
+
+if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT
+
+config ZMK_SPLIT
+ default y
+
+endif \ No newline at end of file
diff --git a/app/boards/shields/cradio/cradio_left.conf b/app/boards/shields/cradio/cradio_left.conf
index 405f04d..c9f7988 100644
--- a/app/boards/shields/cradio/cradio_left.conf
+++ b/app/boards/shields/cradio/cradio_left.conf
@@ -1,5 +1,2 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
-
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/cradio/cradio_right.conf b/app/boards/shields/cradio/cradio_right.conf
index bd2c93b..80a6177 100644
--- a/app/boards/shields/cradio/cradio_right.conf
+++ b/app/boards/shields/cradio/cradio_right.conf
@@ -1,5 +1,3 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig
index 6439780..57b8c1e 100644
--- a/app/boards/shields/iris/Kconfig.defconfig
+++ b/app/boards/shields/iris/Kconfig.defconfig
@@ -6,6 +6,9 @@ if SHIELD_IRIS_LEFT
config ZMK_KEYBOARD_NAME
default "Iris Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_IRIS_RIGHT
@@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME
default "Iris Right"
endif
+
+if SHIELD_IRIS_LEFT || SHIELD_IRIS_RIGHT
+
+config ZMK_SPLIT
+ default y
+
+endif \ No newline at end of file
diff --git a/app/boards/shields/iris/iris_left.conf b/app/boards/shields/iris/iris_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/iris/iris_left.conf
+++ b/app/boards/shields/iris/iris_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/iris/iris_right.conf b/app/boards/shields/iris/iris_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/iris/iris_right.conf
+++ b/app/boards/shields/iris/iris_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/jian/Kconfig.defconfig b/app/boards/shields/jian/Kconfig.defconfig
index b743e7a..9e1da62 100644
--- a/app/boards/shields/jian/Kconfig.defconfig
+++ b/app/boards/shields/jian/Kconfig.defconfig
@@ -4,6 +4,9 @@ if SHIELD_JIAN_LEFT
config ZMK_KEYBOARD_NAME
default "Jian Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
@@ -18,6 +21,5 @@ if SHIELD_JIAN_LEFT || SHIELD_JIAN_RIGHT
config ZMK_SPLIT
default y
-
endif
diff --git a/app/boards/shields/jian/jian_left.conf b/app/boards/shields/jian/jian_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/jian/jian_left.conf
+++ b/app/boards/shields/jian/jian_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/jian/jian_right.conf b/app/boards/shields/jian/jian_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/jian/jian_right.conf
+++ b/app/boards/shields/jian/jian_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/jorne/Kconfig.defconfig b/app/boards/shields/jorne/Kconfig.defconfig
index c0df54b..5b0e0b9 100644
--- a/app/boards/shields/jorne/Kconfig.defconfig
+++ b/app/boards/shields/jorne/Kconfig.defconfig
@@ -4,6 +4,9 @@ if SHIELD_JORNE_LEFT
config ZMK_KEYBOARD_NAME
default "Jorne Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
diff --git a/app/boards/shields/jorne/jorne_left.conf b/app/boards/shields/jorne/jorne_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/jorne/jorne_left.conf
+++ b/app/boards/shields/jorne/jorne_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/jorne/jorne_right.conf b/app/boards/shields/jorne/jorne_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/jorne/jorne_right.conf
+++ b/app/boards/shields/jorne/jorne_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig
index 8d5fe81..99e47bf 100644
--- a/app/boards/shields/kyria/Kconfig.defconfig
+++ b/app/boards/shields/kyria/Kconfig.defconfig
@@ -4,6 +4,9 @@ if SHIELD_KYRIA_LEFT
config ZMK_KEYBOARD_NAME
default "Kyria Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
diff --git a/app/boards/shields/kyria/kyria_left.conf b/app/boards/shields/kyria/kyria_left.conf
index e51dee4..e69de29 100644
--- a/app/boards/shields/kyria/kyria_left.conf
+++ b/app/boards/shields/kyria/kyria_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file
diff --git a/app/boards/shields/kyria/kyria_right.conf b/app/boards/shields/kyria/kyria_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/kyria/kyria_right.conf
+++ b/app/boards/shields/kyria/kyria_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig
index 81feefd..915cc70 100644
--- a/app/boards/shields/lily58/Kconfig.defconfig
+++ b/app/boards/shields/lily58/Kconfig.defconfig
@@ -4,6 +4,9 @@ if SHIELD_LILY58_LEFT
config ZMK_KEYBOARD_NAME
default "Lily58 Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_LILY58_RIGHT
@@ -15,6 +18,9 @@ endif
if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT
+config ZMK_SPLIT
+ default y
+
if ZMK_DISPLAY
config I2C
@@ -52,3 +58,4 @@ endchoice
endif # LVGL
endif
+
diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf
index 6ff95d5..24f8d77 100644
--- a/app/boards/shields/lily58/lily58_left.conf
+++ b/app/boards/shields/lily58/lily58_left.conf
@@ -1,6 +1,3 @@
# Uncomment to enable encoder
# CONFIG_EC11=y
# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
-
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file
diff --git a/app/boards/shields/lily58/lily58_right.conf b/app/boards/shields/lily58/lily58_right.conf
index 990cf7c..8b13789 100644
--- a/app/boards/shields/lily58/lily58_right.conf
+++ b/app/boards/shields/lily58/lily58_right.conf
@@ -1,2 +1 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
+
diff --git a/app/boards/shields/microdox/Kconfig.defconfig b/app/boards/shields/microdox/Kconfig.defconfig
index 3f8b748..be39c9f 100644
--- a/app/boards/shields/microdox/Kconfig.defconfig
+++ b/app/boards/shields/microdox/Kconfig.defconfig
@@ -6,6 +6,9 @@ if SHIELD_MICRODOX_LEFT
config ZMK_KEYBOARD_NAME
default "Microdox Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
diff --git a/app/boards/shields/microdox/microdox_left.conf b/app/boards/shields/microdox/microdox_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/microdox/microdox_left.conf
+++ b/app/boards/shields/microdox/microdox_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/microdox/microdox_right.conf b/app/boards/shields/microdox/microdox_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/microdox/microdox_right.conf
+++ b/app/boards/shields/microdox/microdox_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/quefrency/Kconfig.defconfig b/app/boards/shields/quefrency/Kconfig.defconfig
index 2b00cb6..9c7e8b1 100644
--- a/app/boards/shields/quefrency/Kconfig.defconfig
+++ b/app/boards/shields/quefrency/Kconfig.defconfig
@@ -7,6 +7,9 @@ if SHIELD_QUEFRENCY_LEFT
config ZMK_KEYBOARD_NAME
default "Quefrency Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_QUEFRENCY_RIGHT
@@ -15,3 +18,10 @@ config ZMK_KEYBOARD_NAME
default "Quefrency Right"
endif
+
+if SHIELD_QUEFRENCY_LEFT || SHIELD_QUEFRENCY_RIGHT
+
+config ZMK_SPLIT
+ default y
+
+endif \ No newline at end of file
diff --git a/app/boards/shields/quefrency/quefrency_left.conf b/app/boards/shields/quefrency/quefrency_left.conf
index 1e028a7..e69de29 100644
--- a/app/boards/shields/quefrency/quefrency_left.conf
+++ b/app/boards/shields/quefrency/quefrency_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/quefrency/quefrency_right.conf b/app/boards/shields/quefrency/quefrency_right.conf
index 990cf7c..e69de29 100644
--- a/app/boards/shields/quefrency/quefrency_right.conf
+++ b/app/boards/shields/quefrency/quefrency_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/sofle/Kconfig.defconfig b/app/boards/shields/sofle/Kconfig.defconfig
index 6a4f863..cde094a 100644
--- a/app/boards/shields/sofle/Kconfig.defconfig
+++ b/app/boards/shields/sofle/Kconfig.defconfig
@@ -5,6 +5,10 @@ if SHIELD_SOFLE_LEFT
config ZMK_KEYBOARD_NAME
default "Sofle Left"
+
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_SOFLE_RIGHT
@@ -15,6 +19,9 @@ endif
if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT
+config ZMK_SPLIT
+ default y
+
if ZMK_DISPLAY
config I2C
diff --git a/app/boards/shields/sofle/sofle_left.conf b/app/boards/shields/sofle/sofle_left.conf
index bbac735..e813720 100644
--- a/app/boards/shields/sofle/sofle_left.conf
+++ b/app/boards/shields/sofle/sofle_left.conf
@@ -1,5 +1,2 @@
# Copyright (c) 2020 Ryan Cross
# SPDX-License-Identifier: MIT
-
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
diff --git a/app/boards/shields/sofle/sofle_right.conf b/app/boards/shields/sofle/sofle_right.conf
index ca5de38..e813720 100644
--- a/app/boards/shields/sofle/sofle_right.conf
+++ b/app/boards/shields/sofle/sofle_right.conf
@@ -1,5 +1,2 @@
# Copyright (c) 2020 Ryan Cross
# SPDX-License-Identifier: MIT
-
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
diff --git a/app/boards/shields/splitreus62/Kconfig.defconfig b/app/boards/shields/splitreus62/Kconfig.defconfig
index a2464a7..06ac131 100644
--- a/app/boards/shields/splitreus62/Kconfig.defconfig
+++ b/app/boards/shields/splitreus62/Kconfig.defconfig
@@ -8,6 +8,9 @@ if SHIELD_SPLITREUS62_LEFT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Left"
+config ZMK_SPLIT_BLE_ROLE_CENTRAL
+ default y
+
endif
if SHIELD_SPLITREUS62_RIGHT
@@ -19,4 +22,7 @@ endif
if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT
+config ZMK_SPLIT
+ default y
+
endif
diff --git a/app/boards/shields/splitreus62/splitreus62_left.conf b/app/boards/shields/splitreus62/splitreus62_left.conf
index e51dee4..e69de29 100644
--- a/app/boards/shields/splitreus62/splitreus62_left.conf
+++ b/app/boards/shields/splitreus62/splitreus62_left.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file
diff --git a/app/boards/shields/splitreus62/splitreus62_right.conf b/app/boards/shields/splitreus62/splitreus62_right.conf
index a835adc..e69de29 100644
--- a/app/boards/shields/splitreus62/splitreus62_right.conf
+++ b/app/boards/shields/splitreus62/splitreus62_right.conf
@@ -1,2 +0,0 @@
-CONFIG_ZMK_SPLIT=y
-CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y \ No newline at end of file
diff --git a/app/src/ble.c b/app/src/ble.c
index 4d42287..be84de8 100644
--- a/app/src/ble.c
+++ b/app/src/ble.c
@@ -63,19 +63,24 @@ static uint8_t active_profile;
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
+#define IS_HOST_PERIPHERAL \
+ (!IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
+#define IS_SPLIT_PERIPHERAL \
+ (IS_ENABLED(CONFIG_ZMK_SPLIT) && !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
+
static const struct bt_data zmk_ble_ad[] = {
-#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_HOST_PERIPHERAL
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03),
#endif
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID16_SOME,
-#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_HOST_PERIPHERAL
0x12, 0x18, /* HID Service */
#endif
0x0f, 0x18 /* Battery Service */
),
-#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_SPLIT_PERIPHERAL
BT_DATA_BYTES(BT_DATA_UUID128_ALL, ZMK_SPLIT_BT_SERVICE_UUID)
#endif
};
@@ -373,7 +378,7 @@ static void connected(struct bt_conn *conn, uint8_t err) {
bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400));
-#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_SPLIT_PERIPHERAL
bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M);
#endif
@@ -462,7 +467,7 @@ static void auth_cancel(struct bt_conn *conn) {
LOG_DBG("Pairing cancelled: %s", log_strdup(addr));
}
-#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_HOST_PERIPHERAL
static enum bt_security_err auth_pairing_accept(struct bt_conn *conn,
const struct bt_conn_pairing_feat *const feat) {
struct bt_conn_info info;
@@ -476,7 +481,7 @@ static enum bt_security_err auth_pairing_accept(struct bt_conn *conn,
return BT_SECURITY_ERR_SUCCESS;
};
-#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */
+#endif /* IS_HOST_PERIPHERAL */
static void auth_pairing_complete(struct bt_conn *conn, bool bonded) {
struct bt_conn_info info;
@@ -491,22 +496,22 @@ static void auth_pairing_complete(struct bt_conn *conn, bool bonded) {
return;
}
-#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_HOST_PERIPHERAL
if (!zmk_ble_active_profile_is_open()) {
LOG_ERR("Pairing completed but current profile is not open: %s", log_strdup(addr));
bt_unpair(BT_ID_DEFAULT, dst);
return;
}
-#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */
+#endif /* IS_HOST_PERIPHERAL */
set_profile_address(active_profile, dst);
update_advertising();
};
static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
-#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
+#if IS_HOST_PERIPHERAL
.pairing_accept = auth_pairing_accept,
-#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */
+#endif /* IS_HOST_PERIPHERAL */
.pairing_complete = auth_pairing_complete,
// .passkey_display = auth_passkey_display,