diff options
Diffstat (limited to 'app/src/split')
-rw-r--r-- | app/src/split/bluetooth/central.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index e9dfbac..6772869 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -33,22 +33,14 @@ static struct bt_uuid_128 uuid = BT_UUID_INIT_128(ZMK_SPLIT_BT_SERVICE_UUID); static struct bt_gatt_discover_params discover_params; static struct bt_gatt_subscribe_params subscribe_params; -struct zmk_split_peripheral_event { - uint32_t position; - uint32_t state; - int32_t timestamp; -}; - -K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_split_peripheral_event), +K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed_data), CONFIG_ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE, 4); void peripheral_event_work_callback(struct k_work *work) { - struct zmk_split_peripheral_event ev; + struct zmk_position_state_changed_data ev; while (k_msgq_get(&peripheral_event_msgq, &ev, K_NO_WAIT) == 0) { struct position_state_changed *pos_ev = new_position_state_changed(); - pos_ev->position = ev.position; - pos_ev->state = ev.state; - pos_ev->timestamp = ev.timestamp; + pos_ev->data = ev; LOG_DBG("Trigger key position state change for %d", ev.position); ZMK_EVENT_RAISE(pos_ev); @@ -82,7 +74,7 @@ static uint8_t split_central_notify_func(struct bt_conn *conn, if (changed_positions[i] & BIT(j)) { uint32_t position = (i * 8) + j; bool pressed = position_state[i] & BIT(j); - struct zmk_split_peripheral_event ev = { + struct zmk_position_state_changed_data ev = { .position = position, .state = pressed, .timestamp = k_uptime_get()}; k_msgq_put(&peripheral_event_msgq, &ev, K_NO_WAIT); |