diff options
author | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-05-24 12:34:08 -0400 |
---|---|---|
committer | Christopher Browne <cbbrowne@ca.afilias.info> | 2016-05-24 12:34:08 -0400 |
commit | 48871b9b6b99201abc381ee27cfd94e211ca131a (patch) | |
tree | ed5fe45f9f38e364b53a1bac35084782ec6aaf2c /tmk_core/common/bootmagic.c | |
parent | c2a3df31239249b2fb65e2552376daac0e49ae61 (diff) | |
parent | 287eb7ad148abc8fe3fb014218d71e205fd9131d (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 | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 2c1b1adfc5..30e8a0f20f 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -105,15 +105,13 @@ void bootmagic(void) } } -static bool scan_keycode(uint8_t keycode) -{ - for (uint8_t r = 0; r < MATRIX_ROWS; r++) { +static bool scan_keycode(uint8_t keycode) { + for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { matrix_row_t matrix_row = matrix_get_row(r); - 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; - } + 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; } } } |