Commit graph

123 commits

Author SHA1 Message Date
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
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
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
Nick
608ae0df6d fix lint with clang-format 2020-09-15 14:47:19 -05:00
Nick
18d21b0362 Merge remote-tracking branch 'upstream/main' into underglow/state-persistence 2020-09-15 14:41:59 -05: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
4658999e31 fix(bluetooth): Reject pairing to taken profiles. 2020-09-13 22:33:31 -04:00
Pete Johanson
6c8b0b53f0 refactor(bluetooth): More concise names. 2020-09-13 22:33:31 -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
e88d0833c5 fix(bluetooth): Log when clearing on start. 2020-09-13 22:33:05 -04:00
Pete Johanson
b103eb4b05 fix(bluetooth): Delete any previously stored name. 2020-09-13 22:33:05 -04:00
Pete Johanson
13842a8a1e fix(bluetooth): Kconfig to clear bonds on start 2020-09-13 22:33:05 -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
c9a82d71d0 fixes for feedback round 2 2020-09-02 16:41:39 +02: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
Cody McGinnis
639a338c2d fix(core): track layer state with keypress 2020-09-01 09:49:21 -04:00
Cody McGinnis
033bb7bfc4 fix(behavior): add logging to toggle layer for tests 2020-08-28 16:21:31 -04:00
Cody McGinnis
5b21f15a0a fix(test): off by one error with kscan processing 2020-08-28 16:21:31 -04:00
Cody McGinnis
f02fa01e9a fix(test): change the layout 2020-08-28 16:21:31 -04:00
Cody McGinnis
cbea2d5bed fix(behavior): none should not be transparent 2020-08-27 23:12:56 -04:00
Nick
979a5bffff fix(rgb): check if settings enabled 2020-08-23 15:56:18 -05:00
Nick
c5c21022a2 Move settings load 2020-08-23 10:33:19 -05:00
Okke Formsma
ebc3542aa6 fix bug in modtap bahavior which cleared the wrong keycode events 2020-08-23 14:46:52 +02:00
Pete Johanson
805ea77005 feat(behaviors): Add &bootloader behavior.
* Allow reset behavior to have a type property.
* Add `bootloader` node that triggers DFU UF2
  bootloader mode using the AdaFruit nrf52
  bootloader.
2020-08-21 11:23:45 -04:00
Nick
74fd4fc997 fix(rgb): fix underglow settings location 2020-08-20 21:13:17 -05:00
Nick
3ee2d1196b feat(rgb): underglow state Kconfig and settings 2020-08-20 00:07:04 -05:00
Pete Johanson
6ca8e673ac fix(bluetooth): Typo for closed conditional. 2020-08-20 00:01:59 -04:00