refactor: Split endpoint to transport and instance

Changed the endpoints code to rename the existing endpoint types to
"transport" and add the concept of "endpoint instances". A transport is
the method by which data is sent, while instances allow describing
multiple endpoints that use the same transport (e.g. bluetooth profiles)

Also added new APIs to get the total number of possible endpoint
instances and assign each instance a unique index, which can be used
for tracking separate state for each endpoint in other code files.
This commit is contained in:
Joel Spadin
2023-05-14 11:55:21 -05:00
committed by Pete Johanson
parent 2f05ad55ca
commit 651ed05e9a
8 changed files with 278 additions and 134 deletions

View File

@@ -24,11 +24,11 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
switch (binding->param1) {
case OUT_TOG:
return zmk_endpoints_toggle();
return zmk_endpoints_toggle_transport();
case OUT_USB:
return zmk_endpoints_select(ZMK_ENDPOINT_USB);
return zmk_endpoints_select_transport(ZMK_TRANSPORT_USB);
case OUT_BLE:
return zmk_endpoints_select(ZMK_ENDPOINT_BLE);
return zmk_endpoints_select_transport(ZMK_TRANSPORT_BLE);
default:
LOG_ERR("Unknown output command: %d", binding->param1);
}