diff options
author | zvecr <git@zvecr.com> | 2022-02-25 23:45:40 +0000 |
---|---|---|
committer | zvecr <git@zvecr.com> | 2022-02-25 23:45:40 +0000 |
commit | e7931289918221081cbe2a7ea5df27a5d86324db (patch) | |
tree | 0b06145520f8aaf5ff5cb928aa5176fc2dd23619 /quantum/split_common/split_util.c | |
parent | c0ee3d2c79388187883b1b1b1d1a0b6842acf741 (diff) | |
parent | cf31355f08dca311a013168eb3eb995e2fc6a3d1 (diff) |
Merge remote-tracking branch 'origin/develop'
Diffstat (limited to 'quantum/split_common/split_util.c')
-rw-r--r-- | quantum/split_common/split_util.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 35f0a9d181..7d50adf758 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -43,14 +43,14 @@ // Set to 0 to disable the disconnection check altogether. #ifndef SPLIT_MAX_CONNECTION_ERRORS # define SPLIT_MAX_CONNECTION_ERRORS 10 -#endif // SPLIT_MAX_CONNECTION_ERRORS +#endif // SPLIT_MAX_CONNECTION_ERRORS // How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected. // One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again. // Set to 0 to disable communication throttling while disconnected #ifndef SPLIT_CONNECTION_CHECK_TIMEOUT # define SPLIT_CONNECTION_CHECK_TIMEOUT 500 -#endif // SPLIT_CONNECTION_CHECK_TIMEOUT +#endif // SPLIT_CONNECTION_CHECK_TIMEOUT static uint8_t connection_errors = 0; @@ -68,7 +68,9 @@ static bool usbIsActive(void) { return false; } #else -static inline bool usbIsActive(void) { return usb_vbus_state(); } +static inline bool usbIsActive(void) { + return usb_vbus_state(); +} #endif #ifdef SPLIT_HAND_MATRIX_GRID @@ -83,7 +85,7 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { uint8_t pin_state = readPin(in_pin); // Set out_pin to a setting that is less susceptible to noise. setPinInputHigh(out_pin); - matrix_io_delay(); // Wait for the pull-up to go HIGH. + matrix_io_delay(); // Wait for the pull-up to go HIGH. return pin_state; } #endif @@ -158,7 +160,9 @@ void split_post_init(void) { } } -bool is_transport_connected(void) { return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; } +bool is_transport_connected(void) { + return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; +} bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { #if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 @@ -169,7 +173,7 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) { return false; } -#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 __attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix); #if SPLIT_MAX_CONNECTION_ERRORS > 0 @@ -186,10 +190,10 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl return connected; } else if (is_disconnected) { dprintln("Target connected"); -# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 +# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 } connection_errors = 0; -#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 return true; } |