aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/bootmagic.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/bootmagic.c')
-rw-r--r--tmk_core/common/bootmagic.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c
index 90275a18b..6730a2a4a 100644
--- a/tmk_core/common/bootmagic.c
+++ b/tmk_core/common/bootmagic.c
@@ -106,13 +106,15 @@ void bootmagic(void)
106 } 106 }
107} 107}
108 108
109static bool scan_keycode(uint8_t keycode) { 109static bool scan_keycode(uint8_t keycode)
110 for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { 110{
111 for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
111 matrix_row_t matrix_row = matrix_get_row(r); 112 matrix_row_t matrix_row = matrix_get_row(r);
112 for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { 113 for (uint8_t c = 0; c < MATRIX_COLS; c++) {
113 if (matrix_row & (matrix_row_t)1 << c) { 114 if (matrix_row & ((matrix_row_t)1<<c)) {
114 keypos_t key = (keypos_t){ .row = r, .col = c }; 115 if (keycode == keymap_key_to_keycode(0, (keypos_t){ .row = r, .col = c })) {
115 if (keycode == keymap_key_to_keycode(0, key)) return true; 116 return true;
117 }
116 } 118 }
117 } 119 }
118 } 120 }
@@ -124,4 +126,4 @@ bool bootmagic_scan_keycode(uint8_t keycode)
124 if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; 126 if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
125 127
126 return scan_keycode(keycode); 128 return scan_keycode(keycode);
127} 129} \ No newline at end of file