From a65b746a863bbd8e07cf404b4249526f75b069a3 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 19 Aug 2020 23:34:34 -0400 Subject: [PATCH] fix(bluetooth): Add unpair combo if DT node exists --- app/CMakeLists.txt | 2 +- app/Kconfig | 6 ------ app/boards/shields/corne/corne_left.conf | 1 - app/boards/shields/corne/corne_right.conf | 1 - app/boards/shields/kyria/kyria_left.conf | 3 +-- app/boards/shields/kyria/kyria_right.conf | 1 - app/boards/shields/lily58/lily58_left.conf | 1 - app/boards/shields/lily58/lily58_right.conf | 1 - app/src/ble_unpair_combo.c | 7 +++++-- 9 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 054f84a7..de67dfe1 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -44,7 +44,7 @@ target_sources(app PRIVATE src/behaviors/behavior_none.c) target_sources(app PRIVATE src/behaviors/behavior_sensor_rotate_key_press.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) -target_sources_ifdef(CONFIG_ZMK_BLE_UNPAIR_COMBO app PRIVATE src/ble_unpair_combo.c) +target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble_unpair_combo.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) diff --git a/app/Kconfig b/app/Kconfig index 416c9852..5f618b1f 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -45,12 +45,6 @@ menuconfig ZMK_BLE if ZMK_BLE -config ZMK_BLE_UNPAIR_COMBO - bool "Enable BT unpair combo" - help - Adds a magic key combo that can be held on startup to remove all paired devices - default n - config ZMK_BLE_INIT_PRIORITY int "Init Priority" default 50 diff --git a/app/boards/shields/corne/corne_left.conf b/app/boards/shields/corne/corne_left.conf index 338fa59c..1e028a78 100644 --- a/app/boards/shields/corne/corne_left.conf +++ b/app/boards/shields/corne/corne_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/corne/corne_right.conf b/app/boards/shields/corne/corne_right.conf index be344c41..990cf7c0 100644 --- a/app/boards/shields/corne/corne_right.conf +++ b/app/boards/shields/corne/corne_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/kyria/kyria_left.conf b/app/boards/shields/kyria/kyria_left.conf index 338fa59c..e51dee44 100644 --- a/app/boards/shields/kyria/kyria_left.conf +++ b/app/boards/shields/kyria/kyria_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file +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 be344c41..990cf7c0 100644 --- a/app/boards/shields/kyria/kyria_right.conf +++ b/app/boards/shields/kyria/kyria_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf index 338fa59c..1e028a78 100644 --- a/app/boards/shields/lily58/lily58_left.conf +++ b/app/boards/shields/lily58/lily58_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=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 cf16779e..990cf7c0 100644 --- a/app/boards/shields/lily58/lily58_right.conf +++ b/app/boards/shields/lily58/lily58_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y diff --git a/app/src/ble_unpair_combo.c b/app/src/ble_unpair_combo.c index a33a8e22..f9d05510 100644 --- a/app/src/ble_unpair_combo.c +++ b/app/src/ble_unpair_combo.c @@ -7,10 +7,11 @@ #include #include -#include - #define DT_DRV_COMPAT zmk_bt_unpair_combo +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include @@ -78,3 +79,5 @@ ZMK_SUBSCRIPTION(zmk_ble_unpair_combo, position_state_changed); SYS_INIT(zmk_ble_unpair_combo_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +#endif DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)