forked from zmkfirmware/zmk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(split): move central key handling out of Bluetooth directory
- Loading branch information
1 parent
6411543
commit d9bed67
Showing
4 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2023 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zmk/events/position_state_changed.h> | ||
|
||
void zmk_position_state_change_handle(struct zmk_position_state_changed *ev); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2020 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <zephyr/types.h> | ||
#include <zephyr/init.h> | ||
|
||
#include <zmk/event_manager.h> | ||
#include <zmk/events/position_state_changed.h> | ||
#include <zmk/events/sensor_event.h> | ||
|
||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); | ||
|
||
K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed), | ||
CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4); | ||
|
||
void peripheral_event_work_callback(struct k_work *work) { | ||
struct zmk_position_state_changed ev; | ||
while (k_msgq_get(&peripheral_event_msgq, &ev, K_NO_WAIT) == 0) { | ||
LOG_DBG("Trigger key position state change for %d", ev.position); | ||
raise_zmk_position_state_changed(ev); | ||
} | ||
} | ||
|
||
K_WORK_DEFINE(peripheral_event_work, peripheral_event_work_callback); | ||
|
||
void zmk_position_state_change_handle(struct zmk_position_state_changed *ev) { | ||
k_msgq_put(&peripheral_event_msgq, ev, K_NO_WAIT); | ||
k_work_submit(&peripheral_event_work); | ||
} |