Commit graph

151 commits

Author SHA1 Message Date
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
Mega Mind
2e649b7fd4 Fix compilation errors and minor tweaks 2020-10-13 00:09:57 +08:00
Mega Mind
4adcb396ff Rebased and fixed nasty code 2020-10-12 23:54:56 +08:00
Mega Mind
5d1c083959 Added toggle and removed a param 2020-10-12 23:42:01 +08:00
Mega Mind
b5e1c8a7ad New behavior for ext power control 2020-10-12 23:42:01 +08:00
Joel Spadin
7798c974f6 fix: don't leak bt_conn refs
bt_conn_lookup_addr_le() gives us a new reference that must be released
with bt_conn_unref()
2020-10-11 17:04:34 -05: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
Mega Mind
4d81b10ba7 Added driver to control the external power output
This PR adds support to control the external power output from controllers like nice!nano, nRFMicro etc

I have implemented based on my understanding of Pete suggestion on this feature.

Testing done:

    Tested by enabling and disabling the ext_power from application and verified
    Verified the application does not crash with boards that does not have ext_power support
    Note:
    I did not test this in nice!nano since I don't have the boards. Will get help from others once the behavior PR is up

Next Steps:

    Create a behavior PR to control enable/disable ext_power
2020-10-10 08:11:46 +08:00
Pete Johanson
12b9a37005
Merge pull request #211 from petejohanson/core/keymap-port-event-exploration
Use PORT events for kscan matrix interrupts, add option for deep sleep.
2020-10-06 17:32:35 -04:00
Pete Johanson
a7496ab064 feat(power): Initial deep sleep work.
* New ZMK_SLEEP Kconfig symbol to enable the functionality.
* Switch to PORT events that allows wake from deep sleep.
* Initial basic power management policy, with idle ms,
  and ignoring deep sleep if we detect a USB connection.
2020-10-06 17:24:36 -04:00
Pete Johanson
7d222e1553
Merge pull request #237 from ChaosinaCan/direct-gpio-fix
Fix direct GPIO when using interrupts
2020-10-04 23:04:16 -04:00
Pete Johanson
bbf5a5905a refactor(usb): Report USB status w/o HID output. 2020-10-04 21:56:09 -04:00
Joel Spadin
fc5915b200 improvement(kscan): use ARRAY_SIZE macro 2020-10-04 14:07:14 -05:00