Commit graph

123 commits

Author SHA1 Message Date
Ally Parker
a4aaa73f06 feat: Add WPM calculator and display widget 2021-01-23 18:38:31 -05:00
Okke Formsma
5eeb310b2f feat(grave-escape): implement grave-escape
closes #85
2021-01-22 19:27:18 -05:00
Pete Johanson
3368a81057 refactor(core): Combine is_ and cast_ event functions.
* Use a single `as_foo` generated function to conditionally
  return a certain event type from a generic `zmk_event_t*`
  pointer.
2021-01-20 07:06:11 -05: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
Pete Johanson
003db892ad refactor(core): Extra position state change data struct.
* Separate header and data struct for the event.
* Remove duplicate struct in split code.
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
KemoNine
99f932a47d (feat) Allow setting underglow color by key press 2021-01-08 16:08:13 -05:00
Pete Johanson
a55b1397c9 feat(keymap): API for retrieving label for a layer 2021-01-04 13:02:38 -05:00
Okke Formsma
fa07ba9d32 refactor(behaviors): use ZMK_BEHAVIOR_OPAQUE and ZMK_BEHAVIOR_TRANSPARENT
Use these instead of the magic return values 0 and 1 for
behavior_driver_api return values.
2021-01-01 23:07:54 -05:00
Okke Formsma
caa285852a refactor(events): return 'ZMK_EV_EVENT_BUBBLE' instead of magic number 0 2021-01-01 23:07:54 -05:00
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
33c959d031 refactor(app): replace driver_api with api
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
c6abdb1890 fix(keys): Replace GUI with Application / Context Menu
This was a misrepresentation in the standardized keys that originated in earlier code.
2020-11-04 14:31:59 -05:00
innovaker
a65295c2a7 feat(keys): Standardize keys
Deprecate superseded names with comments.

Add standardized key names.

Closes #21.  Closes #158.  Closes #161.  Closes #246.
2020-11-03 23:50:54 -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
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
innovaker
3c0a0ff308 feat(hid): Add preprocessor definitions for HID usages v1.21
Developed from specification:
https://usb.org/sites/default/files/hut1_21.pdf

Closes #217.  Prerequisite of #21.
2020-11-03 23:50:54 -05:00
Pete Johanson
a29e041b1f fix: Formatting fix. 2020-11-03 00:30:42 -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
440d09fd45 feat(endpoints): simplify behavior constants 2020-10-28 18:15:05 -05:00
Joel Spadin
2fe1fbb526 feat(endpoints): rename behavior to outputs
"Outputs" is probably easier for most people to understand than "endpoints".
2020-10-28 18:15:05 -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