summaryrefslogtreecommitdiff
path: root/app/src/power.c
diff options
context:
space:
mode:
authorJoel Spadin <joelspadin@gmail.com>2020-10-11 17:03:21 -0500
committerJoel Spadin <joelspadin@gmail.com>2020-10-28 18:15:05 -0500
commit1d369ffa73ae63af821d012b1c2ab4a07a5dc9c7 (patch)
tree409067d51461b939cccbc4381d7185921444a545 /app/src/power.c
parentdfb69d8727e01cb9ee855ac2d1cb7a6da1d6aa85 (diff)
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.
Diffstat (limited to 'app/src/power.c')
-rw-r--r--app/src/power.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/src/power.c b/app/src/power.c
index 73b3f12..bad54d2 100644
--- a/app/src/power.c
+++ b/app/src/power.c
@@ -23,14 +23,7 @@ static u32_t power_last_uptime;
bool is_usb_power_present() {
#ifdef CONFIG_USB
- enum usb_dc_status_code usb_status = zmk_usb_get_status();
- switch (usb_status) {
- case USB_DC_DISCONNECTED:
- case USB_DC_UNKNOWN:
- return false;
- default:
- return true;
- }
+ return zmk_usb_is_powered();
#else
return false;
#endif /* CONFIG_USB */