diff options
author | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-07-04 12:32:08 -0400 |
---|---|---|
committer | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-07-04 12:32:08 -0400 |
commit | 2e1cfaf73fccdfaba2d7542f00bd7c3d49998d5d (patch) | |
tree | 9d8e9c6b71116f01c56c870a9e1071760899ff77 /tmk_core/common/bootmagic.c | |
parent | 44a5f7630f18b40b36270d49449a43cd42b802f0 (diff) | |
parent | 9e01b219f32b0086728c10658928b8bffcc26ef7 (diff) |
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'tmk_core/common/bootmagic.c')
-rw-r--r-- | tmk_core/common/bootmagic.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 30e8a0f20f..6730a2a4aa 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -1,6 +1,6 @@ #include <stdint.h> #include <stdbool.h> -#include <util/delay.h> +#include "wait.h" #include "matrix.h" #include "bootloader.h" #include "debug.h" @@ -10,6 +10,7 @@ #include "eeconfig.h" #include "bootmagic.h" +keymap_config_t keymap_config; void bootmagic(void) { @@ -19,9 +20,9 @@ void bootmagic(void) } /* do scans in case of bounce */ - print("boogmagic scan: ... "); + print("bootmagic scan: ... "); uint8_t scan = 100; - while (scan--) { matrix_scan(); _delay_ms(10); } + while (scan--) { matrix_scan(); wait_ms(10); } print("done.\n"); /* bootmagic skip */ @@ -105,13 +106,15 @@ void bootmagic(void) } } -static bool scan_keycode(uint8_t keycode) { - for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { +static bool scan_keycode(uint8_t keycode) +{ + for (uint8_t r = 0; r < MATRIX_ROWS; r++) { matrix_row_t matrix_row = matrix_get_row(r); - for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { - if (matrix_row & (matrix_row_t)1 << c) { - keypos_t key = (keypos_t){ .row = r, .col = c }; - if (keycode == keymap_key_to_keycode(0, key)) return true; + for (uint8_t c = 0; c < MATRIX_COLS; c++) { + if (matrix_row & ((matrix_row_t)1<<c)) { + if (keycode == keymap_key_to_keycode(0, (keypos_t){ .row = r, .col = c })) { + return true; + } } } } @@ -123,4 +126,4 @@ bool bootmagic_scan_keycode(uint8_t keycode) if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; return scan_keycode(keycode); -} +}
\ No newline at end of file |