diff options
author | Colin T.A. Gray <colinta@gmail.com> | 2017-12-11 11:54:57 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2017-12-15 13:23:30 -0500 |
commit | bad839e6ac815f9fc0836d8170b716838fbc87b7 (patch) | |
tree | dfe86f3a28f8c944d1fe7e786620ae947362219d /tmk_core/common | |
parent | 3aec9a4354440f36adbfb8e1a1feb9942724b74c (diff) | |
download | qmk_firmware-bad839e6ac815f9fc0836d8170b716838fbc87b7.tar.gz |
make 'layer_state_set' visible to user code
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/action_layer.c | 2 | ||||
-rw-r--r-- | tmk_core/common/action_layer.h | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 9dfbba9da..22331376a 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 5fad18cbd..72a6bd8f6 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); |