Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Kconfig): Extracted designer defaults out into new files #2537

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
34 changes: 4 additions & 30 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,11 @@ if ZMK_HID_REPORT_TYPE_HKRO

config ZMK_HID_KEYBOARD_REPORT_SIZE
int "# Keyboard Keys Reportable"
default 6

endif

config ZMK_HID_CONSUMER_REPORT_SIZE
int "# Consumer Keys Reportable"
default 6


choice ZMK_HID_CONSUMER_REPORT_USAGES
prompt "HID Report Type"
Expand Down Expand Up @@ -163,17 +160,14 @@ if ZMK_BLE
config ZMK_BLE_EXPERIMENTAL_CONN
bool "Experimental BLE connection changes"
help
Enables a combination of settings that are planned to be default in future versions of ZMK
to improve connection stability. This includes changes to timing on BLE pairing initiation,
restores use of the updated/new LLCP implementation, and disables 2M PHY support.
Enables settings that are planned to be default in future versions of ZMK
to improve connection stability.

config ZMK_BLE_EXPERIMENTAL_SEC
bool "Experimental BLE security changes"
imply BT_SMP_ALLOW_UNAUTH_OVERWRITE
help
Enables a combination of settings that are planned to be officially supported in the future.
This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from
previously paired hosts.
Enables security settings that are planned to be officially supported in the future.

config ZMK_BLE_EXPERIMENTAL_FEATURES
bool "Experimental BLE connection and security settings/features"
Expand Down Expand Up @@ -292,67 +286,51 @@ menuconfig ZMK_RGB_UNDERGLOW

if ZMK_RGB_UNDERGLOW

# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
config SPI
default y

config ZMK_RGB_UNDERGLOW_EXT_POWER
bool "RGB underglow toggling also controls external power"
default y

config ZMK_RGB_UNDERGLOW_BRT_MIN
int "RGB underglow minimum brightness in percent"
range 0 100
default 0

config ZMK_RGB_UNDERGLOW_BRT_MAX
int "RGB underglow maximum brightness in percent"
range ZMK_RGB_UNDERGLOW_BRT_MIN 100
default 100

config ZMK_RGB_UNDERGLOW_HUE_STEP
int "RGB underglow hue step in degrees"
range 0 359
default 10

config ZMK_RGB_UNDERGLOW_SAT_STEP
int "RGB underglow saturation step in percent"
range 0 100
default 10

config ZMK_RGB_UNDERGLOW_BRT_STEP
int "RGB underglow brightness step in percent"
range 0 100
default 10

config ZMK_RGB_UNDERGLOW_HUE_START
int "RGB underglow start hue value in degrees"
range 0 359
default 0

config ZMK_RGB_UNDERGLOW_SAT_START
int "RGB underglow start saturations value in percent"
range 0 100
default 100

config ZMK_RGB_UNDERGLOW_BRT_START
int "RGB underglow start brightness value in percent"
range ZMK_RGB_UNDERGLOW_BRT_MIN ZMK_RGB_UNDERGLOW_BRT_MAX
default ZMK_RGB_UNDERGLOW_BRT_MAX

config ZMK_RGB_UNDERGLOW_SPD_START
int "RGB underglow start animation speed value"
range 1 5
default 3

config ZMK_RGB_UNDERGLOW_EFF_START
int "RGB underglow start effect int value related to the effect enum list"
range 0 3
default 0

config ZMK_RGB_UNDERGLOW_ON_START
bool "RGB underglow starts on by default"
default y

config ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE
bool "Turn off RGB underglow when keyboard goes into idle state"
Expand All @@ -373,16 +351,13 @@ if ZMK_BACKLIGHT
config ZMK_BACKLIGHT_BRT_STEP
int "Brightness step in percent"
range 1 100
default 20

config ZMK_BACKLIGHT_BRT_START
int "Default brightness in percent"
range 1 100
default 40

config ZMK_BACKLIGHT_ON_START
bool "Default backlight state"
default y

config ZMK_BACKLIGHT_AUTO_OFF_IDLE
bool "Turn off backlight when keyboard goes into idle state"
Expand Down Expand Up @@ -451,7 +426,6 @@ endif

config ZMK_EXT_POWER
bool "Enable support to control external power output"
default y

config ZMK_PM
bool
Expand Down Expand Up @@ -674,7 +648,6 @@ endif
config ZMK_BATTERY_REPORT_INTERVAL
depends on ZMK_BATTERY_REPORTING
int "Battery level report interval in seconds"
default 60

config ZMK_LOW_PRIORITY_WORK_QUEUE
bool "Work queue for low priority items"
Expand Down Expand Up @@ -747,5 +720,6 @@ rsource "boards/shields/*/Kconfig.shield"
osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.defconfig"
osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.shield"

rsource "Kconfig.defaults"

source "Kconfig.zephyr"
85 changes: 85 additions & 0 deletions app/Kconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

# HID
if ZMK_HID_REPORT_TYPE_HKRO

config ZMK_HID_KEYBOARD_REPORT_SIZE
default 6

endif

config ZMK_HID_CONSUMER_REPORT_SIZE
default 6

# Underglow
if ZMK_RGB_UNDERGLOW

# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
config SPI
default y

