Commit Graph

163 Commits

Author SHA1 Message Date
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 0d80220e14 fix(ble): Raise profile events from work thread.
* Make sure we don't raise events from BLE
  host thread.
2020-12-06 22:47:21 -05:00
Okke Formsma e00eceb508 fix(sticky keys): fix tapping-sticky-keys bug.
Sticky keys should be cleared when they were tapped in rapid succession before the timer runs out.
2020-12-06 00:33:20 -05:00
Okke Formsma f86e0fff14 fix(sticky keys): always clear sticky key when releasing the behavior 2020-12-06 00:33:20 -05:00
Okke Formsma 2ba16c2f3d fix(sticky keys): use correct timestamp when clearing sticky key in timer 2020-12-06 00:33:20 -05:00
Okke Formsma 37946ff57b fix(sticky keys): simplify timer management 2020-12-06 00:33:20 -05:00
Nick 177b28f01d refactor(settings): Add Kconfig option for settings debounce 2020-12-02 19:54:48 -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
innovaker 7b3a55cf50 refactor(ble): silence warning `auth_passkey_display` not used
Silences the following build warning ...

../src/ble.c:407:13: warning: 'auth_passkey_display' defined but not used [-Wunused-function]
  407 | static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
2020-12-01 07:21:45 -05:00
Okke Formsma 3bf770a364 bugfix(sticky keys): release active sticky keys properly
see https://github.com/zmkfirmware/zmk/issues/445
2020-11-29 20:16:51 -05:00
Nick 093719a3b8 feat: Add settings support for external power
fix: clang-format and setting state variable

fix: Fix startup settings configuration

fix(ext_power): Add static to state


fix(ext_power): Set default settings value


Use driver data status instead of global file state
2020-11-28 01:44:35 -05:00
Okke Formsma 76a6d7b4c5 feat(sticky keys): initial implementation 2020-11-28 00:58:24 -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
Nick 248b360f47 fix(ug): Start tick without settings state available 2020-11-23 12:42:27 -05:00
Nick 076fcc1f70 fix(underglow): Fix error on release of rgb_ug 2020-11-22 21:23:29 -05:00
Nick a1d3230eef feat(underglow): RGB toggle controls ext_power
fix(ug): Don't return if finding ext power fails

fix(ug): Move ext_power to a static variable

Add #if defs
2020-11-22 21:23:29 -05:00
innovaker ae924b3594 refactor(hid): replace `kp_report` with `keyboard_report`
Aligns with other existing conventions.
2020-11-22 10:04:35 -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
Okke Formsma e48a6b659c fix momentary layer bug when top layer is not &trans
Key release events released keys on the wrong layer if the 'top layer'
was not &trans above the &mo key.

base    <&mo 1>
layer 1 <&kp B>

This was caused by overwriting
`zmk_keymap_active_behavior_layer[position]` after the &mo key was
handled.
2020-11-16 17:19:27 -05:00
Xudong Zheng 51ca4fbc18 Fix connection to incorrect peripheral 2020-11-11 13:16:31 -05:00
Pete Johanson 7d16186b7a fix(ble): Remove unpair combo code.
* Favor the settings reset images for this.
2020-11-10 14:53:03 -05:00
innovaker 348a44a8a3 refactor(app): Remove obsolete include's of `hid_usage_pages.h`
This should've been done in eff1b8223b.
2020-11-10 14:22:53 -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 d748d8a749 refactor: Replace superseded key names
Replace deprecated key names (LCTL, NUM_0, NUM_1).

Replace abbreviated names with fully qualified names (LCTL, RGUI, NUM_0, NUM_1).

Follow-up to #21.
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
Nick 1af4221908 feat(underglow): Debounce state settings save 2020-11-03 22:08:20 -05:00
Pete Johanson 32e7159373 refactor(hid): Mod defines in dedicated header. 2020-11-03 00:21:20 -05:00
Okke Formsma 4f258efbf1 initial implementation for modifiers
https://github.com/zmkfirmware/zmk/issues/86
2020-11-03 00:19:37 -05:00
Nick Winans 89b8bfc95d fix(battery): Only log if finding battery device failed
Co-authored-by: Pete Johanson <peter@peterjohanson.com>
2020-11-01 23:00:54 -05:00
Nick 953de71646 feat(battery): Add BAS GATT reporting 2020-11-01 23:00:54 -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 821f054071 feat(endpoints): remove redundant connection check 2020-10-28 18:15:05 -05: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
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
innovaker 9c4b766bc6 feat(kscan_mock): Increase max number of events
This is necessary for testing a large number of events (e.g. every key code) within a single build/pass.

The u8_t limitation became apparent during end-to-end testing of #21.
2020-10-25 20:36:03 +00:00
Pete Johanson ef37f17796
Merge pull request #109 from Nicell/underglow/state-persistence
Add RGB underglow state Kconfig and settings
2020-10-18 22:29:55 -04:00
Pete Johanson 9d512eaef0 fix(bluetooth): Add adv data in non-peripherals. 2020-10-16 09:49:28 -04:00
Pete Johanson b07475b7d4 fix(bluetooth): Stop adv on connected profile. 2020-10-16 00:56:05 -04:00
Pete Johanson 818f0a1f91 fix(bluetooth): Advertise name + appearance.
* Properly put device name and GAP appearance
  in advertising packets, for proper display in
  macOS, Android, etc.
* Closes #124
2020-10-16 00:48:53 -04:00
Pete Johanson 204d1300ba fix(ble): Only advertise when needed.* Once we have a peer connected to for the active profile, don't continue advertising. 2020-10-15 00:51:21 -04:00
Pete Johanson f35d9f8f69
Merge pull request #258 from megamind4089/dev/ext-power-behavior
New behavior for ext power control
2020-10-13 00:01:32 -04:00
Pete Johanson 6d9aa4f5ea fix: Updated copyright headers to single author file. 2020-10-12 13:03:10 -04:00