Skip to content

Commit

Permalink
refactor(Kconfig): Refactored some if blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Munnich committed Nov 16, 2024
1 parent 4005045 commit fc1884b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 83 deletions.
52 changes: 10 additions & 42 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ config BT_DIS_MANUF
default "ZMK Project"

# Hardware specific overrides

if SOC_SERIES_NRF52X

# Default on for our usage until boards implement retained bootmode.
config NRF_STORE_REBOOT_TYPE_GPREGRET
bool
depends on SOC_SERIES_NRF52X
default y

endif # SOC_SERIES_NRF52X

menu "HID"

choice ZMK_HID_REPORT_TYPE
Expand Down Expand Up @@ -76,13 +72,9 @@ config ZMK_HID_KEYBOARD_NKRO_EXTENDED_REPORT
Enables higher usage range for NKRO (F13-F24 and INTL1-9).
Please note this is not compatible with Android currently and you will get no input


if ZMK_HID_REPORT_TYPE_HKRO

config ZMK_HID_KEYBOARD_REPORT_SIZE
int "# Keyboard Keys Reportable"

endif # ZMK_HID_REPORT_TYPE_HKRO
depends on ZMK_HID_REPORT_TYPE_HKRO

config ZMK_HID_CONSUMER_REPORT_SIZE
int "# Consumer Keys Reportable"
Expand Down Expand Up @@ -258,14 +250,11 @@ config ZMK_KEYMAP_SETTINGS_STORAGE
depends on SETTINGS
depends on ZMK_BEHAVIOR_LOCAL_IDS

if ZMK_KEYMAP_SETTINGS_STORAGE

config ZMK_KEYMAP_LAYER_NAME_MAX_LEN
int "Max Layer Name Length"
depends on ZMK_KEYMAP_SETTINGS_STORAGE
default 20

endif # ZMK_KEYMAP_SETTINGS_STORAGE

endmenu # Keymaps

rsource "src/studio/Kconfig"
Expand Down Expand Up @@ -492,57 +481,45 @@ config ZMK_USB_HID_INIT_PRIORITY

endif # USB

if ZMK_BLE || ZMK_SPLIT_BLE

config ZMK_BLE_INIT_PRIORITY
int "BLE Init Priority"
depends on ZMK_BLE || ZMK_SPLIT_BLE
default 50

endif # ZMK_BLE || ZMK_SPLIT_BLE

endmenu # Initialization Priorities

menuconfig ZMK_KSCAN
bool "ZMK KScan Integration"
default y
select KSCAN

if ZMK_KSCAN

config ZMK_KSCAN_EVENT_QUEUE_SIZE
int "Size of the event queue for KSCAN events to buffer events"
depends on ZMK_KSCAN
default 4

endif # ZMK_KSCAN

config ZMK_KSCAN_SIDEBAND_BEHAVIORS
bool
default y
depends on DT_HAS_ZMK_KSCAN_SIDEBAND_BEHAVIORS_ENABLED
select KSCAN

if ZMK_KSCAN_SIDEBAND_BEHAVIORS

config ZMK_KSCAN_SIDEBAND_BEHAVIORS_INIT_PRIORITY
int "Keyboard scan sideband behaviors driver init priority"
depends on ZMK_KSCAN_SIDEBAND_BEHAVIORS
# The default kscan init priority is 90, so be sure we are initialized later.
default 95

endif # ZMK_KSCAN_SIDEBAND_BEHAVIORS

menu "Logging"

config ZMK_LOGGING_MINIMAL
bool "Suppress all ZMK debug log messages"
default false

if !ZMK_LOGGING_MINIMAL

config ZMK_LOG_LEVEL
depends on !ZMK_LOGGING_MINIMAL
default 4

endif

config ZMK_USB_LOGGING
bool "Enable USB CDC ACM logging to help debug"
select LOG
Expand Down Expand Up @@ -585,13 +562,10 @@ config ZMK_RTT_LOGGING
select CONSOLE
select RTT_CONSOLE

if ZMK_RTT_LOGGING

config SEGGER_RTT_BUFFER_SIZE_UP
depends on ZMK_RTT_LOGGING
default 8192

endif # ZMK_RTT_LOGGING

if ZMK_USB_LOGGING || ZMK_RTT_LOGGING

config LOG_BUFFER_SIZE
Expand All @@ -609,17 +583,14 @@ if SETTINGS
config ZMK_SETTINGS_RESET_ON_START
bool "Delete all persistent settings when the keyboard boots"

if ZMK_SETTINGS_RESET_ON_START

