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

@@ -83,8 +83,8 @@ K_WORK_DEFINE(advertising_work, advertising_cb);
static void connected(struct bt_conn *conn, uint8_t err) {
is_connected = (err == 0);
ZMK_EVENT_RAISE(new_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = is_connected}));
raise_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = is_connected});
if (err == BT_HCI_ERR_ADV_TIMEOUT) {
low_duty_advertising = true;
@@ -101,8 +101,8 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) {
is_connected = false;
ZMK_EVENT_RAISE(new_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = is_connected}));
raise_zmk_split_peripheral_status_changed(
(struct zmk_split_peripheral_status_changed){.connected = is_connected});
low_duty_advertising = false;
k_work_submit(&advertising_work);