diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-07-04 12:13:41 -0400 |
---|---|---|
committer | Erez Zukerman <ezuk@madmimi.com> | 2016-07-04 12:13:41 -0400 |
commit | 86a7b060efb6f94115f5b1f6d9e3703aa3d6b392 (patch) | |
tree | aa27212dc8f943e65101848e7cc172bf1789bb14 /keyboards/ergodox_ez | |
parent | eafaba6b532a2f013955599fc7aa5c599e638fd3 (diff) | |
download | qmk_firmware-86a7b060efb6f94115f5b1f6d9e3703aa3d6b392.tar.gz qmk_firmware-86a7b060efb6f94115f5b1f6d9e3703aa3d6b392.zip |
Adds wait to i2c (debounce)
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r-- | keyboards/ergodox_ez/matrix.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 1bacff2a5d..9c1efa1d05 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> #include <stdbool.h> #include <avr/io.h> -#include <util/delay.h> +#include "wait.h" #include "action_layer.h" #include "print.h" #include "debug.h" @@ -166,6 +166,7 @@ uint8_t matrix_scan(void) for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select_row(i); + wait_us(30); // without this wait read unstable value. matrix_row_t cols = read_cols(i); if (matrix_debouncing[i] != cols) { matrix_debouncing[i] = cols; @@ -179,7 +180,7 @@ uint8_t matrix_scan(void) if (debouncing) { if (--debouncing) { - _delay_ms(2); + wait_us(1); } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; @@ -267,7 +268,6 @@ static matrix_row_t read_cols(uint8_t row) return data; } } else { - _delay_us(30); // without this wait read unstable value. // read from teensy return (PINF&(1<<0) ? 0 : (1<<0)) | |