diff options
Diffstat (limited to 'tmk_core/common/action_util.h')
-rw-r--r-- | tmk_core/common/action_util.h | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h index d03f5682a..1ce03ed0e 100644 --- a/tmk_core/common/action_util.h +++ b/tmk_core/common/action_util.h | |||
@@ -29,65 +29,54 @@ extern report_keyboard_t *keyboard_report; | |||
29 | void send_keyboard_report(void); | 29 | void send_keyboard_report(void); |
30 | 30 | ||
31 | /* key */ | 31 | /* key */ |
32 | inline void add_key(uint8_t key) { | 32 | inline void add_key(uint8_t key) { add_key_to_report(keyboard_report, key); } |
33 | add_key_to_report(keyboard_report, key); | ||
34 | } | ||
35 | 33 | ||
36 | inline void del_key(uint8_t key) { | 34 | inline void del_key(uint8_t key) { del_key_from_report(keyboard_report, key); } |
37 | del_key_from_report(keyboard_report, key); | ||
38 | } | ||
39 | 35 | ||
40 | inline void clear_keys(void) { | 36 | inline void clear_keys(void) { clear_keys_from_report(keyboard_report); } |
41 | clear_keys_from_report(keyboard_report); | ||
42 | } | ||
43 | 37 | ||
44 | /* modifier */ | 38 | /* modifier */ |
45 | uint8_t get_mods(void); | 39 | uint8_t get_mods(void); |
46 | void add_mods(uint8_t mods); | 40 | void add_mods(uint8_t mods); |
47 | void del_mods(uint8_t mods); | 41 | void del_mods(uint8_t mods); |
48 | void set_mods(uint8_t mods); | 42 | void set_mods(uint8_t mods); |
49 | void clear_mods(void); | 43 | void clear_mods(void); |
50 | 44 | ||
51 | /* weak modifier */ | 45 | /* weak modifier */ |
52 | uint8_t get_weak_mods(void); | 46 | uint8_t get_weak_mods(void); |
53 | void add_weak_mods(uint8_t mods); | 47 | void add_weak_mods(uint8_t mods); |
54 | void del_weak_mods(uint8_t mods); | 48 | void del_weak_mods(uint8_t mods); |
55 | void set_weak_mods(uint8_t mods); | 49 | void set_weak_mods(uint8_t mods); |
56 | void clear_weak_mods(void); | 50 | void clear_weak_mods(void); |
57 | 51 | ||
58 | /* macro modifier */ | 52 | /* macro modifier */ |
59 | uint8_t get_macro_mods(void); | 53 | uint8_t get_macro_mods(void); |
60 | void add_macro_mods(uint8_t mods); | 54 | void add_macro_mods(uint8_t mods); |
61 | void del_macro_mods(uint8_t mods); | 55 | void del_macro_mods(uint8_t mods); |
62 | void set_macro_mods(uint8_t mods); | 56 | void set_macro_mods(uint8_t mods); |
63 | void clear_macro_mods(void); | 57 | void clear_macro_mods(void); |
64 | 58 | ||
65 | /* oneshot modifier */ | 59 | /* oneshot modifier */ |
66 | void set_oneshot_mods(uint8_t mods); | 60 | void set_oneshot_mods(uint8_t mods); |
67 | uint8_t get_oneshot_mods(void); | 61 | uint8_t get_oneshot_mods(void); |
68 | void clear_oneshot_mods(void); | 62 | void clear_oneshot_mods(void); |
69 | void oneshot_toggle(void); | 63 | void oneshot_toggle(void); |
70 | void oneshot_enable(void); | 64 | void oneshot_enable(void); |
71 | void oneshot_disable(void); | 65 | void oneshot_disable(void); |
72 | bool has_oneshot_mods_timed_out(void); | 66 | bool has_oneshot_mods_timed_out(void); |
73 | 67 | ||
74 | uint8_t get_oneshot_locked_mods(void); | 68 | uint8_t get_oneshot_locked_mods(void); |
75 | void set_oneshot_locked_mods(uint8_t mods); | 69 | void set_oneshot_locked_mods(uint8_t mods); |
76 | void clear_oneshot_locked_mods(void); | 70 | void clear_oneshot_locked_mods(void); |
77 | 71 | ||
78 | typedef enum { | 72 | typedef enum { ONESHOT_PRESSED = 0b01, ONESHOT_OTHER_KEY_PRESSED = 0b10, ONESHOT_START = 0b11, ONESHOT_TOGGLED = 0b100 } oneshot_fullfillment_t; |
79 | ONESHOT_PRESSED = 0b01, | 73 | void set_oneshot_layer(uint8_t layer, uint8_t state); |
80 | ONESHOT_OTHER_KEY_PRESSED = 0b10, | ||
81 | ONESHOT_START = 0b11, | ||
82 | ONESHOT_TOGGLED = 0b100 | ||
83 | } oneshot_fullfillment_t; | ||
84 | void set_oneshot_layer(uint8_t layer, uint8_t state); | ||
85 | uint8_t get_oneshot_layer(void); | 74 | uint8_t get_oneshot_layer(void); |
86 | void clear_oneshot_layer_state(oneshot_fullfillment_t state); | 75 | void clear_oneshot_layer_state(oneshot_fullfillment_t state); |
87 | void reset_oneshot_layer(void); | 76 | void reset_oneshot_layer(void); |
88 | bool is_oneshot_layer_active(void); | 77 | bool is_oneshot_layer_active(void); |
89 | uint8_t get_oneshot_layer_state(void); | 78 | uint8_t get_oneshot_layer_state(void); |
90 | bool has_oneshot_layer_timed_out(void); | 79 | bool has_oneshot_layer_timed_out(void); |
91 | 80 | ||
92 | void oneshot_locked_mods_changed_user(uint8_t mods); | 81 | void oneshot_locked_mods_changed_user(uint8_t mods); |
93 | void oneshot_locked_mods_changed_kb(uint8_t mods); | 82 | void oneshot_locked_mods_changed_kb(uint8_t mods); |