config ZMK_RGB_UNDERGLOW_EXT_POWER
default y

config ZMK_RGB_UNDERGLOW_BRT_MIN
default 0

config ZMK_RGB_UNDERGLOW_BRT_MAX
default 100

config ZMK_RGB_UNDERGLOW_HUE_STEP
default 10

config ZMK_RGB_UNDERGLOW_SAT_STEP
default 10

config ZMK_RGB_UNDERGLOW_BRT_STEP
default 10

config ZMK_RGB_UNDERGLOW_HUE_START
default 0

config ZMK_RGB_UNDERGLOW_SAT_START
default 100

config ZMK_RGB_UNDERGLOW_BRT_START
default ZMK_RGB_UNDERGLOW_BRT_MAX

config ZMK_RGB_UNDERGLOW_SPD_START
default 3

config ZMK_RGB_UNDERGLOW_EFF_START
default 0

config ZMK_RGB_UNDERGLOW_ON_START
default y

#ZMK_RGB_UNDERGLOW
endif

# Backlight
if ZMK_BACKLIGHT

config ZMK_BACKLIGHT_BRT_STEP
default 20

config ZMK_BACKLIGHT_BRT_START
default 40

config ZMK_BACKLIGHT_ON_START
default y

#ZMK_BACKLIGHT
endif

# Ext_power
config ZMK_EXT_POWER
default y

# Battery
config ZMK_BATTERY_REPORT_INTERVAL
default 60

# Imports
rsource "src/split/Kconfig.defaults"
2 changes: 1 addition & 1 deletion app/module/drivers/sensor/ec11/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ menuconfig EC11

if EC11

choice
choice EC11_TRIGGER_MODE
prompt "Trigger mode"
default EC11_TRIGGER_NONE
help
Expand Down
4 changes: 4 additions & 0 deletions app/src/split/Kconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

rsource "bluetooth/Kconfig.defaults"
40 changes: 5 additions & 35 deletions app/src/split/bluetooth/Kconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
#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.
#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
Expand All @@ -16,15 +16,14 @@ config ZMK_SPLIT_ROLE_CENTRAL
select BT_GATT_AUTO_DISCOVER_CCC
select BT_SCAN_WITH_IDENTITY

# Bump this value needed for concurrent GATT discovery of splits
#Bump this value needed for concurrent GATT discovery of splits
config BT_L2CAP_TX_BUF_COUNT
default 5 if ZMK_SPLIT_ROLE_CENTRAL

if ZMK_SPLIT_ROLE_CENTRAL

config ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
int "Number of peripherals that will connect to the central."
default 1

menuconfig ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING
bool "Fetch Peripheral Battery Level Info"
Expand Down Expand Up @@ -92,7 +91,7 @@ config BT_MAX_PAIRED
config BT_MAX_CONN
default 1

# Allow central to specify connection parameters.
#Allow central to specify connection parameters.
config BT_GAP_AUTO_UPDATE_CONN_PARAMS
default n

Expand All @@ -103,32 +102,3 @@ 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

33 changes: 33 additions & 0 deletions app/src/split/bluetooth/Kconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

if ZMK_BLE

if ZMK_SPLIT_BLE && ZMK_SPLIT_ROLE_CENTRAL

config ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS
default 1

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

6 changes: 3 additions & 3 deletions app/src/studio/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT
#Copyright(c) 2024 The ZMK Contributors
#SPDX - License - Identifier : MIT

menuconfig ZMK_STUDIO
bool "Studio Support"
Expand Down Expand Up @@ -32,7 +32,7 @@ endif
menuconfig ZMK_STUDIO_RPC
bool "Remote Procedure Calls (RPC)"
select NANOPB
# These two save stack size
#These two save stack size
imply NANOPB_NO_ERRMSG
imply NANOPB_WITHOUT_64BIT
imply ZMK_STUDIO_LOCKING if !ARCH_POSIX
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/config/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ for more information on configuring Bluetooth.
| `CONFIG_ZMK_BLE_KEYBOARD_REPORT_QUEUE_SIZE` | int | Max number of keyboard HID reports to queue for sending over BLE | 20 |
| `CONFIG_ZMK_BLE_INIT_PRIORITY` | int | BLE init priority | 50 |
| `CONFIG_ZMK_BLE_THREAD_PRIORITY` | int | Priority of the BLE notify thread | 5 |
| `CONFIG_ZMK_BLE_THREAD_STACK_SIZE` | int | Stack size of the BLE notify thread | 512 |
| `CONFIG_ZMK_BLE_THREAD_STACK_SIZE` | int | Stack size of the BLE notify thread | 768 |
| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Experimental: require typing passkey from host to pair BLE connection | n |

Note that `CONFIG_BT_MAX_CONN` and `CONFIG_BT_MAX_PAIRED` should be set to the same value. On a split keyboard they should only be set for the central and must be set to one greater than the desired number of bluetooth profiles.
Expand Down Expand Up @@ -132,6 +132,6 @@ Following [split keyboard](../features/split-keyboards.md) settings are defined
| `CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE` | int | Max number of key state events to queue when received from peripherals | 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_STACK_SIZE` | int | Stack size of the BLE split peripheral notify thread | 756 |
| `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 |