refactor(split): Clean up Kconfig organization.
* Seperated configs for split role (central/peripheral) and transport (BLE only for now). * Split the configs to align on structure.
This commit is contained in:
parent
c679b7e07d
commit
6539b3ae25
9 changed files with 146 additions and 126 deletions
|
@ -37,7 +37,7 @@ target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
|
||||||
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
|
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
|
||||||
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
|
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
|
||||||
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/hid.c)
|
target_sources(app PRIVATE src/hid.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
||||||
|
@ -80,13 +80,13 @@ target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed
|
||||||
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c)
|
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c)
|
||||||
|
|
||||||
if (CONFIG_ZMK_SPLIT_BLE)
|
if (CONFIG_ZMK_SPLIT_BLE)
|
||||||
if (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/split_listener.c)
|
target_sources(app PRIVATE src/split_listener.c)
|
||||||
target_sources(app PRIVATE src/split/bluetooth/service.c)
|
target_sources(app PRIVATE src/split/bluetooth/service.c)
|
||||||
target_sources(app PRIVATE src/split/bluetooth/peripheral.c)
|
target_sources(app PRIVATE src/split/bluetooth/peripheral.c)
|
||||||
target_sources(app PRIVATE src/events/split_peripheral_status_changed.c)
|
target_sources(app PRIVATE src/events/split_peripheral_status_changed.c)
|
||||||
endif()
|
endif()
|
||||||
if (CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if (CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/split/bluetooth/central.c)
|
target_sources(app PRIVATE src/split/bluetooth/central.c)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
103
app/Kconfig
103
app/Kconfig
|
@ -166,108 +166,7 @@ endmenu
|
||||||
# HID
|
# HID
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Split Support"
|
rsource "src/split/Kconfig"
|
||||||
|
|
||||||
config ZMK_SPLIT
|
|
||||||
bool "Split keyboard support"
|
|
||||||
|
|
||||||
if ZMK_SPLIT
|
|
||||||
|
|
||||||
menuconfig ZMK_SPLIT_BLE
|
|
||||||
bool "Split keyboard support via BLE transport"
|
|
||||||
depends on ZMK_BLE
|
|
||||||
default y
|
|
||||||
select BT_USER_PHY_UPDATE
|
|
||||||
select BT_AUTO_PHY_UPDATE
|
|
||||||
|
|
||||||
if ZMK_SPLIT_BLE
|
|
||||||
|
|
||||||
menuconfig ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
bool "Central"
|
|
||||||
select BT_CENTRAL
|
|
||||||
select BT_GATT_CLIENT
|
|
||||||
select BT_GATT_AUTO_DISCOVER_CCC
|
|
||||||
|
|
||||||
if ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
|
|
||||||
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
|
|
||||||
int "BLE split central write thread stack size"
|
|
||||||
default 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)"
|
|
||||||
default 5
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
|
|
||||||
config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE
|
|
||||||
int "BLE split peripheral notify thread stack size"
|
|
||||||
default 650
|
|
||||||
|
|
||||||
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 ZMK_USB
|
|
||||||
default n
|
|
||||||
|
|
||||||
config BT_MAX_PAIRED
|
|
||||||
default 1
|
|
||||||
|
|
||||||
config BT_MAX_CONN
|
|
||||||
default 1
|
|
||||||
|
|
||||||
config BT_PERIPHERAL_PREF_MAX_INT
|
|
||||||
default 6
|
|
||||||
|
|
||||||
#!ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
endif
|
|
||||||
|
|
||||||
#ZMK_SPLIT_BLE
|
|
||||||
endif
|
|
||||||
|
|
||||||
#ZMK_SPLIT
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ZMK_BLE
|
|
||||||
|
|
||||||
if ZMK_SPLIT_BLE && ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
|
|
||||||
config BT_MAX_CONN
|
|
||||||
default 6
|
|
||||||
|
|
||||||
config BT_MAX_PAIRED
|
|
||||||
default 6
|
|
||||||
|
|
||||||
#ZMK_SPLIT_BLE && ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !ZMK_SPLIT_BLE
|
|
||||||
|
|
||||||
config BT_MAX_CONN
|
|
||||||
default 5
|
|
||||||
|
|
||||||
config BT_MAX_PAIRED
|
|
||||||
default 5
|
|
||||||
|
|
||||||
#!ZMK_SPLIT_BLE
|
|
||||||
endif
|
|
||||||
|
|
||||||
#ZMK_BLE
|
|
||||||
endif
|
|
||||||
|
|
||||||
#Split Support
|
|
||||||
endmenu
|
|
||||||
|
|
||||||
#Basic Keyboard Setup
|
#Basic Keyboard Setup
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#define ZMK_BLE_IS_CENTRAL \
|
#define ZMK_BLE_IS_CENTRAL \
|
||||||
(IS_ENABLED(CONFIG_ZMK_SPLIT) && IS_ENABLED(CONFIG_ZMK_BLE) && \
|
(IS_ENABLED(CONFIG_ZMK_SPLIT) && IS_ENABLED(CONFIG_ZMK_BLE) && \
|
||||||
IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
|
IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL))
|
||||||
|
|
||||||
#if ZMK_BLE_IS_CENTRAL
|
#if ZMK_BLE_IS_CENTRAL
|
||||||
#define ZMK_BLE_PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
#define ZMK_BLE_PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
||||||
|
@ -33,6 +33,6 @@ char *zmk_ble_active_profile_name();
|
||||||
|
|
||||||
int zmk_ble_unpair_all();
|
int zmk_ble_unpair_all();
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr);
|
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr);
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
||||||
|
|
|
@ -47,7 +47,7 @@ static uint8_t passkey_digit = 0;
|
||||||
|
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_BLE_PASSKEY_ENTRY) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_BLE_PASSKEY_ENTRY) */
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
||||||
#else
|
#else
|
||||||
#define PROFILE_COUNT CONFIG_BT_MAX_PAIRED
|
#define PROFILE_COUNT CONFIG_BT_MAX_PAIRED
|
||||||
|
@ -82,11 +82,11 @@ static const struct bt_data zmk_ble_ad[] = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
|
|
||||||
static bt_addr_le_t peripheral_addr;
|
static bt_addr_le_t peripheral_addr;
|
||||||
|
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
||||||
|
|
||||||
static void raise_profile_changed_event() {
|
static void raise_profile_changed_event() {
|
||||||
ZMK_EVENT_RAISE(new_zmk_ble_active_profile_changed((struct zmk_ble_active_profile_changed){
|
ZMK_EVENT_RAISE(new_zmk_ble_active_profile_changed((struct zmk_ble_active_profile_changed){
|
||||||
|
@ -278,14 +278,14 @@ bt_addr_le_t *zmk_ble_active_profile_addr() { return &profiles[active_profile].p
|
||||||
|
|
||||||
char *zmk_ble_active_profile_name() { return profiles[active_profile].name; }
|
char *zmk_ble_active_profile_name() { return profiles[active_profile].name; }
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
|
|
||||||
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr) {
|
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr) {
|
||||||
memcpy(&peripheral_addr, addr, sizeof(bt_addr_le_t));
|
memcpy(&peripheral_addr, addr, sizeof(bt_addr_le_t));
|
||||||
settings_save_one("ble/peripheral_address", addr, sizeof(bt_addr_le_t));
|
settings_save_one("ble/peripheral_address", addr, sizeof(bt_addr_le_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) */
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_SETTINGS)
|
#if IS_ENABLED(CONFIG_SETTINGS)
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ static int ble_profiles_handle_set(const char *name, size_t len, settings_read_c
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
else if (settings_name_steq(name, "peripheral_address", &next) && !next) {
|
else if (settings_name_steq(name, "peripheral_address", &next) && !next) {
|
||||||
if (len != sizeof(bt_addr_le_t)) {
|
if (len != sizeof(bt_addr_le_t)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -6,7 +6,7 @@ menu "ZMK Display Widgets"
|
||||||
config ZMK_WIDGET_LAYER_STATUS
|
config ZMK_WIDGET_LAYER_STATUS
|
||||||
bool "Widget for highest, active layer using small icons"
|
bool "Widget for highest, active layer using small icons"
|
||||||
default y
|
default y
|
||||||
depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL
|
depends on !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL
|
||||||
select LVGL_USE_LABEL
|
select LVGL_USE_LABEL
|
||||||
|
|
||||||
config ZMK_WIDGET_BATTERY_STATUS
|
config ZMK_WIDGET_BATTERY_STATUS
|
||||||
|
@ -17,19 +17,19 @@ config ZMK_WIDGET_BATTERY_STATUS
|
||||||
|
|
||||||
config ZMK_WIDGET_OUTPUT_STATUS
|
config ZMK_WIDGET_OUTPUT_STATUS
|
||||||
bool "Widget for keyboard output status icons"
|
bool "Widget for keyboard output status icons"
|
||||||
depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
default y if BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
default y if BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
select LVGL_USE_LABEL
|
select LVGL_USE_LABEL
|
||||||
|
|
||||||
config ZMK_WIDGET_PERIPHERAL_STATUS
|
config ZMK_WIDGET_PERIPHERAL_STATUS
|
||||||
bool "Widget for split peripheral status icons"
|
bool "Widget for split peripheral status icons"
|
||||||
depends on BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_BLE_ROLE_CENTRAL
|
depends on BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL
|
||||||
default y if BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_BLE_ROLE_CENTRAL
|
default y if BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL
|
||||||
select LVGL_USE_LABEL
|
select LVGL_USE_LABEL
|
||||||
|
|
||||||
config ZMK_WIDGET_WPM_STATUS
|
config ZMK_WIDGET_WPM_STATUS
|
||||||
bool "Widget for displaying typed words per minute"
|
bool "Widget for displaying typed words per minute"
|
||||||
depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL
|
depends on !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL
|
||||||
select LVGL_USE_LABEL
|
select LVGL_USE_LABEL
|
||||||
select ZMK_WPM
|
select ZMK_WPM
|
||||||
|
|
||||||
|
|
26
app/src/split/Kconfig
Normal file
26
app/src/split/Kconfig
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Copyright (c) 2022 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
menuconfig ZMK_SPLIT
|
||||||
|
bool "Split keyboard support"
|
||||||
|
|
||||||
|
if ZMK_SPLIT
|
||||||
|
|
||||||
|
config ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
bool "Split central device"
|
||||||
|
|
||||||
|
choice ZMK_SPLIT_TRANSPORT
|
||||||
|
prompt "Split transport"
|
||||||
|
|
||||||
|
config ZMK_SPLIT_BLE
|
||||||
|
bool "BLE"
|
||||||
|
depends on ZMK_BLE
|
||||||
|
select BT_USER_PHY_UPDATE
|
||||||
|
select BT_AUTO_PHY_UPDATE
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
#ZMK_SPLIT
|
||||||
|
endif
|
||||||
|
|
||||||
|
rsource "bluetooth/Kconfig"
|
95
app/src/split/bluetooth/Kconfig
Normal file
95
app/src/split/bluetooth/Kconfig
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
# Copyright (c) 2022 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
if ZMK_SPLIT && ZMK_SPLIT_BLE
|
||||||
|
|
||||||
|
menu "BLE Transport"
|
||||||
|
|
||||||
|
# Added for backwards compatibility. New shields/board should set `ZMK_SPLIT_ROLE_CENTRAL` only.
|
||||||
|
config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||||
|
bool
|
||||||
|
select ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
|
||||||
|
config ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
select BT_CENTRAL
|
||||||
|
select BT_GATT_CLIENT
|
||||||
|
select BT_GATT_AUTO_DISCOVER_CCC
|
||||||
|
|
||||||
|
if ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
|
||||||
|
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
|
||||||
|
int "BLE split central write thread stack size"
|
||||||
|
default 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)"
|
||||||
|
default 5
|
||||||
|
|
||||||
|
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 650
|
||||||
|
|
||||||
|
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 ZMK_USB
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BT_MAX_PAIRED
|
||||||
|
default 1
|
||||||
|
|
||||||
|
config BT_MAX_CONN
|
||||||
|
default 1
|
||||||
|
|
||||||
|
config BT_PERIPHERAL_PREF_MAX_INT
|
||||||
|
default 6
|
||||||
|
|
||||||
|
#!ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
endif
|
||||||
|
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
#ZMK_SPLIT_BLE
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if ZMK_BLE
|
||||||
|
|
||||||
|
if ZMK_SPLIT_BLE && ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
|
||||||
|
config BT_MAX_CONN
|
||||||
|
default 6
|
||||||
|
|
||||||
|
config BT_MAX_PAIRED
|
||||||
|
default 6
|
||||||
|
|
||||||
|
#ZMK_SPLIT_BLE && ZMK_SPLIT_ROLE_CENTRAL
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !ZMK_SPLIT_BLE
|
||||||
|
|
||||||
|
config BT_MAX_CONN
|
||||||
|
default 5
|
||||||
|
|
||||||
|
config BT_MAX_PAIRED
|
||||||
|
default 5
|
||||||
|
|
||||||
|
#!ZMK_SPLIT_BLE
|
||||||
|
endif
|
||||||
|
|
||||||
|
#ZMK_BLE
|
||||||
|
endif
|
||||||
|
|
|
@ -320,10 +320,10 @@ Remember that `.c` files should be formatted according to `clang-format` to ensu
|
||||||
|
|
||||||
### Updating `app/CmakeLists.txt` to include the new driver
|
### Updating `app/CmakeLists.txt` to include the new driver
|
||||||
|
|
||||||
Most behavior drivers' are invoked according to the central half's [locality](#api-structure), and are therefore stored after the line `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)` in the form, `target_sources(app PRIVATE src/behaviors/<behavior_name>.c)`, as shown below.
|
Most behavior drivers' are invoked according to the central half's [locality](#api-structure), and are therefore stored after the line `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)` in the form, `target_sources(app PRIVATE src/behaviors/<behavior_name>.c)`, as shown below.
|
||||||
|
|
||||||
```txt title="app/CmakeLists.txt"
|
```txt title="app/CmakeLists.txt"
|
||||||
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
|
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
|
||||||
|
@ -346,9 +346,9 @@ endif()
|
||||||
|
|
||||||
For behaviors that do not require central locality, the following options for updating `app/CmakeLists.txt` also exist:
|
For behaviors that do not require central locality, the following options for updating `app/CmakeLists.txt` also exist:
|
||||||
|
|
||||||
- Behavior applies to unibody, or central or peripheral half of keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` line _before_ `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)`
|
- Behavior applies to unibody, or central or peripheral half of keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` line _before_ `if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
|
||||||
- Behavior applies to _only_ central half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)`
|
- Behavior applies to _only_ central half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_ROLE_CENTRAL)`
|
||||||
- Behavior applies to _only_ peripheral half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))`
|
- Behavior applies to _only_ peripheral half of split keyboard: place `target_sources(app PRIVATE <behavior_name>.c)` after `if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL))`
|
||||||
- Behavior requires certain condition in a keyboard's `.conf` file to be met: use `target_sources_ifdef(CONFIG_<Configuration Requirement> app PRIVATE <behavior_name>.c)` instead of `target_sources(<behavior_name>.c)`
|
- Behavior requires certain condition in a keyboard's `.conf` file to be met: use `target_sources_ifdef(CONFIG_<Configuration Requirement> app PRIVATE <behavior_name>.c)` instead of `target_sources(<behavior_name>.c)`
|
||||||
|
|
||||||
### Defining common use-cases for the behavior (`.dtsi`) (Optional)
|
### Defining common use-cases for the behavior (`.dtsi`) (Optional)
|
||||||
|
|
|
@ -100,7 +100,7 @@ if SHIELD_MY_BOARD_LEFT
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "My Board"
|
default "My Board"
|
||||||
|
|
||||||
config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
config ZMK_SPLIT_ROLE_CENTRAL
|
||||||
default y
|
default y
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue