Commit graph

163 commits

Author SHA1 Message Date
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
Pete Johanson
a65b746a86 fix(bluetooth): Add unpair combo if DT node exists 2020-08-19 23:34:34 -04:00
Pete Johanson
0d3cfa8596
Merge pull request #99 from petejohanson/core/bluetooth-unpair-magic-combo
Add magic combo for unpairing BT devices on start.
2020-08-18 19:21:43 -04:00
Pete Johanson
66c4b7ebb0 fix(usb): Restore write semaphore, release it on write failures. 2020-08-18 17:13:32 -04:00
Pete Johanson
05235ca96d fix(bluetooth): Stop peripheral half advertising once connected. 2020-08-18 16:18:16 -04:00
Pete Johanson
c054feb3c9
Merge pull request #100 from petejohanson/behaviors/add-none
Add `&none` behavior.
2020-08-18 14:31:20 -04:00
Pete Johanson
63e02d60dc feat(behaviors): Add &none behavior 2020-08-18 14:28:11 -04:00
Cody McGinnis
50643b2c56 fix(keymap): add brackets around if statement body 2020-08-18 14:21:39 -04:00
Cody McGinnis
7facb6eee8 fix(keymap): move the toggle layer logic to keymap.c 2020-08-18 14:02:25 -04:00
Cody McGinnis
a82f990d4c feat(keymap): allow users to toggle layers 2020-08-18 14:02:24 -04:00
Pete Johanson
4402e4fbc7 feeature(bt): Add "unpair combo" on startup.
* Especially for splits, we need the ability to
  unpair all paired devices as  sledgehammer
  if we need to "reset things", and doing so via
  keymaps isn't suitable.
* Allows shields to define a collection of key
  positions that if all held 2 seconds after
  startup, will unpair all existing pairs for the
  device.
