diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2016-03-27 23:50:07 +0200 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2016-03-27 23:51:46 +0200 |
commit | b4f442dfeaf4d434ae0d8459dc5199cd8fefc1c7 (patch) | |
tree | 905233e4f29dddde1348b8d9a30ef46ee0b0e775 /tmk_core/common/action_layer.c | |
parent | a5cdc3aab1c430916eae66d4d9d751808613e700 (diff) | |
download | qmk_firmware-b4f442dfeaf4d434ae0d8459dc5199cd8fefc1c7.tar.gz |
Cut the memory consumption of PREVENT_STUCK_MODIFIERS in half
Diffstat (limited to 'tmk_core/common/action_layer.c')
-rw-r--r-- | tmk_core/common/action_layer.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index c535615f4..76164adb5 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -111,8 +111,7 @@ void layer_debug(void) #endif - -action_t layer_switch_get_action(keypos_t key) +int8_t layer_switch_get_layer(keypos_t key) { action_t action; action.code = ACTION_TRANSPARENT; @@ -124,15 +123,18 @@ action_t layer_switch_get_action(keypos_t key) if (layers & (1UL<<i)) { action = action_for_key(i, key); if (action.code != ACTION_TRANSPARENT) { - return action; + return i; } } } /* fall back to layer 0 */ - action = action_for_key(0, key); - return action; + return 0; #else - action = action_for_key(biton32(default_layer_state), key); - return action; + return biton32(default_layer_state); #endif } + +action_t layer_switch_get_action(keypos_t key) +{ + return action_for_key(layer_switch_get_layer(key), key); +} |