diff options
author | Nick <nick.win999@gmail.com> | 2020-09-19 19:15:05 -0500 |
---|---|---|
committer | Nick <nick.win999@gmail.com> | 2020-09-19 19:15:05 -0500 |
commit | da0fb965f6b6a67154e20a3fddda48f5bc392d77 (patch) | |
tree | f7f9aa9a45b39bb4d943eb7d2ba6e71d516ab40c /app/src/ble_unpair_combo.c | |
parent | 844f2c76749cbc5ff611d8e69819af82b698089a (diff) | |
parent | c0806d27f1d048db335ecc854eab61b59e23ea7a (diff) |
Merge remote-tracking branch 'upstream/main' into bluetooth/battery-reporting
Diffstat (limited to 'app/src/ble_unpair_combo.c')
-rw-r--r-- | app/src/ble_unpair_combo.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/app/src/ble_unpair_combo.c b/app/src/ble_unpair_combo.c index 82fa834..b6e542d 100644 --- a/app/src/ble_unpair_combo.c +++ b/app/src/ble_unpair_combo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Peter Johanson + * Copyright (c) 2020 The ZMK Contributors * * SPDX-License-Identifier: MIT */ @@ -18,14 +18,12 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include <zmk/event-manager.h> #include <zmk/events/position-state-changed.h> - static u8_t combo_state; const u32_t key_positions[] = DT_INST_PROP(0, key_positions); #define KP_LEN DT_INST_PROP_LEN(0, key_positions) -int index_for_key_position(u32_t kp) -{ +int index_for_key_position(u32_t kp) { for (int i = 0; i < KP_LEN; i++) { if (key_positions[i] == kp) { return i; @@ -35,8 +33,7 @@ int index_for_key_position(u32_t kp) return -1; } -int unpair_combo_listener(const struct zmk_event_header *eh) -{ +int unpair_combo_listener(const struct zmk_event_header *eh) { if (is_position_state_changed(eh)) { const struct position_state_changed *psc = cast_position_state_changed(eh); @@ -51,8 +48,7 @@ int unpair_combo_listener(const struct zmk_event_header *eh) return 0; }; -void unpair_combo_work_handler(struct k_work *work) -{ +void unpair_combo_work_handler(struct k_work *work) { for (int i = 0; i < KP_LEN; i++) { if (!(combo_state & BIT(i))) { LOG_DBG("Key position %d not held, skipping unpair combo", key_positions[i]); @@ -65,8 +61,7 @@ void unpair_combo_work_handler(struct k_work *work) struct k_delayed_work unpair_combo_work; -int zmk_ble_unpair_combo_init(struct device *_unused) -{ +int zmk_ble_unpair_combo_init(struct device *_unused) { k_delayed_work_init(&unpair_combo_work, unpair_combo_work_handler); k_delayed_work_submit(&unpair_combo_work, K_SECONDS(2)); @@ -76,8 +71,6 @@ int zmk_ble_unpair_combo_init(struct device *_unused) ZMK_LISTENER(zmk_ble_unpair_combo, unpair_combo_listener); ZMK_SUBSCRIPTION(zmk_ble_unpair_combo, position_state_changed); -SYS_INIT(zmk_ble_unpair_combo_init, - APPLICATION, - CONFIG_APPLICATION_INIT_PRIORITY); +SYS_INIT(zmk_ble_unpair_combo_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ |