Refactor where ZMK KConfigs come from.

This commit is contained in:
Pete Johanson 2020-05-29 00:15:57 -04:00
parent 45f65a0297
commit dbd4cc66c0
6 changed files with 56 additions and 30 deletions

View File

@ -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)

41
Kconfig
View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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);