mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-04-05 12:55:19 -05:00
feat: only send HID reports to one endpoint
Added some utility functions and an event for tracking the state of the USB connection. Updated endpoints.c to select a single endpoint to send HID reports to based on the status of the USB and BLE connections. Partially fixes #206. Future commits will add a user setting to control which endpoint is used if both USB and BLE are ready.
This commit is contained in:
@@ -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 */
|
||||
Reference in New Issue
Block a user