Commit graph

38 commits

Author SHA1 Message Date
Peter Johanson 16ab6df18d feat(display): Add new peripheral status/display
* Add new API/status to track state of the
  peripheral connection to the central.
* Add new peripheral status widget for displaying
  the current status of the connection to
  the central.
2022-05-17 13:09:21 -04:00
Peter Johanson 40d8470664 refactor: Handle HID macro/API changes in Zephyr. 2022-04-03 00:10:29 -04:00
Peter Johanson fa110488b0 fix(split): Add define for local source.
* Add `ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL` and use
  it consinstently to fix bug w/ local `&reset`, `&bootloader`, etc.
2022-01-31 23:03:34 -05:00
Peter Johanson 9297c5f2b4 refactor(splits): Use index for event source.
* Track peripherals by indexes slot, with all appropiate peripheral
  state stored in the slot.
* Event sources tracked by peripheral slot index.
2022-01-31 23:03:34 -05:00
Pete Johanson 47f873b038 feature(split): behavior locality support.
* GATT characteristic allowing passng data + behavior
  label to invoke the behavior on the peripheral side.
* Behaviors have a locality setting to specify where they run.
* Build reset/power/RGB on peripheral.
2022-01-31 23:03:34 -05:00
Peter Johanson d05d7ec2d2 feat(endpoints): Add endpoint select changed event. 2021-08-03 00:19:05 -04:00
JP Bonn c643f1cd96 added battery.h, last_state_of_charge to uint8_t 2021-03-10 18:07:18 -05:00
JP Bonn df4ec51f96 only send zmk_battery_state_changed on change 2021-03-10 18:07:18 -05:00
Okke Formsma 7b7701ae90 feature(modifiers): add explicit modifiers
this makes LS(LEFT_CONTROL) work as if shift and control were both
pressed explicitly. Previously, the left shift would have been released
as soon as another key was pressed. The implicit behavior is useful in
case of LS(NUMBER_1) when rolling over to other keys.

Also see #361.
2021-01-24 23:30:41 -05:00
Ally Parker a4aaa73f06 feat: Add WPM calculator and display widget 2021-01-23 18:38:31 -05:00
Pete Johanson 3fe2acc2d1 refactor(core): Extra event payloads to own types, refactor API.
* Make it easier to use *just* event payloads by defining the data,
  and then having event manager macros generate "wrapper structs"
* Improve is_*/cast_* APIs to hide details of full event struct.
* Create `zmk_event_t` typedef to pass to event handlers.
* Bring event names inline w/ consistent `zmk_` prefix.
2021-01-20 07:06:11 -05:00
Pete Johanson 003db892ad refactor(core): Extra position state change data struct.
* Separate header and data struct for the event.
* Remove duplicate struct in split code.
2021-01-20 07:06:11 -05:00
innovaker 1d18900a99 refactor(core): define usage page as uint16_t
Aligns with the HID specification.

Usage page values were sometimes declared as uint8_t and sometimes uint16_t.  This commit aligns all instances with the HID specification for consistency.

PR: #521
2021-01-15 01:48:39 -05:00
innovaker 87e7c04b00 refactor(app): replace zmk_mod_flags with zmk_mod_flags_t
Aligns with typedef _t convention.

PR: #531
2020-12-28 10:20:12 -05:00
innovaker 842aa5a842 refactor: replace filename hyphens with underscores
Aligns *.h and *.c to underscore naming convention.

These were kept (with warnings) for backwards compatibility with external boards/shields:
- kscan-mock.h
- matrix-transform.h
They should be removed in the future.

PR: #523
2020-12-28 01:15:35 -05:00
Pete Johanson f7c16dfe69 refactor(power): Extract activity/idle detection.
* Refactor power to extract more general purpose
  activity detection/events.
* Use activity state to implement PM callback.
2020-12-14 15:31:10 -05:00
innovaker 00ca0d2f1c refactor(app): replace struct device * with const struct device *
Replaced with RegExp: /(?<!const )(struct device \*)/g

See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html
PR: #467
2020-12-14 12:41:25 -05:00
innovaker bac1f17cf6 refactor(app): replace Zephyr integer types with C99 integer types
u8_t → uint8_t
u16_t → uint16_t
u32_t → uint32_t
u64_t → uint64_t
s8_t → int8_t
s16_t → int16_t
s32_t → int32_t
s64_t → int64_t

Prerequisite for #223
See: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.4.0
PR: #467
2020-12-14 12:41:25 -05:00
KemoNine 2427a4ab33
feature(keymaps): Keymap layer state event, highest layer API
* Fire an event w/ layer number, state, and timestamp
  when a layer is activated/deactivated.
* Add `zmk_keymap_highest_layer_active()` query.

Co-authored-by: KemoNine <mcrosson@kemonine.info>
2020-12-09 09:35:57 -05:00
Pete Johanson d5ea426975 refactor(battery): Fire event on battery event. 2020-12-02 16:04:56 -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
innovaker c21897856b refactor(app): Replace HID_EXT_USAGE with HID_USAGE
Simplifies terminology and improves readability.
2020-11-10 21:00:20 +00: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
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
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
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 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 68e72f9275 fix: Switch to single AUTHORS file.* Closes #164 2020-09-10 10:24:23 -04:00
Pete Johanson 5b862655b4 Whitespace fix. 2020-07-25 23:17:33 -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 a62a2f8c5c Cleanup, license headers. 2020-06-30 16:13:03 -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