Commit graph

84 commits

Author SHA1 Message Date
Pete Johanson
5072590af5 fix(sensors): Use status filter on sensors node. 2020-12-31 14:46:15 -05:00
KemoNine
d207c3c30f
(feature) Add &to keycode/behavior (#489)
feat(behaviors): Add `&to` behavior to switch to a layer.
2020-12-29 11:57:49 -05:00
KemoNine
87dbd4ca28
Add uppermost, current layer status widget to oled (#493)
* Add uppermost, current layer status widget to oled

* Run clang format

* Fixup display widget source includes in CMakeLists

* Update layer widget to only be enabled on primary half of a split keyboard and shuffle some of the options specific to the widget to be enabled via the widget

* Update to latest lvgl/zmk/zephyr ; remove version text from oled per PR

* Fixup file names

* Remove last remenants of the version display text from the oled

* Fixup clang-format

Co-authored-by: KemoNine <mcrosson@kemonine.info>
2020-12-28 20:17:32 -05:00
innovaker
0e71dbc860 refactor(app): replace zmk_keymap_layers_state with zmk_keymap_layers_state_t
Aligns with typedef _t convention.

PR: #531
2020-12-28 10:20:12 -05:00
innovaker
87e7c04b00 refactor(app): replace zmk_mod_flags with zmk_mod_flags_t
Aligns with typedef _t convention.

PR: #531
2020-12-28 10:20:12 -05:00
innovaker
05b0d185a8 refactor(app): replace zmk_mod with zmk_mod_t
Aligns with typedef _t convention.

PR: #531
2020-12-28 10:20:12 -05:00
innovaker
87179698b4 refactor(app): replace zmk_key with zmk_key_t
Aligns with typedef _t convention.

PR: #531
2020-12-28 10:20:12 -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
innovaker
f8e43932ba refactor(app): remove zmk_action
zmk_action isn't referenced anywhere.

PR: #530
2020-12-21 23:34:40 -05:00
innovaker
1f5680f0df refactor(app): remove handlers.h
handlers.h isn't referenced elsewhere.

PR: #526
2020-12-21 23:26:52 -05:00
innovaker
0d52915756 chore(display): align status_screen copyright
PR: #535
2020-12-21 23:15:53 -05:00
innovaker
e2aef89d99 refactor(endpoints): rename usage_report parameter to usage_page
Aligns zmk_endpoints_send_report function declaration with its definition.

PR: #522
2020-12-17 16:40:59 -05:00
Pete Johanson
f7c16dfe69 refactor(power): Extract activity/idle detection.
* Refactor power to extract more general purpose
  activity detection/events.
* Use activity state to implement PM callback.
2020-12-14 15:31:10 -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
KemoNine
2427a4ab33
feature(keymaps): Keymap layer state event, highest layer API
* Fire an event w/ layer number, state, and timestamp
  when a layer is activated/deactivated.
* Add `zmk_keymap_highest_layer_active()` query.

Co-authored-by: KemoNine <mcrosson@kemonine.info>
2020-12-09 09:35:57 -05:00
Pete Johanson
7ea1892bbb fix(display): All display updates in work thread.
* Make sure all LVGL access is from main work thread.
2020-12-06 22:47:21 -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
Pete Johanson
d5ea426975 refactor(battery): Fire event on battery event. 2020-12-02 16:04:56 -05:00
Okke Formsma
bee45f9b3a feat(events): add timestamp to keycode_state_changed and sensor_event
These timestamps are necessary to correctly deal with delayed events due to hold-tap shenanigans.
2020-11-28 00:58:24 -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
b6e63683d4 refactor(hid): Replace modifier usage values with their cpp definitions
Improves readability of the HID reports.
2020-11-20 22:26:42 -05:00
innovaker
c21897856b refactor(app): Replace HID_EXT_USAGE with HID_USAGE
Simplifies terminology and improves readability.
2020-11-10 21:00:20 +00:00
innovaker
194854ff7b refactor(hid): Replace 0x01 with HID_USAGE_CONSUMER_CONSUMER_CONTROL
This should've changed alongside: 711658206f
2020-11-06 09:53:23 -05:00
Pete Johanson
eff1b8223b refactor(keys): Unify usage page.
* Remove need for separate `&cp` behavior, but
  keep it for now for backward compat.
* Refactor sensor inc/dec as well.
2020-11-05 14:55:40 -05:00
innovaker
7e795bf4f9 feat(hid): Enhance consumer report to support higher codes
Switch from single byte to double byte usages.

Allow the entire 0x0C page for future compatibility.

Closes #234.  Co-requisite of #21.
2020-11-03 23:50:54 -05:00
innovaker
711658206f refactor(hid): Replace Zephyr usages with ZMK usages in HID reports
Replace `USAGE_GEN_DESKTOP` with `HID_USAGE_GD`.

Replace `USAGE_GEN_DESKTOP_KEYBOARD` with `HID_USAGE_GD_KEYBOARD`.

Replace `USAGE_GEN_DESKTOP_KEYPAD` with `HID_USAGE_KEY`.

Replace `0x0C` with `HID_USAGE_CONSUMER`.

Closes #217.
2020-11-03 23:50:54 -05:00
Pete Johanson
32e7159373 refactor(hid): Mod defines in dedicated header. 2020-11-03 00:21:20 -05:00
Okke Formsma
55b5936d00 clang-format 2020-11-03 00:19:37 -05:00
Okke Formsma
4f258efbf1 initial implementation for modifiers
https://github.com/zmkfirmware/zmk/issues/86
2020-11-03 00:19:37 -05:00
Pete Johanson
2d31e1d05f
Merge pull request #269 from joelspadin/endpoint-selection
feat: only send HID reports to one endpoint
2020-10-31 00:09:47 -04: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
innovaker
c402e953f6 feat(hid): Make keypad report boot friendly
Add missing byte to make keypad report boot friendly.
2020-10-27 22:55:40 +00:00
innovaker
8ce7d8de01 refactor(hid): Refactor consumer report to a configurable size 2020-10-27 22:36:26 +00:00
innovaker
f4596fc784 refactor(hid): Refactor keypad report to use a configurable integer array
Replace NKRO bit array with configurable integer (DV) array.
2020-10-27 22:36:26 +00:00
Pete Johanson
6d9aa4f5ea fix: Updated copyright headers to single author file. 2020-10-12 13:03:10 -04:00
Okke Formsma
d38740cebf
Add timestamps to position and behavior events (#147)
* Add timestamps to position events and behaviors.

- Take original event timestamps into consideration so nested tap-holds have proper timing.
- Add position and timestamp to keycode state changed event so the one-shot behavior can properly identify other keypresses and timings.
- Add timestamp to position events received from peripheral

* reduce number of arguments to behaviors
2020-10-10 17:32:53 -04:00
Pete Johanson
bbf5a5905a refactor(usb): Report USB status w/o HID output. 2020-10-04 21:56:09 -04:00
Dev
c68e3d3e42 Add missing licensing header
Fixes #205
2020-10-02 13:14:31 +05:30
Pete Johanson
307a8d09db feat(usb): Function to access latest USB status.
* To be leveraged by upcoming power
  management work.
2020-10-01 17:18:01 -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
39f980a06d feat(bluetooth): Add back profiles, split fixes.
* Add back in profiles, not using Zephyr
  BT identity infrastructure.
* Restore additional `&bt` commands for profile
  operations.
* Fix for split pairing and subscriptions, since
  Zephyr persists subscriptions across connects.
* Remove keymap from peripheral builds, reduces
  firmware size, and avoids unneeded attempts
  to send HID data.
2020-09-13 22:33:29 -04:00
Pete Johanson
fc0812bd2e fix(bluetooth): Remove identity, minimal bt.
* Simplify the `bt` behavior to one current command
  `BT_CLEAR_BONDS_CMD`.
* Simplify BLE code for split and non-split keyboards.
* Remove keymap processing from split peripheral side.
2020-09-13 22:33:05 -04:00
Pete Johanson
cf970efb98 feat(bluetooth): Proper bond management, identity support for non-splits
* Add `bt` behavior that can be used to perform certain actions,
  such as next/prev identity, reset identity, etc.
  NOTE: Multiple identities is only supported for non-split shields,
  due to missing Zephyr identity functionality for dual
  central/peripheral devices.
* Proper bond reset tied to action, that honors peripheral bonds,
  so folks can reset and pair to other hosts, without breaking
  bonds between splt halves.
2020-09-13 22:33:05 -04:00
Pete Johanson
68e72f9275 fix: Switch to single AUTHORS file.* Closes #164 2020-09-10 10:24:23 -04:00
Okke Formsma
c5ca664411 some fixes based on feedback 2020-09-02 15:26:06 +02:00
Okke Formsma
c33931c72c Initial implementation of hold-tap 2020-09-01 19:41:08 +02:00