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:
Peter Johanson
2023-03-23 08:56:02 +00:00
committed by Pete Johanson
parent 50e473276f
commit 33209dee1d
24 changed files with 172 additions and 147 deletions

View File

@@ -32,21 +32,17 @@ int zmk_event_manager_handle_from(zmk_event_t *event, uint8_t start_index) {
continue;
case ZMK_EV_EVENT_HANDLED:
LOG_DBG("Listener handled the event");
ret = 0;
goto release;
return 0;
case ZMK_EV_EVENT_CAPTURED:
LOG_DBG("Listener captured the event");
// Listeners are expected to free events they capture
return 0;
default:
LOG_DBG("Listener returned an error: %d", ret);
goto release;
return ret;
}
}
release:
k_free(event);
return ret;
return 0;
}
int zmk_event_manager_raise(zmk_event_t *event) { return zmk_event_manager_handle_from(event, 0); }