refactor: Promote new endpoints API
* Add ability for external callers to clear the current endpoint.
This commit is contained in:
parent
d3fffb9e89
commit
860e53b33a
2 changed files with 4 additions and 2 deletions
|
@ -73,3 +73,5 @@ int zmk_endpoints_send_report(uint16_t usage_page);
|
||||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
||||||
int zmk_endpoints_send_mouse_report();
|
int zmk_endpoints_send_mouse_report();
|
||||||
#endif // IS_ENABLE(CONFIG_ZMK_MOUSE)
|
#endif // IS_ENABLE(CONFIG_ZMK_MOUSE)
|
||||||
|
|
||||||
|
void zmk_endpoints_clear_current(void);
|
||||||
|
|
|
@ -340,7 +340,7 @@ static int zmk_endpoints_init(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_current_endpoint(void) {
|
void zmk_endpoints_clear_current(void) {
|
||||||
zmk_hid_keyboard_clear();
|
zmk_hid_keyboard_clear();
|
||||||
zmk_hid_consumer_clear();
|
zmk_hid_consumer_clear();
|
||||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
|
#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)) {
|
if (!zmk_endpoint_instance_eq(new_instance, current_instance)) {
|
||||||
// Cancel all current keypresses so keys don't stay held on the old endpoint.
|
// 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;
|
current_instance = new_instance;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue