Skip to content

Commit

Permalink
fix(usb): Tweak how ZMK_USB gets enabled.
Browse files Browse the repository at this point in the history
* Previous version of multiple overrides of the default value of ZMK_USB
  were problematic. Move to using board _defconfig files for the
  defaults for those, along with proper `depends on` for ZMK_USB that
  accounts for split and split roles.
  • Loading branch information
petejohanson committed Nov 13, 2023
1 parent 91aa337 commit 74051f1
Show file tree
Hide file tree
Showing 49 changed files with 82 additions and 105 deletions.
13 changes: 8 additions & 5 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ menu "Output Types"

config ZMK_USB
bool "USB"
depends on (!ZMK_SPLIT || (ZMK_SPLIT && ZMK_SPLIT_ROLE_CENTRAL))
select USB
select USB_DEVICE_STACK
select USB_DEVICE_HID

config ZMK_USB_BOOT
bool "USB Boot Protocol Support"
default y
depends on ZMK_USB
select USB_HID_BOOT_PROTOCOL
select USB_DEVICE_SOF

if ZMK_USB

config USB_NUMOF_EP_WRITE_RETRIES
Expand All @@ -103,11 +111,6 @@ config USB_NUMOF_EP_WRITE_RETRIES
config USB_HID_POLL_INTERVAL_MS
default 1

config ZMK_USB_BOOT
bool "USB Boot Protocol Support"
default y
select USB_HID_BOOT_PROTOCOL
select USB_DEVICE_SOF
#ZMK_USB
endif

Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/bdn9/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ config BOARD
config ZMK_KEYBOARD_NAME
default "BDN9 Rev2"

config ZMK_USB
default y

config ZMK_RGB_UNDERGLOW
select SPI
select WS2812_STRIP
Expand Down
1 change: 1 addition & 0 deletions app/boards/arm/bdn9/bdn9_rev2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ CONFIG_HEAP_MEM_POOL_SIZE=1024
# clock configuration
CONFIG_CLOCK_CONTROL=y

CONFIG_ZMK_USB=y
6 changes: 0 additions & 6 deletions app/boards/arm/bluemicro840/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_BLUEMICRO840_V1
3 changes: 3 additions & 0 deletions app/boards/arm/bluemicro840/bluemicro840_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/bt60/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ endif # USB
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config ZMK_KEYBOARD_NAME
default "BT60"

Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/bt60/bt60_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/bt60/bt60_v1_hs_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/ckp/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,4 @@ endif # USB
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_BT60_V2 || BOARD_BT65_V1 || BOARD_BT75_V1
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt60_v2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt65_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/ckp/bt75_v1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ CONFIG_WS2812_STRIP=y
CONFIG_SPI=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/corneish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ config ZMK_SPLIT
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

if USB

config USB_NRFX
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v1_right_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v2_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v2_right_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y

# enable display drivers
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/dz60rgb/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ if BOARD_DZ60RGB_REV1
config ZMK_KEYBOARD_NAME
default "DZ60RGB Rev 1"

config ZMK_USB
default y

endif # BOARD_DZ60RGB_REV1
2 changes: 2 additions & 0 deletions app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=2
CONFIG_CLOCK_STM32_APB2_PRESCALER=1

CONFIG_ZMK_USB=y
3 changes: 0 additions & 3 deletions app/boards/arm/ferris/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ config BOARD
config ZMK_KEYBOARD_NAME
default "Ferris rev 0.2"

config ZMK_USB
default y

config ZMK_KSCAN_MATRIX_POLLING
default y

Expand Down
3 changes: 0 additions & 3 deletions app/boards/arm/kbdfans_tofu65/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ config ZMK_KEYBOARD_NAME
config RP2_FLASH_W25Q080
default y

config ZMK_USB
default y

endif # BOARD_KBDFANS_TOFU65_V2
2 changes: 2 additions & 0 deletions app/boards/arm/kbdfans_tofu65/kbdfans_tofu65_v2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ CONFIG_USE_DT_CODE_PARTITION=y

# Output UF2 by default, native bootloader supports it.
CONFIG_BUILD_OUTPUT_UF2=y

CONFIG_ZMK_USB=y
6 changes: 0 additions & 6 deletions app/boards/arm/mikoto/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ endif # USB
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config PINMUX
default y

Expand Down
6 changes: 0 additions & 6 deletions app/boards/arm/nice60/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_NICE60
4 changes: 4 additions & 0 deletions app/boards/arm/nice60/nice60_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ CONFIG_WS2812_STRIP=y

CONFIG_ZMK_RGB_UNDERGLOW_HUE_START=160
CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3


CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/nice_nano/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2
3 changes: 3 additions & 0 deletions app/boards/arm/nice_nano/nice_nano_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/nice_nano/nice_nano_v2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_BLE=y
CONFIG_ZMK_USB=y
6 changes: 0 additions & 6 deletions app/boards/arm/nrf52840_m2/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_NRF52840_M2
3 changes: 3 additions & 0 deletions app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/nrfmicro/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config PINMUX
default y

Expand Down
3 changes: 3 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_11_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_11_flipped_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_13_52833_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 3 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_13_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
6 changes: 0 additions & 6 deletions app/boards/arm/pillbug/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

endif # BOARD_PILLBUG
3 changes: 3 additions & 0 deletions app/boards/arm/pillbug/pillbug_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_ZMK_USB=y
CONFIG_ZMK_BLE=y
3 changes: 0 additions & 3 deletions app/boards/arm/planck/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ if BOARD_PLANCK_REV6
config ZMK_KEYBOARD_NAME
default "Planck V6"

config ZMK_USB
default y

config ZMK_KSCAN_MATRIX_POLLING
default y

Expand Down
2 changes: 2 additions & 0 deletions app/boards/arm/planck/planck_rev6_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ CONFIG_GPIO=y

# clock configuration
CONFIG_CLOCK_CONTROL=y

CONFIG_ZMK_USB=y
3 changes: 0 additions & 3 deletions app/boards/arm/preonic/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ if BOARD_PREONIC_REV3
config ZMK_KEYBOARD_NAME
default "Preonic V3"

config ZMK_USB
default y

config ZMK_KSCAN_MATRIX_POLLING
default y

Expand Down
2 changes: 2 additions & 0 deletions app/boards/arm/preonic/preonic_rev3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ CONFIG_GPIO=y

# clock configuration
CONFIG_CLOCK_CONTROL=y

CONFIG_ZMK_USB=y
Loading

0 comments on commit 74051f1

Please sign in to comment.