diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-05-29 00:15:57 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-05-29 00:15:57 -0400 |
commit | dbd4cc66c0cbdc9b02b8ad330edbb5640404810f (patch) | |
tree | cc762a9d5bd437758da8d8f74b521bfbfb0f108d | |
parent | 45f65a0297519418f87b8c8cb2378a3b9127f02b (diff) |
Refactor where ZMK KConfigs come from.
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | Kconfig | 41 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | boards/shields/petejohanson_handwire/Kconfig.defconfig | 9 | ||||
-rw-r--r-- | prj.conf | 21 | ||||
-rw-r--r-- | src/endpoints.c | 12 |
6 files changed, 56 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7103c29..c5868ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ target_sources(app PRIVATE src/hid.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) target_sources_ifdef(CONFIG_ZMK_KSCAN_MOCK_DRIVER app PRIVATE src/kscan_mock.c) target_sources_ifdef(CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER app PRIVATE src/kscan_composite.c) -target_sources(app PRIVATE src/usb_hid.c) +target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c) target_sources(app PRIVATE src/endpoints.c) target_sources(app PRIVATE src/main.c) @@ -1,11 +1,28 @@ mainmenu "ZMK Firmware" +config ZMK_KEYBOARD_NAME + string "Keyboard Name" + +config USB_DEVICE_PRODUCT + default ZMK_KEYBOARD_NAME + +config BT_DEVICE_NAME + default ZMK_KEYBOARD_NAME + config ZMK_KSCAN_EVENT_QUEUE_SIZE int "Size of the event queue for KSCAN events to buffer events" default 4 -config ZMK_BLE - bool "Enable low energy bluetooth support" +menu "HID Output Types" + +config ZMK_USB + bool "USB" + select USB + select USB_DEVICE_STACK + select USB_DEVICE_HID + +menuconfig ZMK_BLE + bool "BLE (HID over GATT)" select BT select BT_SMP select BT_SMP_SC_PAIR_ONLY @@ -15,12 +32,31 @@ config ZMK_BLE if ZMK_BLE +# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others. +config BT_GATT_NOTIFY_MULTIPLE + default n + +config BT_DEVICE_APPEARANCE + default 961 + 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 + config ZMK_KSCAN_MOCK_DRIVER bool "Enable mock kscan driver to simulate key presses" default n @@ -34,7 +70,6 @@ menu "ZMK Actions" config ZMK_ACTION_MOD_TAP bool "Enable the Mod-Tap Action" - default true endmenu @@ -10,7 +10,6 @@ Basic WIP website to learn more: https://zmk.netlify.app/ ## TODO - Document boards/shields/keymaps usage. -- Move most Kconfig setings to the board/keymap defconfigs and out of the toplevel `prj.conf` file. - Display support, including displaying BLE SC auth numbers for "numeric comparison" mode if we have the screen. - Fix BT settings to work w/ Zephyr. Do we really need them? - Tests? diff --git a/boards/shields/petejohanson_handwire/Kconfig.defconfig b/boards/shields/petejohanson_handwire/Kconfig.defconfig index 77bd288..7da09ac 100644 --- a/boards/shields/petejohanson_handwire/Kconfig.defconfig +++ b/boards/shields/petejohanson_handwire/Kconfig.defconfig @@ -1,4 +1,13 @@ if SHIELD_PETEJOHANSON_HANDWIRE +config ZMK_KEYBOARD_NAME + default "Pete's Handwire Breadboard" + +config ZMK_BLE + default y + +config ZMK_ACTION_MOD_TAP + default y + endif @@ -1,23 +1,2 @@ -CONFIG_USB=y -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_HID=y -CONFIG_USB_DEVICE_PRODUCT="ZMK Firmware" -CONFIG_ZMK_BLE=y -CONFIG_ZMK_ACTION_MOD_TAP=y -# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others. -CONFIG_BT_GATT_NOTIFY_MULTIPLE=n -CONFIG_BT_DEVICE_NAME="ZMK Keyboard" -CONFIG_BT_DEVICE_APPEARANCE=961 # CONFIG_LOG=y # CONFIG_ZMK_LOG_LEVEL_DBG=y -# CONFIG_KSCAN_LOG_LEVEL_DBG=y - -# 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 diff --git a/src/endpoints.c b/src/endpoints.c index 668380a..1f2c94d 100644 --- a/src/endpoints.c +++ b/src/endpoints.c @@ -13,12 +13,14 @@ int zmk_endpoints_init() LOG_DBG(""); +#ifdef CONFIG_ZMK_USB err = zmk_usb_hid_init(); if (err) { LOG_ERR("USB HID Init Failed\n"); return err; } +#endif /* CONFIG_ZMK_USB */ #ifdef CONFIG_ZMK_BLE err = zmk_hog_init(); @@ -38,10 +40,12 @@ int zmk_endpoints_send_report() int err; struct zmk_hid_report *report = zmk_hid_get_report(); - // if (zmk_usb_hid_send_report(report) != 0) - // { - // // LOG_DBG("USB Send Failed"); - // } +#ifdef CONFIG_ZMK_USB + if (zmk_usb_hid_send_report(report) != 0) + { + LOG_DBG("USB Send Failed"); + } +#endif /* CONFIG_ZMK_USB */ #ifdef CONFIG_ZMK_BLE err = zmk_hog_send_report(report); |