From e324fa29187dff7868d9d7fd378e0e46d77107a5 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 16 Feb 2013 04:05:58 +0900 Subject: Rewrite layer action with layer_switch --- common/layer_switch.h | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'common/layer_switch.h') diff --git a/common/layer_switch.h b/common/layer_switch.h index 9f0695260..25c81a5dc 100644 --- a/common/layer_switch.h +++ b/common/layer_switch.h @@ -21,16 +21,39 @@ along with this program. If not, see . #include "keyboard.h" #include "action.h" -uint16_t layer_switch_stat; -uint16_t layer_switch_stat_get(void); -void layer_switch_stat_set(uint16_t stat); +/* base layer to fall back */ +extern uint8_t default_layer; + +/* layer status */ +extern uint16_t layer_switch_stat; + +/* return layer status */ +uint16_t layer_switch_get_stat(void); +/* return current active layer */ +uint8_t layer_switch_get_layer(void); + +/* switch off all layers */ void layer_switch_clear(void); +/* set layer status */ +void layer_switch_set(uint16_t stat); +/* move to layer */ +void layer_switch_move(uint8_t layer); +/* switch on layer */ void layer_switch_on(uint8_t layer); +/* switch off layer */ void layer_switch_off(uint8_t layer); -/* invert state */ -void layer_switch_inv(uint8_t layer); +/* switch state of layer */ +void layer_switch_invert(uint8_t layer); + +/* bitwise operation against layer status */ +void layer_switch_or(uint16_t stat); +void layer_switch_and(uint16_t stat); +void layer_switch_xor(uint16_t stat); + void layer_switch_debug(void); + +/* return action depending on current layer status */ action_t layer_switch_get_action(key_t key); #endif -- cgit v1.2.3