From 3796f76c56d42ca9b4fd36edae7f6bf6656009b9 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 29 Jun 2020 00:37:11 -0400 Subject: Initial exploration of split BLE service. * Service for split peripheral to report position state to split central. * Updated advertising info. * Behavior for split BT until we have a proper event system. --- app/boards/shields/kyria/Kconfig.defconfig | 3 +++ app/boards/shields/kyria/kyria.dtsi | 1 + 2 files changed, 4 insertions(+) (limited to 'app/boards') diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 25af537..9ce12d9 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -4,4 +4,7 @@ if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT config ZMK_KEYBOARD_NAME default "Kyria" +config ZMK_SPLIT + default y + endif diff --git a/app/boards/shields/kyria/kyria.dtsi b/app/boards/shields/kyria/kyria.dtsi index f96adf0..f2f2d75 100644 --- a/app/boards/shields/kyria/kyria.dtsi +++ b/app/boards/shields/kyria/kyria.dtsi @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT */ +#include #include / { -- cgit v1.3.1 From d74efb331ac32c1a65d20193d06b2cabb858b594 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 14 Jul 2020 12:14:15 -0400 Subject: Kconfig fixes for split roles. --- app/Kconfig | 2 ++ app/boards/shields/kyria/kyria_left.conf | 2 ++ app/boards/shields/kyria/kyria_right.conf | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 app/boards/shields/kyria/kyria_left.conf create mode 100644 app/boards/shields/kyria/kyria_right.conf (limited to 'app/boards') diff --git a/app/Kconfig b/app/Kconfig index 2309d2d..5881aae 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -94,6 +94,8 @@ choice ZMK_SPLIT_BLE_ROLE config ZMK_SPLIT_BLE_ROLE_CENTRAL bool "Central" + select BT_CENTRAL + select BT_GATT_CLIENT config ZMK_SPLIT_BLE_ROLE_PERIPHERAL bool "Peripheral" diff --git a/app/boards/shields/kyria/kyria_left.conf b/app/boards/shields/kyria/kyria_left.conf new file mode 100644 index 0000000..e51dee4 --- /dev/null +++ b/app/boards/shields/kyria/kyria_left.conf @@ -0,0 +1,2 @@ +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 new file mode 100644 index 0000000..a835adc --- /dev/null +++ b/app/boards/shields/kyria/kyria_right.conf @@ -0,0 +1,2 @@ +CONFIG_ZMK_SPLIT=y +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y \ No newline at end of file -- cgit v1.3.1 From 0321c490b5d0d087e76c06185a2940420cf7ab4c Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 15 Jul 2020 23:26:35 -0400 Subject: Disable USB on the peripheral size. --- app/boards/shields/kyria/kyria_right.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/boards') diff --git a/app/boards/shields/kyria/kyria_right.conf b/app/boards/shields/kyria/kyria_right.conf index a835adc..99d6c4e 100644 --- a/app/boards/shields/kyria/kyria_right.conf +++ b/app/boards/shields/kyria/kyria_right.conf @@ -1,2 +1,3 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y \ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y +CONFIG_ZMK_USB=n \ No newline at end of file -- cgit v1.3.1 From 6701b7babc68cb8090a9d16105bd3876025aa0e8 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 16 Jul 2020 15:50:41 -0400 Subject: Working BT settings. --- app/Kconfig | 22 ++++++++++++---------- app/boards/arm/nice_nano/nice_nano_defconfig | 7 +++++++ app/boards/shields/kyria/Kconfig.defconfig | 16 ++++++++++++++-- app/src/ble.c | 14 +++++++++----- app/src/main.c | 8 -------- 5 files changed, 42 insertions(+), 25 deletions(-) (limited to 'app/boards') diff --git a/app/Kconfig b/app/Kconfig index 8ae10ad..c2a753f 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -40,6 +40,8 @@ menuconfig ZMK_BLE select BT_PERIPHERAL select BT_GATT_DIS select BT_GATT_BAS + select SETTINGS + select BT_SETTINGS if ZMK_BLE @@ -47,6 +49,9 @@ config ZMK_BLE_INIT_PRIORITY int "Init Priority" default 50 +config SYSTEM_WORKQUEUE_STACK_SIZE + default 2048 + # HID GATT notifications sent this way are *not* picked up by Linux, and possibly others. config BT_GATT_NOTIFY_MULTIPLE default n @@ -58,16 +63,6 @@ config ZMK_BLE_PASSKEY_ENTRY bool "Experimental: Requiring typing passkey from host to pair BLE connection" default n -# Incresed stack due to settings API usage -# CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 -# -# CONFIG_BT_SETTINGS=y -# CONFIG_FLASH=y -# CONFIG_FLASH_PAGE_LAYOUT=y -# CONFIG_FLASH_MAP=y -# CONFIG_NVS=y -# CONFIG_SETTINGS=y - endif endmenu @@ -97,6 +92,13 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL select BT_CENTRAL select BT_GATT_CLIENT +if ZMK_SPLIT_BLE_ROLE_CENTRAL + +config BT_MAX_CONN + default 2 + +endif + config ZMK_SPLIT_BLE_ROLE_PERIPHERAL bool "Peripheral" diff --git a/app/boards/arm/nice_nano/nice_nano_defconfig b/app/boards/arm/nice_nano/nice_nano_defconfig index f9be0ee..393d61f 100644 --- a/app/boards/arm/nice_nano/nice_nano_defconfig +++ b/app/boards/arm/nice_nano/nice_nano_defconfig @@ -11,3 +11,10 @@ CONFIG_ARM_MPU=y CONFIG_GPIO=y CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y \ No newline at end of file diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 9ce12d9..bc0a7b8 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -1,8 +1,20 @@ -if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT +if SHIELD_KYRIA_LEFT config ZMK_KEYBOARD_NAME - default "Kyria" + default "Kyria Left" + +endif + + +if SHIELD_KYRIA_RIGHT + +config ZMK_KEYBOARD_NAME + default "Kyria Right" + +endif + +if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT config ZMK_SPLIT default y diff --git a/app/src/ble.c b/app/src/ble.c index 3cbb14d..809575d 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -128,8 +128,11 @@ static struct bt_conn_auth_cb zmk_ble_auth_cb_display = { static const struct bt_data zmk_ble_ad[] = { 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) 0x12, 0x18, /* HID Service */ - 0x0f, 0x18), /* Battery Service */ +#endif + 0x0f, 0x18 /* Battery Service */ + ), #if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE) BT_DATA_BYTES(BT_DATA_UUID128_ALL, ZMK_SPLIT_BT_SERVICE_UUID) @@ -155,10 +158,6 @@ static void zmk_ble_ready(int err) static int zmk_ble_init(struct device *_arg) { - if (IS_ENABLED(CONFIG_SETTINGS)) - { - settings_load(); - } int err = bt_enable(NULL); if (err) @@ -167,6 +166,11 @@ static int zmk_ble_init(struct device *_arg) return err; } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) + { + settings_load(); + } + bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&zmk_ble_auth_cb_display); diff --git a/app/src/main.c b/app/src/main.c index b7d3a4b..e755304 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -16,10 +16,6 @@ LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#ifdef CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL -#include -#endif /* CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL */ - #define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID) void main(void) @@ -30,8 +26,4 @@ void main(void) { return; } - -#ifdef CONFIG_SETTINGS - settings_load(); -#endif } -- cgit v1.3.1 From f4cb3a7cba8f4593f3103470b0c790cf68449ea0 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 16 Jul 2020 16:01:04 -0400 Subject: Clean up old global behavior logic. --- app/boards/shields/kyria/kyria.dtsi | 1 - app/dts/behaviors/split_bt.dtsi | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 app/dts/behaviors/split_bt.dtsi (limited to 'app/boards') diff --git a/app/boards/shields/kyria/kyria.dtsi b/app/boards/shields/kyria/kyria.dtsi index f2f2d75..f96adf0 100644 --- a/app/boards/shields/kyria/kyria.dtsi +++ b/app/boards/shields/kyria/kyria.dtsi @@ -4,7 +4,6 @@ * SPDX-License-Identifier: MIT */ -#include #include / { diff --git a/app/dts/behaviors/split_bt.dtsi b/app/dts/behaviors/split_bt.dtsi deleted file mode 100644 index c31d957..0000000 --- a/app/dts/behaviors/split_bt.dtsi +++ /dev/null @@ -1,9 +0,0 @@ -/ { - behaviors { - split_behavior: behavior_split_bt { - compatible = "zmk,behavior-split-bt", "zmk,behavior-global"; - label = "SPLIT_BT"; - #binding-cells = <0>; - }; - }; -}; -- cgit v1.3.1 From 339a15881a07c5b6e05c39ccdb8a312ba53042ff Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 17 Jul 2020 16:42:02 -0400 Subject: Tweaks for turning off USB for split peripherals. --- app/Kconfig | 7 +++++++ app/boards/shields/kyria/kyria_right.conf | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app/boards') diff --git a/app/Kconfig b/app/Kconfig index c2a753f..aa8be60 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -102,6 +102,13 @@ endif config ZMK_SPLIT_BLE_ROLE_PERIPHERAL bool "Peripheral" +if ZMK_SPLIT_BLE_ROLE_PERIPHERAL + +config ZMK_USB + default n + +endif + endchoice endif diff --git a/app/boards/shields/kyria/kyria_right.conf b/app/boards/shields/kyria/kyria_right.conf index 99d6c4e..a835adc 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_USB=n \ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y \ No newline at end of file -- cgit v1.3.1 From 5b61c211eaace2174fd68a51a1972e29b14cd5a6 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 17 Jul 2020 22:44:35 -0400 Subject: Tweaks for split Lily58 sync. --- app/boards/shields/lily58/lily58_left.conf | 2 ++ app/boards/shields/lily58/lily58_right.conf | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 app/boards/shields/lily58/lily58_left.conf create mode 100644 app/boards/shields/lily58/lily58_right.conf (limited to 'app/boards') diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf new file mode 100644 index 0000000..e51dee4 --- /dev/null +++ b/app/boards/shields/lily58/lily58_left.conf @@ -0,0 +1,2 @@ +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 new file mode 100644 index 0000000..990cf7c --- /dev/null +++ b/app/boards/shields/lily58/lily58_right.conf @@ -0,0 +1,2 @@ +CONFIG_ZMK_SPLIT=y +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -- cgit v1.3.1 From 64b9963bca66ec0d3d919e7a8d35d485fa2002e9 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 17 Jul 2020 23:02:00 -0400 Subject: Name each Lily58 side differently. --- app/boards/shields/lily58/Kconfig.defconfig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/boards') diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig index 9ec5834..8f278b0 100644 --- a/app/boards/shields/lily58/Kconfig.defconfig +++ b/app/boards/shields/lily58/Kconfig.defconfig @@ -1,7 +1,14 @@ -if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT +if SHIELD_LILY58_LEFT config ZMK_KEYBOARD_NAME - default "Lily58" + default "Lily58 Left" + +endif + +if SHIELD_LILY58_RIGHT + +config ZMK_KEYBOARD_NAME + default "Lily58 Right" endif -- cgit v1.3.1