summaryrefslogtreecommitdiff
path: root/app/src/display
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2021-01-19 14:21:00 -0500
committerPete Johanson <peter@peterjohanson.com>2021-01-20 07:06:11 -0500
commit3368a81057d4981aa259c5548050d95739d99d51 (patch)
treea2feaed6f49eb25949a64c9c3cafe574f43fe23d /app/src/display
parent3fe2acc2d191006fa6309191ee99b2e4e249ed08 (diff)
refactor(core): Combine `is_` and `cast_` event functions.
* Use a single `as_foo` generated function to conditionally return a certain event type from a generic `zmk_event_t*` pointer.
Diffstat (limited to 'app/src/display')
-rw-r--r--app/src/display/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/display/main.c b/app/src/display/main.c
index 90789f9..55dd1ce 100644
--- a/app/src/display/main.c
+++ b/app/src/display/main.c
@@ -76,7 +76,11 @@ int zmk_display_init() {
}
int display_event_handler(const zmk_event_t *eh) {
- struct zmk_activity_state_changed *ev = cast_zmk_activity_state_changed(eh);
+ struct zmk_activity_state_changed *ev = as_zmk_activity_state_changed(eh);
+ if (ev == NULL) {
+ return -ENOTSUP;
+ }
+
switch (ev->state) {
case ZMK_ACTIVITY_ACTIVE:
start_display_updates();