summaryrefslogtreecommitdiff
path: root/app/src/split_listener.c
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2021-01-18 00:35:56 -0500
committerPete Johanson <peter@peterjohanson.com>2021-01-20 07:06:11 -0500
commit3fe2acc2d191006fa6309191ee99b2e4e249ed08 (patch)
tree4994508fdc58daee4629c671e07e689b6332bd32 /app/src/split_listener.c
parent003db892adadb7b760f43411d7154fe60bf3556d (diff)
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.
Diffstat (limited to 'app/src/split_listener.c')
-rw-r--r--app/src/split_listener.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/src/split_listener.c b/app/src/split_listener.c
index 6d2ca60..54e893e 100644
--- a/app/src/split_listener.c
+++ b/app/src/split_listener.c
@@ -19,18 +19,18 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/hid.h>
#include <zmk/endpoints.h>
-int split_listener(const struct zmk_event_header *eh) {
+int split_listener(const zmk_event_t *eh) {
LOG_DBG("");
- if (is_position_state_changed(eh)) {
- const struct position_state_changed *ev = cast_position_state_changed(eh);
- if (ev->data.state) {
- return zmk_split_bt_position_pressed(ev->data.position);
+ if (is_zmk_position_state_changed(eh)) {
+ const struct zmk_position_state_changed *ev = cast_zmk_position_state_changed(eh);
+ if (ev->state) {
+ return zmk_split_bt_position_pressed(ev->position);
} else {
- return zmk_split_bt_position_released(ev->data.position);
+ return zmk_split_bt_position_released(ev->position);
}
}
return ZMK_EV_EVENT_BUBBLE;
}
ZMK_LISTENER(split_listener, split_listener);
-ZMK_SUBSCRIPTION(split_listener, position_state_changed); \ No newline at end of file
+ZMK_SUBSCRIPTION(split_listener, zmk_position_state_changed); \ No newline at end of file