diff options
Diffstat (limited to 'app/include')
-rw-r--r-- | app/include/dt-bindings/zmk/outputs.h | 9 | ||||
-rw-r--r-- | app/include/zmk/ble.h | 1 | ||||
-rw-r--r-- | app/include/zmk/endpoints.h | 8 | ||||
-rw-r--r-- | app/include/zmk/events/usb-conn-state-changed.h | 20 | ||||
-rw-r--r-- | app/include/zmk/hid.h | 2 | ||||
-rw-r--r-- | app/include/zmk/usb.h | 12 |
6 files changed, 51 insertions, 1 deletions
diff --git a/app/include/dt-bindings/zmk/outputs.h b/app/include/dt-bindings/zmk/outputs.h new file mode 100644 index 0000000..f24380f --- /dev/null +++ b/app/include/dt-bindings/zmk/outputs.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define OUT_TOG 0 +#define OUT_USB 1 +#define OUT_BLE 2
\ No newline at end of file diff --git a/app/include/zmk/ble.h b/app/include/zmk/ble.h index 1cf71a7..56980c6 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -15,6 +15,7 @@ int zmk_ble_prof_prev(); int zmk_ble_prof_select(u8_t index); bt_addr_le_t *zmk_ble_active_profile_addr(); +bool zmk_ble_active_profile_is_connected(); char *zmk_ble_active_profile_name(); int zmk_ble_unpair_all(); diff --git a/app/include/zmk/endpoints.h b/app/include/zmk/endpoints.h index aad6265..aad688e 100644 --- a/app/include/zmk/endpoints.h +++ b/app/include/zmk/endpoints.h @@ -9,4 +9,12 @@ #include <zmk/keys.h> #include <zmk/hid.h> +enum zmk_endpoint { + ZMK_ENDPOINT_USB, + ZMK_ENDPOINT_BLE, +}; + +int zmk_endpoints_select(enum zmk_endpoint endpoint); +int zmk_endpoints_toggle(); + int zmk_endpoints_send_report(u8_t usage_report); diff --git a/app/include/zmk/events/usb-conn-state-changed.h b/app/include/zmk/events/usb-conn-state-changed.h new file mode 100644 index 0000000..d6cc698 --- /dev/null +++ b/app/include/zmk/events/usb-conn-state-changed.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include <zephyr.h> +#include <usb/usb_device.h> + +#include <zmk/event-manager.h> +#include <zmk/usb.h> + +struct usb_conn_state_changed { + struct zmk_event_header header; + enum zmk_usb_conn_state conn_state; +}; + +ZMK_EVENT_DECLARE(usb_conn_state_changed);
\ No newline at end of file diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index 1ce5cc9..fd09a6f 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -168,9 +168,11 @@ int zmk_hid_register_mods(zmk_mod_flags modifiers); int zmk_hid_unregister_mods(zmk_mod_flags modifiers); int zmk_hid_keypad_press(zmk_key key); int zmk_hid_keypad_release(zmk_key key); +void zmk_hid_keypad_clear(); int zmk_hid_consumer_press(zmk_key key); int zmk_hid_consumer_release(zmk_key key); +void zmk_hid_consumer_clear(); struct zmk_hid_keypad_report *zmk_hid_get_keypad_report(); struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(); diff --git a/app/include/zmk/usb.h b/app/include/zmk/usb.h index 452fd54..30461de 100644 --- a/app/include/zmk/usb.h +++ b/app/include/zmk/usb.h @@ -12,8 +12,18 @@ #include <zmk/keys.h> #include <zmk/hid.h> +enum zmk_usb_conn_state { + ZMK_USB_CONN_NONE, + ZMK_USB_CONN_POWERED, + ZMK_USB_CONN_HID, +}; + enum usb_dc_status_code zmk_usb_get_status(); +enum zmk_usb_conn_state zmk_usb_get_conn_state(); + +static inline bool zmk_usb_is_powered() { return zmk_usb_get_conn_state() != ZMK_USB_CONN_NONE; } +static inline bool zmk_usb_is_hid_ready() { return zmk_usb_get_conn_state() == ZMK_USB_CONN_HID; } #ifdef CONFIG_ZMK_USB -int zmk_usb_hid_send_report(u8_t *report, size_t len); +int zmk_usb_hid_send_report(const u8_t *report, size_t len); #endif /* CONFIG_ZMK_USB */
\ No newline at end of file |