]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/bootmagic.c
reverts #343 for the most part (#474)
[qmk_firmware.git] / tmk_core / common / bootmagic.c
index 90275a18ba7b3330b4bab770cf03a79f1c616300..6730a2a4aab44372c0357e3ff9e85c6846fb6cfa 100644 (file)
@@ -106,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;
+                }
             }
         }
     }
@@ -124,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