Browse Source

Refactor where ZMK KConfigs come from.

xmkb
Pete Johanson 5 years ago
parent
commit
dbd4cc66c0
  1. 2
      CMakeLists.txt
  2. 41
      Kconfig
  3. 1
      README.md
  4. 9
      boards/shields/petejohanson_handwire/Kconfig.defconfig
  5. 21
      prj.conf
  6. 12
      src/endpoints.c

2
CMakeLists.txt

@ -32,7 +32,7 @@ target_sources(app PRIVATE src/hid.c) @@ -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

@ -1,11 +1,28 @@ @@ -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 @@ -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" @@ -34,7 +70,6 @@ menu "ZMK Actions"
config ZMK_ACTION_MOD_TAP
bool "Enable the Mod-Tap Action"
default true
endmenu

1
README.md

@ -10,7 +10,6 @@ Basic WIP website to learn more: https://zmk.netlify.app/ @@ -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?

9
boards/shields/petejohanson_handwire/Kconfig.defconfig

@ -1,4 +1,13 @@ @@ -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

21
prj.conf

@ -1,23 +1,2 @@ @@ -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

12
src/endpoints.c

@ -13,12 +13,14 @@ int zmk_endpoints_init() @@ -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() @@ -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);

Loading…
Cancel
Save