refactor(splits): Use index for event source.

* Track peripherals by indexes slot, with all appropiate peripheral
  state stored in the slot.
* Event sources tracked by peripheral slot index.
This commit is contained in:
Peter Johanson
2022-01-02 04:55:30 +00:00
committed by Pete Johanson
parent e8540f17fc
commit 9297c5f2b4
8 changed files with 252 additions and 103 deletions

View File

@@ -50,12 +50,11 @@ void zmk_kscan_process_msgq(struct k_work *item) {
uint32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column);
LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position,
(pressed ? "true" : "false"));
ZMK_EVENT_RAISE(new_zmk_position_state_changed((struct zmk_position_state_changed) {
#if IS_ENABLED(CONFIG_ZMK_BLE)
.source = BT_ADDR_LE_NONE,
#endif
.state = pressed, .position = position, .timestamp = k_uptime_get()
}));
ZMK_EVENT_RAISE(new_zmk_position_state_changed(
(struct zmk_position_state_changed){.source = UINT8_MAX,
.state = pressed,
.position = position,
.timestamp = k_uptime_get()}));
}
}