diff options
Diffstat (limited to 'common/action_layer.h')
| -rw-r--r-- | common/action_layer.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/common/action_layer.h b/common/action_layer.h new file mode 100644 index 000000000..23f8a00bb --- /dev/null +++ b/common/action_layer.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef ACTION_LAYER_H | ||
| 18 | #define ACTION_LAYER_H | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include "keyboard.h" | ||
| 22 | #include "action.h" | ||
| 23 | |||
| 24 | |||
| 25 | /* | ||
| 26 | * Default Layer | ||
| 27 | */ | ||
| 28 | extern uint32_t default_layer_state; | ||
| 29 | void default_layer_debug(void); | ||
| 30 | void default_layer_set(uint8_t layer); | ||
| 31 | |||
| 32 | #ifndef NO_ACTION_LAYER | ||
| 33 | /* bitwise operation */ | ||
| 34 | void default_layer_or(uint32_t state); | ||
| 35 | void default_layer_and(uint32_t state); | ||
| 36 | void default_layer_xor(uint32_t state); | ||
| 37 | #else | ||
| 38 | #define default_layer_or(state) | ||
| 39 | #define default_layer_and(state) | ||
| 40 | #define default_layer_xor(state) | ||
| 41 | #endif | ||
| 42 | |||
| 43 | |||
| 44 | /* | ||
| 45 | * Keymap Layer | ||
| 46 | */ | ||
| 47 | #ifndef NO_ACTION_LAYER | ||
| 48 | extern uint32_t layer_state; | ||
| 49 | void layer_debug(void); | ||
| 50 | void layer_clear(void); | ||
| 51 | void layer_move(uint8_t layer); | ||
| 52 | void layer_on(uint8_t layer); | ||
| 53 | void layer_off(uint8_t layer); | ||
| 54 | void layer_invert(uint8_t layer); | ||
| 55 | /* bitwise operation */ | ||
| 56 | void layer_or(uint32_t state); | ||
| 57 | void layer_and(uint32_t state); | ||
| 58 | void layer_xor(uint32_t state); | ||
| 59 | #else | ||
| 60 | #define layer_state 0 | ||
| 61 | #define layer_clear() | ||
| 62 | #define layer_move(layer) | ||
| 63 | #define layer_on(layer) | ||
| 64 | #define layer_off(layer) | ||
| 65 | #define layer_invert(layer) | ||
| 66 | |||
| 67 | #define layer_or(state) | ||
| 68 | #define layer_and(state) | ||
| 69 | #define layer_xor(state) | ||
| 70 | #define layer_debug() | ||
| 71 | #endif | ||
| 72 | |||
| 73 | |||
| 74 | /* return action depending on current layer status */ | ||
| 75 | action_t layer_switch_get_action(key_t key); | ||
| 76 | |||
| 77 | #endif | ||
