summaryrefslogtreecommitdiff
path: root/quantum/keymap_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/keymap_common.c')
-rw-r--r--quantum/keymap_common.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 4b4bd62109..ba7269388b 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -24,9 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_macro.h"
#include "debug.h"
#include "backlight.h"
-#include "keymap_midi.h"
#include "bootloader.h"
#include "eeconfig.h"
+#include "quantum.h"
+
+#ifdef MIDI_ENABLE
+ #include "keymap_midi.h"
+#endif
extern keymap_config_t keymap_config;
@@ -150,20 +154,22 @@ static action_t keycode_to_action(uint16_t keycode)
case KC_TRNS:
action.code = ACTION_TRANSPARENT;
break;
- case 0x0100 ... 0x1FFF: ;
+ case LCTL(0) ... 0x1FFF: ;
// Has a modifier
// Split it up
action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
break;
- case 0x2000 ... 0x2FFF:
+ case FUNC(0) ... FUNC(0xFFF): ;
// Is a shortcut for function layer, pull last 12bits
// This means we have 4,096 FN macros at our disposal
return keymap_func_to_action(keycode & 0xFFF);
break;
- case 0x3000 ... 0x3FFF: ;
- // When the code starts with 3, it's an action macro.
+ case M(0) ... M(0xFF):
action.code = ACTION_MACRO(keycode & 0xFF);
break;
+ case LT(0, 0) ... LT(0xFF, 0xF):
+ action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
+ break;
#ifdef BACKLIGHT_ENABLE
case BL_0 ... BL_15:
action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
@@ -185,7 +191,7 @@ static action_t keycode_to_action(uint16_t keycode)
clear_keyboard();
#ifdef AUDIO_ENABLE
stop_all_notes();
- play_goodbye_tone();
+ shutdown_user();
#endif
_delay_ms(250);
#ifdef ATREUS_ASTAR
@@ -197,7 +203,7 @@ static action_t keycode_to_action(uint16_t keycode)
print("\nDEBUG: enabled.\n");
debug_enable = true;
break;
- case 0x5002 ... 0x50FF:
+ case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI:
// MAGIC actions (BOOTMAGIC without the boot)
if (!eeconfig_is_enabled()) {
eeconfig_init();
@@ -247,7 +253,7 @@ static action_t keycode_to_action(uint16_t keycode)
}
eeconfig_update_keymap(keymap_config.raw);
break;
- case 0x5100 ... 0x5FFF: ;
+ case TO(0, 1) ... OSM(0xFF): ;
// Layer movement shortcuts
// See .h to see constraints/usage
int type = (keycode >> 0x8) & 0xF;
@@ -268,25 +274,19 @@ static action_t keycode_to_action(uint16_t keycode)
// Set default layer
int layer = keycode & 0xFF;
action.code = ACTION_LAYER_TOGGLE(layer);
+ } else if (type == 0x5) {
+ // OSL(layer) - One-shot layer
+ int layer = keycode & 0xFF;
+ action.code = ACTION_LAYER_ONESHOT(layer);
+ } else if (type == 0x6) {
+ // OSM(mod) - One-shot mod
+ int mod = keycode & 0xFF;
+ action.code = ACTION_MODS_ONESHOT(mod);
}
break;
- #ifdef MIDI_ENABLE
- case 0x6000 ... 0x6FFF:
- action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
- break;
- #endif
- case 0x7000 ... 0x7FFF:
+ case MT(0, 0) ... MT(0xF, 0xFF):
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
break;
- case 0x8000 ... 0x8FFF:
- action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
- break;
- #ifdef UNICODE_ENABLE
- case 0x8000000 ... 0x8FFFFFF:
- uint16_t unicode = keycode & ~(0x8000);
- action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
- break;
- #endif
default:
action.code = ACTION_NO;
break;