Commit | Line | Data |
---|---|---|
a074364c | 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_UTIL_H | |
18 | #define ACTION_UTIL_H | |
19 | ||
20 | #include <stdint.h> | |
21 | #include "report.h" | |
22 | ||
23 | #ifdef __cplusplus | |
24 | extern "C" { | |
25 | #endif | |
26 | ||
27 | extern report_keyboard_t *keyboard_report; | |
28 | ||
29 | void send_keyboard_report(void); | |
30 | ||
31 | /* key */ | |
b624f32f | 32 | inline void add_key(uint8_t key) { add_key_to_report(keyboard_report, key); } |
fb95d86b | 33 | |
b624f32f | 34 | inline void del_key(uint8_t key) { del_key_from_report(keyboard_report, key); } |
fb95d86b | 35 | |
b624f32f | 36 | inline void clear_keys(void) { clear_keys_from_report(keyboard_report); } |
a074364c | 37 | |
38 | /* modifier */ | |
39 | uint8_t get_mods(void); | |
b624f32f | 40 | void add_mods(uint8_t mods); |
41 | void del_mods(uint8_t mods); | |
42 | void set_mods(uint8_t mods); | |
43 | void clear_mods(void); | |
a074364c | 44 | |
45 | /* weak modifier */ | |
46 | uint8_t get_weak_mods(void); | |
b624f32f | 47 | void add_weak_mods(uint8_t mods); |
48 | void del_weak_mods(uint8_t mods); | |
49 | void set_weak_mods(uint8_t mods); | |
50 | void clear_weak_mods(void); | |
a074364c | 51 | |
b7a81f04 DL |
52 | /* macro modifier */ |
53 | uint8_t get_macro_mods(void); | |
b624f32f | 54 | void add_macro_mods(uint8_t mods); |
55 | void del_macro_mods(uint8_t mods); | |
56 | void set_macro_mods(uint8_t mods); | |
57 | void clear_macro_mods(void); | |
b7a81f04 | 58 | |
a074364c | 59 | /* oneshot modifier */ |
b624f32f | 60 | void set_oneshot_mods(uint8_t mods); |
74e97eef | 61 | uint8_t get_oneshot_mods(void); |
b624f32f | 62 | void clear_oneshot_mods(void); |
63 | void oneshot_toggle(void); | |
64 | void oneshot_enable(void); | |
65 | void oneshot_disable(void); | |
66 | bool has_oneshot_mods_timed_out(void); | |
74e97eef | 67 | |
47051f50 | 68 | uint8_t get_oneshot_locked_mods(void); |
b624f32f | 69 | void set_oneshot_locked_mods(uint8_t mods); |
70 | void clear_oneshot_locked_mods(void); | |
71 | ||
72 | typedef enum { ONESHOT_PRESSED = 0b01, ONESHOT_OTHER_KEY_PRESSED = 0b10, ONESHOT_START = 0b11, ONESHOT_TOGGLED = 0b100 } oneshot_fullfillment_t; | |
73 | void set_oneshot_layer(uint8_t layer, uint8_t state); | |
74e97eef | 74 | uint8_t get_oneshot_layer(void); |
b624f32f | 75 | void clear_oneshot_layer_state(oneshot_fullfillment_t state); |
76 | void reset_oneshot_layer(void); | |
77 | bool is_oneshot_layer_active(void); | |
74e97eef | 78 | uint8_t get_oneshot_layer_state(void); |
b624f32f | 79 | bool has_oneshot_layer_timed_out(void); |
a074364c | 80 | |
47051f50 TB |
81 | void oneshot_locked_mods_changed_user(uint8_t mods); |
82 | void oneshot_locked_mods_changed_kb(uint8_t mods); | |
83 | void oneshot_mods_changed_user(uint8_t mods); | |
84 | void oneshot_mods_changed_kb(uint8_t mods); | |
85 | void oneshot_layer_changed_user(uint8_t layer); | |
86 | void oneshot_layer_changed_kb(uint8_t layer); | |
87 | ||
a074364c | 88 | /* inspect */ |
a074364c | 89 | uint8_t has_anymod(void); |
a074364c | 90 | |
91 | #ifdef __cplusplus | |
92 | } | |
93 | #endif | |
94 | ||
95 | #endif |