]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/keymap_common.c
Switch from echo to printf for output without newlines
[qmk_firmware.git] / quantum / keymap_common.c
index 5190f24e87cff7b6f8e884253696746536a7f477..a0d4c1ddb0873e9a767218401e434c96fde862ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
+Copyright 2012-2017 Jun Wako <wakojun@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -119,12 +119,19 @@ action_t action_for_key(uint8_t layer, keypos_t key)
             mod = keycode & 0xFF;
             action.code = ACTION_MODS_ONESHOT(mod);
             break;
+        case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
+            action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
+            break;
         case QK_MOD_TAP ... QK_MOD_TAP_MAX:
-            action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
+            mod = mod_config((keycode >> 0x8) & 0x1F);
+            action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF);
             break;
     #ifdef BACKLIGHT_ENABLE
-        case BL_0 ... BL_15:
-            action.code = ACTION_BACKLIGHT_LEVEL(keycode - BL_0);
+        case BL_ON:
+            action.code = ACTION_BACKLIGHT_ON();
+            break;
+        case BL_OFF:
+            action.code = ACTION_BACKLIGHT_OFF();
             break;
         case BL_DEC:
             action.code = ACTION_BACKLIGHT_DECREASE();
@@ -176,5 +183,12 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
 __attribute__ ((weak))
 uint16_t keymap_function_id_to_action( uint16_t function_id )
 {
+    // The compiler sees the empty (weak) fn_actions and generates a warning
+    // This function should not be called in that case, so the warning is too strict
+    // If this function is called however, the keymap should have overridden fn_actions, and then the compile
+    // is comparing against the wrong array
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Warray-bounds"
        return pgm_read_word(&fn_actions[function_id]);
+    #pragma GCC diagnostic pop
 }