#include #include "keyboard.h" #include "action.h" #include "util.h" #include "action_layer.h" #ifdef DEBUG_ACTION #include "debug.h" #else #include "nodebug.h" #endif /* * Default Layer State */ uint32_t default_layer_state = 0; static void default_layer_state_set(uint32_t state) { debug("default_layer_state: "); default_layer_debug(); debug(" to "); default_layer_state = state; default_layer_debug(); debug("\n"); clear_keyboard_but_mods(); // To avoid stuck keys } void default_layer_debug(void) { dprintf("%08lX(%u)", default_layer_state, biton32(default_layer_state)); } void default_layer_set(uint32_t state) { default_layer_state_set(state); } #ifndef NO_ACTION_LAYER void default_layer_or(uint32_t state) { default_layer_state_set(default_layer_state | state); } void default_layer_and(uint32_t state) { default_layer_state_set(default_layer_state & state); } void default_layer_xor(uint32_t state) { default_layer_state_set(default_layer_state ^ state); } #endif #ifndef NO_ACTION_LAYER /* * Keymap Layer State */ uint32_t layer_state = 0; static void layer_state_set(uint32_t state) { dprint("layer_state: "); layer_debug(); dprint(" to "); layer_state = state; layer_debug(); dprintln(); clear_keyboard_but_mods(); // To avoid stuck keys #ifdef ON_LAYER_CHANGE layer_change(layer_state); #endif } void layer_clear(void) { layer_state_set(0); } void layer_move(uint8_t layer) { layer_state_set(1UL<= 0; i--) { if (layers & (1UL<