Commit Graph

44 Commits

Author SHA1 Message Date
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
Nick 2204a5dce4 refactor(settings): Debounce BLE/endpoint settings saves 2020-12-14 22:46:49 -05:00
Nick Winans 69d48c5715 refactor(settings): Only load used subtrees 2020-12-14 22:46:49 -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
Pete Johanson 0d80220e14 fix(ble): Raise profile events from work thread.
* Make sure we don't raise events from BLE
  host thread.
2020-12-06 22:47:21 -05:00
Pete Johanson b3f3362b50 feat(display): Initial widget/status screen work.
* Battery and output status widgets
* Built in status screen combining them.
* Ability to define a custom status screen factory
  function.
2020-12-02 16:04:56 -05:00
innovaker 7b3a55cf50 refactor(ble): silence warning `auth_passkey_display` not used
Silences the following build warning ...

../src/ble.c:407:13: warning: 'auth_passkey_display' defined but not used [-Wunused-function]
  407 | static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
2020-12-01 07:21:45 -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
Joel Spadin 821f054071 feat(endpoints): remove redundant connection check 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
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 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 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
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 05235ca96d fix(bluetooth): Stop peripheral half advertising once connected. 2020-08-18 16:18:16 -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
Nick 087574f607 Create proper fix for split default conn bug 2020-08-16 15:36:43 -05:00
Pete Johanson 7e8a07e693 Remove use of printk. 2020-08-14 16:45:05 -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 5896c3032b Fixes for BLE host connections w/ split support. 2020-07-21 22:10:37 -04:00
Pete Johanson fd407c4876 Update connectin params once we're connected to. 2020-07-19 22:40:49 -04:00
Pete Johanson 6701b7babc Working BT settings. 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 ec663310c1 Clean up after refactor, better HID constants. 2020-06-21 22:46:27 -04:00
Pete Johanson 38f1dbd984 Move Zephyr app into subdirectory. 2020-06-08 21:07:16 -04:00
Renamed from src/ble.c (Browse further)