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
|
|
@ -10,17 +10,8 @@
|
|||
#include <zmk/event_manager.h>
|
||||
#include <zmk/activity.h>
|
||||
|
||||
struct activity_state_changed {
|
||||
struct zmk_event_header header;
|
||||
struct zmk_activity_state_changed {
|
||||
enum zmk_activity_state state;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(activity_state_changed);
|
||||
|
||||
static inline struct activity_state_changed *
|
||||
create_activity_state_changed(enum zmk_activity_state state) {
|
||||
struct activity_state_changed *ev = new_activity_state_changed();
|
||||
ev->state = state;
|
||||
|
||||
return ev;
|
||||
}
|
||||
ZMK_EVENT_DECLARE(zmk_activity_state_changed);
|
||||
Loading…
Add table
Add a link
Reference in a new issue