diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 9dfbba9daa..22331376aa 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -73,7 +73,7 @@ uint32_t layer_state_set_kb(uint32_t state) { return layer_state_set_user(state); } -static void layer_state_set(uint32_t state) +void layer_state_set(uint32_t state) { state = layer_state_set_kb(state); dprint("layer_state: "); diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index 5fad18cbd6..72a6bd8f68 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -49,10 +49,13 @@ void default_layer_xor(uint32_t state); */ #ifndef NO_ACTION_LAYER extern uint32_t layer_state; -void layer_debug(void); -void layer_clear(void); + +void layer_state_set(uint32_t state); bool layer_state_is(uint8_t layer); bool layer_state_cmp(uint32_t layer1, uint8_t layer2); + +void layer_debug(void); +void layer_clear(void); void layer_move(uint8_t layer); void layer_on(uint8_t layer); void layer_off(uint8_t layer); @@ -62,17 +65,21 @@ void layer_or(uint32_t state); void layer_and(uint32_t state); void layer_xor(uint32_t state); #else -#define layer_state 0 +#define layer_state 0 + +#define layer_state_set(layer) +#define layer_state_is(layer) (layer == 0) +#define layer_state_cmp(state, layer) (state == 0 ? layer == 0 : (state & 1UL << layer) != 0) + +#define layer_debug() #define layer_clear() #define layer_move(layer) #define layer_on(layer) #define layer_off(layer) #define layer_invert(layer) - #define layer_or(state) #define layer_and(state) #define layer_xor(state) -#define layer_debug() __attribute__((weak)) uint32_t layer_state_set_user(uint32_t state);