diff options
author | Dasky <32983009+daskygit@users.noreply.github.com> | 2022-06-01 00:10:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 00:10:05 +0100 |
commit | af02baae78a3c4a06a646bc338b35524b5e5e7f5 (patch) | |
tree | e57778dc3693054f9b3febaa0d390117e2a081d0 | |
parent | f9e97fd3c3d8dc24c289f88d934adf00413c029b (diff) |
Allow larger SPLIT_USB_TIMEOUT with default SPLIT_USB_TIMEOUT_POLL (#17272)
* Switch SPLIT_USB_DETECT loop to uint16_t
* Add assertion
-rw-r--r-- | quantum/split_common/split_util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 7d50adf758..8b11e51374 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -57,8 +57,9 @@ static uint8_t connection_errors = 0; volatile bool isLeftHand = true; #if defined(SPLIT_USB_DETECT) +_Static_assert((SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL) <= UINT16_MAX, "Please lower SPLIT_USB_TIMEOUT and/or increase SPLIT_USB_TIMEOUT_POLL."); static bool usbIsActive(void) { - for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { + for (uint16_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { // This will return true if a USB connection has been established if (usb_connected_state()) { return true; |