config ZMK_SETTINGS_RESET_ON_START_INIT_PRIORITY
int "Settings Reset ON Start Initialization Priority"
depends on ZMK_SETTINGS_RESET_ON_START
default 60
help
Initialization priority for the settings reset on start. Must be lower priority/
higher value than FLASH_INIT_PRIORITY if using the NVS/Flash settings backend.

endif # ZMK_SETTINGS_RESET_ON_START

config ZMK_SETTINGS_SAVE_DEBOUNCE
int "Milliseconds to debounce settings saves"
default 60000
Expand Down Expand Up @@ -670,19 +641,16 @@ config ZMK_KEYMAP_SENSORS
depends on DT_HAS_ZMK_KEYMAP_SENSORS_ENABLED
select SENSOR

if ZMK_KEYMAP_SENSORS

config ZMK_KEYMAP_SENSORS_DEFAULT_TRIGGERS_PER_ROTATION
int "Default triggers per rotation"
depends on ZMK_KEYMAP_SENSORS
help
Unless overridden for a sensor in the board/shield/devicetree, this value
determines how many times to trigger the bound behavior per full rotation.
For tactile encoders with detents, this usually should match the number of
detents per rotation of the encoder.
default 20

endif # ZMK_KEYMAP_SENSORS

choice CBPRINTF_IMPLEMENTATION
default CBPRINTF_NANO

Expand Down
5 changes: 1 addition & 4 deletions app/Kconfig.behaviors
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,13 @@ config ZMK_BEHAVIOR_STICKY_KEY
default y
depends on DT_HAS_ZMK_BEHAVIOR_STICKY_KEY_ENABLED

if ZMK_BEHAVIOR_STICKY_KEY

config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD
int "Sticky Key Max Held"
depends on ZMK_BEHAVIOR_STICKY_KEY
default 10
help
Max number of simultaneously held sticky keys

endif

config ZMK_BEHAVIOR_SOFT_OFF
bool
default y
Expand Down
13 changes: 1 addition & 12 deletions app/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
# 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
depends on ZMK_RGB_UNDERGLOW
default y

config ZMK_RGB_UNDERGLOW_EXT_POWER
Expand Down Expand Up @@ -55,11 +50,7 @@ config ZMK_RGB_UNDERGLOW_EFF_START
config ZMK_RGB_UNDERGLOW_ON_START
default y

endif # ZMK_RGB_UNDERGLOW

# Backlight
if ZMK_BACKLIGHT

config ZMK_BACKLIGHT_BRT_STEP
default 20

Expand All @@ -69,8 +60,6 @@ config ZMK_BACKLIGHT_BRT_START
config ZMK_BACKLIGHT_ON_START
default y

endif # ZMK_BACKLIGHT

# Ext_power
config ZMK_EXT_POWER
default y
Expand Down
9 changes: 3 additions & 6 deletions app/src/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ config ZMK_DISPLAY_BLANK_ON_IDLE
bool "Blank display on idle"
default y if SSD1306

if LV_USE_THEME_MONO

config ZMK_DISPLAY_INVERT
bool "Invert display colors"

endif
depends on LV_USE_THEME_MONO

choice LV_TXT_ENC
default LV_TXT_ENC_UTF8
Expand All @@ -28,8 +25,8 @@ endchoice
config LV_MEM_CUSTOM
default y

config LV_Z_MEM_POOL_SIZE
default 4096 if ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
config LV_Z_MEM_POOL_SIZE
default 4096 if ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN

choice ZMK_DISPLAY_STATUS_SCREEN
prompt "Default status screen for displays"
Expand Down
5 changes: 1 addition & 4 deletions app/src/split/bluetooth/Kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright(c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

if ZMK_SPLIT && ZMK_SPLIT_BLE

menu "BLE Transport"
depends on ZMK_SPLIT && ZMK_SPLIT_BLE

# Added for backwards compatibility. New shields / board should set `ZMK_SPLIT_ROLE_CENTRAL` only.
config ZMK_SPLIT_BLE_ROLE_CENTRAL
Expand Down Expand Up @@ -98,5 +97,3 @@ config BT_GAP_AUTO_UPDATE_CONN_PARAMS
endif # !ZMK_SPLIT_ROLE_CENTRAL

endmenu

endif # ZMK_SPLIT_BLE
15 changes: 0 additions & 15 deletions app/src/split/bluetooth/Kconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 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

Expand All @@ -14,20 +10,9 @@ config BT_MAX_CONN
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

0 comments on commit fc1884b

Please sign in to comment.