forked from kofal.net/zmk
refactor(core): Move to stack allocated events.
* Move to local/stack allocated event API that doesn't require dynamic allocation/freeing. * Disable heap, we no longer use alloc/free unless using LVGL. * Tons of refactors all over to account for the new event approach.
This commit is contained in:
committed by
Pete Johanson
parent
50e473276f
commit
33209dee1d
@@ -21,7 +21,7 @@ struct zmk_keycode_state_changed {
|
||||
|
||||
ZMK_EVENT_DECLARE(zmk_keycode_state_changed);
|
||||
|
||||
static inline struct zmk_keycode_state_changed_event *
|
||||
static inline struct zmk_keycode_state_changed
|
||||
zmk_keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
|
||||
uint16_t page = ZMK_HID_USAGE_PAGE(encoded);
|
||||
uint16_t id = ZMK_HID_USAGE_ID(encoded);
|
||||
@@ -38,11 +38,10 @@ zmk_keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t t
|
||||
implicit_modifiers = SELECT_MODS(encoded);
|
||||
}
|
||||
|
||||
return new_zmk_keycode_state_changed(
|
||||
(struct zmk_keycode_state_changed){.usage_page = page,
|
||||
.keycode = id,
|
||||
.implicit_modifiers = implicit_modifiers,
|
||||
.explicit_modifiers = explicit_modifiers,
|
||||
.state = pressed,
|
||||
.timestamp = timestamp});
|
||||
return (struct zmk_keycode_state_changed){.usage_page = page,
|
||||
.keycode = id,
|
||||
.implicit_modifiers = implicit_modifiers,
|
||||
.explicit_modifiers = explicit_modifiers,
|
||||
.state = pressed,
|
||||
.timestamp = timestamp};
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@ struct zmk_layer_state_changed {
|
||||
|
||||
ZMK_EVENT_DECLARE(zmk_layer_state_changed);
|
||||
|
||||
static inline struct zmk_layer_state_changed_event *create_layer_state_changed(uint8_t layer,
|
||||
bool state) {
|
||||
return new_zmk_layer_state_changed((struct zmk_layer_state_changed){
|
||||
static inline int raise_layer_state_changed(uint8_t layer, bool state) {
|
||||
return raise_zmk_layer_state_changed((struct zmk_layer_state_changed){
|
||||
.layer = layer, .state = state, .timestamp = k_uptime_get()});
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ struct zmk_mouse_button_state_changed {
|
||||
|
||||
ZMK_EVENT_DECLARE(zmk_mouse_button_state_changed);
|
||||
|
||||
static inline struct zmk_mouse_button_state_changed_event *
|
||||
zmk_mouse_button_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
|
||||
return new_zmk_mouse_button_state_changed((struct zmk_mouse_button_state_changed){
|
||||
static inline int raise_zmk_mouse_button_state_changed_from_encoded(uint32_t encoded, bool pressed,
|
||||
int64_t timestamp) {
|
||||
return raise_zmk_mouse_button_state_changed((struct zmk_mouse_button_state_changed){
|
||||
.buttons = ZMK_HID_USAGE_ID(encoded), .state = pressed, .timestamp = timestamp});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user