2020-08-18 13:17:10 -04:00
Pete Johanson
d7dee20e8d Add missing license header. 2020-08-18 09:56:25 -04:00
Pete Johanson
e5ba03f088 Revert "Merge pull request #93 from careyk007/main"
This reverts commit 8cd8933c87, reversing
changes made to 3f1dfbaad1.
2020-08-17 23:23:30 -04:00
Pete Johanson
24836cdde8
Merge pull request #94 from Nicell/split/default-conn-fix
Create proper fix for split default connection bug
2020-08-16 23:00:19 -04:00
Nick
087574f607 Create proper fix for split default conn bug 2020-08-16 15:36:43 -05:00
Kellen Carey
5b4e5a30c4 remove unnecessary include 2020-08-16 12:51:06 -07:00
Kellen Carey
25c8a26998 wait before sending HID report 2020-08-16 12:49:08 -07:00
Pete Johanson
7e8a07e693 Remove use of printk. 2020-08-14 16:45:05 -04:00
Pete Johanson
3127192720 Invoke called behavior after layer change.
* If you press a key with a layer active, then
  deactivate the layer (e.g. releasing a `&mo`,
  then release the key, we currently may send
  the wrong key release event.
* Fixes #67.
2020-08-09 12:30:47 -04:00
Pete Johanson
01b8b724c1 Remove debugging line that snuck in. 2020-08-06 23:54:18 -04:00
Pete Johanson
0460631729 Refactor to simpler keymaps. 2020-08-06 23:28:34 -04:00
Pete Johanson
fd381e8117
Merge pull request #70 from Nicell/split/2m-phy
Split connection parameter adjustments and 2M PHY added
2020-08-06 11:11:48 -04:00
Nick
370cfcc59f Add if block and param req callback comment 2020-08-05 22:38:40 -05:00
Nick
cfea5cceb1 Remove updated callback 2020-08-03 17:22:11 -05:00
Nick
f23ca9d7ee Add two solutions to param updates 2020-08-02 15:51:38 -05:00
Nick
880c6e0601 Fix variable name in peripheral PHY update 2020-08-02 15:01:32 -05:00
Nick
f26bd495ea Fix interval update, add PHY update 2020-08-02 14:51:42 -05:00
Pete Johanson
cd30f440d9 Fix for the right start index for event releases. 2020-08-02 14:10:56 -04:00
Pete Johanson
8a07938d9b Minor cleanup. 2020-07-31 23:29:32 -04:00
Pete Johanson
8bba1fb738 Major mod-tap improvements.
* Track active mods when mods or keycode
  events occur.
* Use the tracked mods when releasing or
  generating keycode events.
* Track pending/used status in one array, for
  improved storage efficency.
2020-07-31 14:38:10 -04:00
Pete Johanson
f548f2a87c Initial stab at mod-tap improvements.
* Not working: Roll over + mod-tap with multiple
  mod-tap bindings!
2020-07-31 00:07:16 -04:00
Pete Johanson
cf8c7856ff Add the ability to capture event and release later 2020-07-30 00:13:32 -04:00
Pete Johanson
4e5a819f3a
Merge pull request #64 from Nicell/feature/rgb_underglow
Initial RGB Underglow implementation
2020-07-26 21:43:43 -04:00
Nick
dc8c7011b1 If LED strip can't be found, behaviors return err 2020-07-26 12:49:43 -05:00
Pete Johanson
d1cb3969f0 Remove extra '#'. 2020-07-25 23:17:19 -04:00
Pete Johanson
c34472bf3f Fixes for loading without encoder drivers.
* Build fixes.
2020-07-25 23:10:40 -04:00
Pete Johanson
d80063ff51 Initial display support. 2020-07-25 23:10:40 -04:00
Nick
6956094ac0 Add missing return To brightness up 2020-07-25 15:39:01 -05:00
Nick
564f787280 Add suggested changes 2020-07-25 14:53:42 -05:00
Nick
ca569c8143 Initial RGB Underglow implementation 2020-07-24 22:37:00 -05:00
Nick
bb09707bd2 Add base files and configuration for RGB underglow 2020-07-24 01:06:56 -05:00
Pete Johanson
b1bc5b4c82 Switch printk to LOG_DBG. 2020-07-23 22:21:38 -04:00
Pete Johanson
34ff6190bd Initial behavior for key presses on encoder rotate 2020-07-22 14:54:18 -04:00
Pete Johanson
4d73938cb5 More sensor keymap work. 2020-07-22 10:10:04 -04:00
Pete Johanson
adfa1b5443 Initial work on sensor bindings. 2020-07-22 02:13:52 -04:00
Pete Johanson
5896c3032b Fixes for BLE host connections w/ split support. 2020-07-21 22:10:37 -04:00
Pete Johanson
c4d3c03eb0 Improved function naming for central functions. 2020-07-20 23:02:27 -04:00
Pete Johanson
542a9de48a Replace magic 16 with sane constant. 2020-07-20 22:52:37 -04:00
Pete Johanson
fd407c4876 Update connectin params once we're connected to. 2020-07-19 22:40:49 -04:00
Pete Johanson
2a6b9ec86e Fixed min/max. 2020-07-19 22:33:15 -04:00
Pete Johanson
879fd5b8e7 Connection params tweaks. 2020-07-19 22:20:42 -04:00
Pete Johanson
6701b7babc Working BT settings. 2020-07-17 22:43:40 -04:00
Pete Johanson
d4afd989f3 More split implementation.
* Propogate key position state changes on central.
* Various BLE tweaks.
2020-07-17 22:43:40 -04:00
Pete Johanson
d1a5c7ee5a Swtich to SYS_INIT. 2020-07-17 22:43:40 -04:00
Pete Johanson
be537d0656 Lots of work on split peripheral/central logic. 2020-07-17 22:43:40 -04:00
Pete Johanson
a165db6358 Initial work on split central support. 2020-07-17 22:43:40 -04:00
Pete Johanson
3796f76c56 Initial exploration of split BLE service.
* Service for split peripheral to report
  position state to split central.
* Updated advertising info.
* Behavior for split BT until we have a proper
  event system.
2020-07-17 22:43:40 -04:00
Pete Johanson
7c5fb7adb5 Use SYS_INIT for BLE and USB init. 2020-07-07 10:20:23 -04:00
Pete Johanson
7bf8621d5b Whitespace fix. 2020-06-30 16:39:29 -04:00
Pete Johanson
a62a2f8c5c Cleanup, license headers. 2020-06-30 16:13:03 -04:00
Pete Johanson
57e061ac91 Lots of cleanup of old events/behavior mash. 2020-06-30 15:21:42 -04:00