Commit Graph

25 Commits

Author SHA1 Message Date
Peter Johanson 40cd8da743 fix(usb): Split HID from core USB, logging fix.
* Split core USB init from USB HID init.
* Tweak logging to avoid "log loop" causing
  spurious buffer messages on startup.
2022-04-13 13:07:59 -04:00
Peter Johanson 53dae35710 refactor: Move to `k_work_delayable` API.
* Move to new `k_work_delayable` APIs introduced in Zephyr 2.6.

See: https://docs.zephyrproject.org/latest/releases/release-notes-2.6.html#api-changes
2022-04-03 00:10:29 -04:00
Peter Johanson d05d7ec2d2 feat(endpoints): Add endpoint select changed event. 2021-08-03 00:19:05 -04:00
Pete Johanson 3fe2acc2d1 refactor(core): Extra event payloads to own types, refactor API.
* Make it easier to use *just* event payloads by defining the data,
  and then having event manager macros generate "wrapper structs"
* Improve is_*/cast_* APIs to hide details of full event struct.
* Create `zmk_event_t` typedef to pass to event handlers.
* Bring event names inline w/ consistent `zmk_` prefix.
2021-01-20 07:06:11 -05:00
innovaker 1d18900a99 refactor(core): define usage page as uint16_t
Aligns with the HID specification.

Usage page values were sometimes declared as uint8_t and sometimes uint16_t.  This commit aligns all instances with the HID specification for consistency.

PR: #521
2021-01-15 01:48:39 -05:00
innovaker 842aa5a842 refactor: replace filename hyphens with underscores
Aligns *.h and *.c to underscore naming convention.

These were kept (with warnings) for backwards compatibility with external boards/shields:
- kscan-mock.h
- matrix-transform.h
They should be removed in the future.

PR: #523
2020-12-28 01:15:35 -05:00
Nick 2204a5dce4 refactor(settings): Debounce BLE/endpoint settings saves 2020-12-14 22:46:49 -05:00
Nick Winans 69d48c5715 refactor(settings): Only load used subtrees 2020-12-14 22:46:49 -05:00
innovaker 00ca0d2f1c refactor(app): replace `struct device *` with `const struct device *`
Replaced with RegExp: /(?<!const )(struct device \*)/g

See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html
PR: #467
2020-12-14 12:41:25 -05:00
innovaker bac1f17cf6 refactor(app): replace Zephyr integer types with C99 integer types
u8_t → uint8_t
u16_t → uint16_t
u32_t → uint32_t
u64_t → uint64_t
s8_t → int8_t
s16_t → int16_t
s32_t → int32_t
s64_t → int64_t

Prerequisite for #223
See: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.4.0
PR: #467
2020-12-14 12:41:25 -05:00
Pete Johanson b3f3362b50 feat(display): Initial widget/status screen work.
* Battery and output status widgets
* Built in status screen combining them.
* Ability to define a custom status screen factory
  function.
2020-12-02 16:04:56 -05:00
innovaker 3ac1a11a37 refactor: change `keypad` to `keyboard`
The application usage used by report 1 is `HID_USAGE_GD_KEYBOARD`.  Moreover, the `keys` usage page (0x07) that primarily feeds into this report is predominantly keyboard codes.  The rest of the system should align with this naming convention.
2020-11-21 15:52:16 -05:00
innovaker e925319e4c refactor(hid): Replace deprecated HID usage page references
Deprecate `USAGE_KEYPAD` and replace with `HID_USAGE_KEY`.

Deprecate `USAGE_CONSUMER` and replace with `HID_USAGE_CONSUMER`.

Closes #217.
2020-11-03 23:50:54 -05:00
Joel Spadin 600bba25f0 feat(endpoints): add preferred endpoint setting
Added a new setting to remember the user's preferred endpoint. When both USB and
BLE are connected, the preferred endpoint will be used.

Added a new behavior to control this setting. It supports commands:

    &end END_USB - Prefer USB output
    &end END_BLE - Prefer BLE output
    &end END_TOG - Toggle between USB and BLE
2020-10-28 18:15:05 -05:00
Joel Spadin b538e60532 feat(endpoints): update on BLE profile change
Added zmk_ble_active_profile_is_connected() to allow code outside ble.c to check
the status of the active profile, and changed the ble_active_profile_changed
event to also notify when the active profile connects or disconnects.

Changed endpoint selection to to also update when the active profile changes,
connects, or disconnects.
2020-10-28 18:15:05 -05:00
Joel Spadin 8f666cecc9 feat(endpoints): clear HID report on endpoint change
This prevents stuck keys when switching endpoints by clearing
everything in the HID report and sending one last report before
switching to the new endpoint.
2020-10-28 18:15:05 -05:00
Joel Spadin 1d369ffa73 feat: only send HID reports to one endpoint
Added some utility functions and an event for tracking the state of the
USB connection.

Updated endpoints.c to select a single endpoint to send HID reports to
based on the status of the USB and BLE connections. Partially fixes #206.

Future commits will add a user setting to control which endpoint is used if
both USB and BLE are ready.
2020-10-28 18:15:05 -05:00
Pete Johanson bbf5a5905a refactor(usb): Report USB status w/o HID output. 2020-10-04 21:56:09 -04:00
Pete Johanson 191a2d755a chore: clang-format the codebase.
* Use the LLVM style
* Override indent width (8) and column limit (100)
* Fixes #142.
2020-09-14 00:10:34 -04:00
Pete Johanson 68e72f9275 fix: Switch to single AUTHORS file.* Closes #164 2020-09-10 10:24:23 -04:00
Pete Johanson d1cb3969f0 Remove extra '#'. 2020-07-25 23:17:19 -04:00
Pete Johanson 7c5fb7adb5 Use SYS_INIT for BLE and USB init. 2020-07-07 10:20:23 -04:00
Pete Johanson 55cf9db564 Fix consumer keys w/ refactored behaviors. 2020-06-22 11:06:01 -04:00
Pete Johanson d65629b9a0 Lots more pieces toward HID working again. 2020-06-20 00:11:39 -04:00
Pete Johanson 38f1dbd984 Move Zephyr app into subdirectory. 2020-06-08 21:07:16 -04:00
Renamed from src/endpoints.c (Browse further)