summaryrefslogtreecommitdiff
path: root/app/include/zmk/event-manager.h
diff options
context:
space:
mode:
authorinnovaker <66737976+innovaker@users.noreply.github.com>2020-12-22 15:56:00 +0000
committerPete Johanson <peter@peterjohanson.com>2020-12-28 01:15:35 -0500
commit842aa5a842e117b7b00e49258ca0bde44dc0c789 (patch)
tree5202f081b9af5480610645aa53eab11d45a09105 /app/include/zmk/event-manager.h
parent6927abee6ef0c604fae1c8544fc933a56be14e77 (diff)
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
Diffstat (limited to 'app/include/zmk/event-manager.h')
-rw-r--r--app/include/zmk/event-manager.h81
1 files changed, 0 insertions, 81 deletions
diff --git a/app/include/zmk/event-manager.h b/app/include/zmk/event-manager.h
deleted file mode 100644
index 31c5322..0000000
--- a/app/include/zmk/event-manager.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2020 The ZMK Contributors
- *
- * SPDX-License-Identifier: MIT
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <kernel.h>
-#include <zephyr/types.h>
-
-struct zmk_event_type {
- const char *name;
-};
-
-struct zmk_event_header {
- const struct zmk_event_type *event;
- uint8_t last_listener_index;
-};
-
-#define ZMK_EV_EVENT_HANDLED 1
-#define ZMK_EV_EVENT_CAPTURED 2
-
-typedef int (*zmk_listener_callback_t)(const struct zmk_event_header *eh);
-struct zmk_listener {
- zmk_listener_callback_t callback;
-};
-
-struct zmk_event_subscription {
- const struct zmk_event_type *event_type;
- const struct zmk_listener *listener;
-};
-
-#define ZMK_EVENT_DECLARE(event_type) \
- struct event_type *new_##event_type(); \
- bool is_##event_type(const struct zmk_event_header *eh); \
- struct event_type *cast_##event_type(const struct zmk_event_header *eh); \
- extern const struct zmk_event_type zmk_event_##event_type;
-
-#define ZMK_EVENT_IMPL(event_type) \
- const struct zmk_event_type zmk_event_##event_type = {.name = STRINGIFY(event_type)}; \
- const struct zmk_event_type *zmk_event_ref_##event_type __used \
- __attribute__((__section__(".event_type"))) = &zmk_event_##event_type; \
- struct event_type *new_##event_type() { \
- struct event_type *ev = (struct event_type *)k_malloc(sizeof(struct event_type)); \
- ev->header.event = &zmk_event_##event_type; \
- return ev; \
- }; \
- bool is_##event_type(const struct zmk_event_header *eh) { \
- return eh->event == &zmk_event_##event_type; \
- }; \
- struct event_type *cast_##event_type(const struct zmk_event_header *eh) { \
- return (struct event_type *)eh; \
- };
-
-#define ZMK_LISTENER(mod, cb) const struct zmk_listener zmk_listener_##mod = {.callback = cb};
-
-#define ZMK_SUBSCRIPTION(mod, ev_type) \
- const Z_DECL_ALIGN(struct zmk_event_subscription) \
- _CONCAT(_CONCAT(zmk_event_sub_, mod), ev_type) __used \
- __attribute__((__section__(".event_subscription"))) = { \
- .event_type = &zmk_event_##ev_type, \
- .listener = &zmk_listener_##mod, \
- };
-
-#define ZMK_EVENT_RAISE(ev) zmk_event_manager_raise((struct zmk_event_header *)ev);
-
-#define ZMK_EVENT_RAISE_AFTER(ev, mod) \
- zmk_event_manager_raise_after((struct zmk_event_header *)ev, &zmk_listener_##mod);
-
-#define ZMK_EVENT_RAISE_AT(ev, mod) \
- zmk_event_manager_raise_at((struct zmk_event_header *)ev, &zmk_listener_##mod);
-
-#define ZMK_EVENT_RELEASE(ev) zmk_event_manager_release((struct zmk_event_header *)ev);
-
-int zmk_event_manager_raise(struct zmk_event_header *event);
-int zmk_event_manager_raise_after(struct zmk_event_header *event,
- const struct zmk_listener *listener);
-int zmk_event_manager_raise_at(struct zmk_event_header *event, const struct zmk_listener *listener);
-int zmk_event_manager_release(struct zmk_event_header *event);