Commit graph

114 commits

Author SHA1 Message Date
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
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
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
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
Pete Johanson
6d9aa4f5ea fix: Updated copyright headers to single author file. 2020-10-12 13:03:10 -04: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
Pete Johanson
bbf5a5905a refactor(usb): Report USB status w/o HID output. 2020-10-04 21:56:09 -04:00
Dev
c68e3d3e42 Add missing licensing header
Fixes #205
2020-10-02 13:14:31 +05:30
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
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
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
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
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
f02fa01e9a fix(test): change the layout 2020-08-28 16:21:31 -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
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
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
Pete Johanson
5b862655b4 Whitespace fix. 2020-07-25 23:17:33 -04:00
Pete Johanson
d80063ff51 Initial display support. 2020-07-25 23:10:40 -04: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
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
eb0bf2337e More cleanup of BLE split code. 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
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
Pete Johanson
96ec16da92 Modifier event, tweaks for linker script. 2020-06-30 10:43:09 -04:00
Pete Johanson
9a991bf019 Initial event manager work, and two first events.
* Add initial event manager implementation,
  roughly mimicking Nordic's API.
* Add `position_state_changed` and
  `keycode_state_changed` events.
* Hook up HID and keymap to new events
  instead of using behaviour global event
  crazy.
2020-06-30 00:31:09 -04:00
Pete Johanson
5ffd95694f Kyria left/right overlays, matrix transform fixes
* Refactor Kyria into separate left/right "revisions"
  of the Kyria shield, and include central
  kyria.dtsi file with common definition.
* Fixes for keymaps to work fully with matrix
  transforms that override effective rows/columns.
* Add ability for matrix transform to do row/col
  offsets, which is needed for split keyboards.
2020-06-27 00:16:15 -04:00
Pete Johanson
c457d9880d
Merge pull request #32 from petejohanson/core/refactor-keymap-to-behaviors
Refactor keymap to behaviors
2020-06-25 14:39:08 -04:00
Pete Johanson
d35a95c7af Initial working Clueboard California Macropad w/ proton-c fixes
* Basic Clueboard Californai Macropad shield definition.
* New "direct" KSCAN driver that supports non-matrix direct
  wiring for switches, needed for macropad that doesn't have
  a matrix at all.
* Some renames for existing KSCAN GPIO driver to make the implied
  "matrix" part explicit.
2020-06-24 10:14:27 -04:00
Pete Johanson
55cf9db564 Fix consumer keys w/ refactored behaviors. 2020-06-22 11:06:01 -04:00
Pete Johanson
ec663310c1 Clean up after refactor, better HID constants. 2020-06-21 22:46:27 -04:00
Pete Johanson
223edf05ad Refactor global bindings, implement mod-tap.
* Use extra comptible = "zmk,behavior-global" to add
   behaviors to global bindings for event notification.
* Implement mod-tap, as a keymap binding and global one
  to skip tap if other keycode pressed while held.
2020-06-21 21:43:44 -04:00
Pete Johanson
7e659851c8 Refactor matrix transform, positions pervasively
* Do mapping to positions right in kscan handler, and then
  surface positions throughout the API.
2020-06-20 17:54:52 -04:00
Pete Johanson
d65629b9a0 Lots more pieces toward HID working again. 2020-06-20 00:11:39 -04:00
Pete Johanson
c23d752917 Some initial work on behavior bindings for keymaps 2020-06-19 15:32:33 -04:00
Pete Johanson
38f1dbd984 Move Zephyr app into subdirectory. 2020-06-08 21:07:16 -04:00