summaryrefslogtreecommitdiff
path: root/quantum/debounce/sym_g.c
diff options
context:
space:
mode:
authorWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
committerWilliam Chang <william@factual.com>2019-11-20 22:17:07 -0800
commite7f4d56592b3975c38af329e77b4efd9108495e8 (patch)
tree0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /quantum/debounce/sym_g.c
parent71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff)
parent8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'quantum/debounce/sym_g.c')
-rw-r--r--quantum/debounce/sym_g.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/quantum/debounce/sym_g.c b/quantum/debounce/sym_g.c
index c8ab34e1a0..3ed9055d2a 100644
--- a/quantum/debounce/sym_g.c
+++ b/quantum/debounce/sym_g.c
@@ -20,38 +20,33 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.
#include "timer.h"
#include "quantum.h"
#ifndef DEBOUNCE
- #define DEBOUNCE 5
+# define DEBOUNCE 5
#endif
-void debounce_init(uint8_t num_rows) {}
+void debounce_init(uint8_t num_rows) {}
static bool debouncing = false;
#if DEBOUNCE > 0
static uint16_t debouncing_time;
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
-{
- if (changed) {
- debouncing = true;
- debouncing_time = timer_read();
- }
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+ if (changed) {
+ debouncing = true;
+ debouncing_time = timer_read();
+ }
- if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
- for (int i = 0; i < num_rows; i++) {
- cooked[i] = raw[i];
+ if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
+ for (int i = 0; i < num_rows; i++) {
+ cooked[i] = raw[i];
+ }
+ debouncing = false;
}
- debouncing = false;
- }
}
-#else //no debouncing.
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
-{
- for (int i = 0; i < num_rows; i++) {
- cooked[i] = raw[i];
- }
+#else // no debouncing.
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+ for (int i = 0; i < num_rows; i++) {
+ cooked[i] = raw[i];
+ }
}
#endif
-bool debounce_active(void) {
- return debouncing;
-}
-
+bool debounce_active(void) { return debouncing; }