aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action_layer.c
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2016-03-27 23:50:07 +0200
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2016-03-27 23:51:46 +0200
commitb4f442dfeaf4d434ae0d8459dc5199cd8fefc1c7 (patch)
tree905233e4f29dddde1348b8d9a30ef46ee0b0e775 /tmk_core/common/action_layer.c
parenta5cdc3aab1c430916eae66d4d9d751808613e700 (diff)
downloadqmk_firmware-b4f442dfeaf4d434ae0d8459dc5199cd8fefc1c7.tar.gz
qmk_firmware-b4f442dfeaf4d434ae0d8459dc5199cd8fefc1c7.zip
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.c16
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)
111#endif 111#endif
112 112
113 113
114 114int8_t layer_switch_get_layer(keypos_t key)
115action_t layer_switch_get_action(keypos_t key)
116{ 115{
117 action_t action; 116 action_t action;
118 action.code = ACTION_TRANSPARENT; 117 action.code = ACTION_TRANSPARENT;
@@ -124,15 +123,18 @@ action_t layer_switch_get_action(keypos_t key)
124 if (layers & (1UL<<i)) { 123 if (layers & (1UL<<i)) {
125 action = action_for_key(i, key); 124 action = action_for_key(i, key);
126 if (action.code != ACTION_TRANSPARENT) { 125 if (action.code != ACTION_TRANSPARENT) {
127 return action; 126 return i;
128 } 127 }
129 } 128 }
130 } 129 }
131 /* fall back to layer 0 */ 130 /* fall back to layer 0 */
132 action = action_for_key(0, key); 131 return 0;
133 return action;
134#else 132#else
135 action = action_for_key(biton32(default_layer_state), key); 133 return biton32(default_layer_state);
136 return action;
137#endif 134#endif
138} 135}
136
137action_t layer_switch_get_action(keypos_t key)
138{
139 return action_for_key(layer_switch_get_layer(key), key);
140}