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.
This commit is contained in:
parent
003db892ad
commit
3fe2acc2d1
40 changed files with 190 additions and 239 deletions
|
|
@ -75,8 +75,8 @@ int zmk_display_init() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int display_event_handler(const struct zmk_event_header *eh) {
|
||||
struct activity_state_changed *ev = cast_activity_state_changed(eh);
|
||||
int display_event_handler(const zmk_event_t *eh) {
|
||||
struct zmk_activity_state_changed *ev = cast_zmk_activity_state_changed(eh);
|
||||
switch (ev->state) {
|
||||
case ZMK_ACTIVITY_ACTIVE:
|
||||
start_display_updates();
|
||||
|
|
@ -93,4 +93,4 @@ int display_event_handler(const struct zmk_event_header *eh) {
|
|||
}
|
||||
|
||||
ZMK_LISTENER(display, display_event_handler);
|
||||
ZMK_SUBSCRIPTION(display, activity_state_changed);
|
||||
ZMK_SUBSCRIPTION(display, zmk_activity_state_changed);
|
||||
Loading…
Add table
Add a link
Reference in a new issue