make 'layer_state_set' visible to user code

This commit is contained in:
Colin T.A. Gray 2017-12-11 11:54:57 -07:00 committed by Jack Humbert
parent 3aec9a4354
commit bad839e6ac
2 changed files with 13 additions and 6 deletions

View File

@ -73,7 +73,7 @@ uint32_t layer_state_set_kb(uint32_t state) {
return layer_state_set_user(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); state = layer_state_set_kb(state);
dprint("layer_state: "); dprint("layer_state: ");

View File

@ -49,10 +49,13 @@ void default_layer_xor(uint32_t state);
*/ */
#ifndef NO_ACTION_LAYER #ifndef NO_ACTION_LAYER
extern uint32_t layer_state; 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_is(uint8_t layer);
bool layer_state_cmp(uint32_t layer1, uint8_t layer2); 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_move(uint8_t layer);
void layer_on(uint8_t layer); void layer_on(uint8_t layer);
void layer_off(uint8_t layer); void layer_off(uint8_t layer);
@ -63,16 +66,20 @@ void layer_and(uint32_t state);
void layer_xor(uint32_t state); void layer_xor(uint32_t state);
#else #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_clear()
#define layer_move(layer) #define layer_move(layer)
#define layer_on(layer) #define layer_on(layer)
#define layer_off(layer) #define layer_off(layer)
#define layer_invert(layer) #define layer_invert(layer)
#define layer_or(state) #define layer_or(state)
#define layer_and(state) #define layer_and(state)
#define layer_xor(state) #define layer_xor(state)
#define layer_debug()
__attribute__((weak)) __attribute__((weak))
uint32_t layer_state_set_user(uint32_t state); uint32_t layer_state_set_user(uint32_t state);