diff options
author | Peter Johanson <[email protected]> | 2023-12-07 00:36:02 +0000 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2024-03-27 20:59:26 -0700 |
commit | 860e53b33ac3b09b233a0ec4c6cb0621895fb16c (patch) | |
tree | c34c5e6de1ddce083e2bd0e7f6902422e685410f /app | |
parent | d3fffb9e8913105bc732eb9cbfbd380a9b98167e (diff) | |
download | zmk-860e53b33ac3b09b233a0ec4c6cb0621895fb16c.tar.gz zmk-860e53b33ac3b09b233a0ec4c6cb0621895fb16c.zip |
refactor: Promote new endpoints API
* Add ability for external callers to clear the current endpoint.
Diffstat (limited to 'app')
-rw-r--r-- | app/include/zmk/endpoints.h | 2 | ||||
-rw-r--r-- | app/src/endpoints.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/app/include/zmk/endpoints.h b/app/include/zmk/endpoints.h index 70240183e3..f2aff2bcc2 100644 --- a/app/include/zmk/endpoints.h +++ b/app/include/zmk/endpoints.h @@ -73,3 +73,5 @@ int zmk_endpoints_send_report(uint16_t usage_page); #if IS_ENABLED(CONFIG_ZMK_MOUSE) int zmk_endpoints_send_mouse_report(); #endif // IS_ENABLE(CONFIG_ZMK_MOUSE) + +void zmk_endpoints_clear_current(void); diff --git a/app/src/endpoints.c b/app/src/endpoints.c index f8452d93fb..7c9d15a31f 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -340,7 +340,7 @@ static int zmk_endpoints_init(void) { return 0; } -static void disconnect_current_endpoint(void) { +void zmk_endpoints_clear_current(void) { zmk_hid_keyboard_clear(); zmk_hid_consumer_clear(); #if IS_ENABLED(CONFIG_ZMK_MOUSE) @@ -356,7 +356,7 @@ static void update_current_endpoint(void) { if (!zmk_endpoint_instance_eq(new_instance, current_instance)) { // Cancel all current keypresses so keys don't stay held on the old endpoint. - disconnect_current_endpoint(); + zmk_endpoints_clear_current(); current_instance = new_instance; |