]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/common/action_util.h
Initial commit for handwired numpad
[qmk_firmware.git] / tmk_core / common / action_util.h
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 */
32 void add_key(uint8_t key);
33 void del_key(uint8_t key);
34 void clear_keys(void);
35
36 /* modifier */
37 uint8_t get_mods(void);
38 void add_mods(uint8_t mods);
39 void del_mods(uint8_t mods);
40 void set_mods(uint8_t mods);
41 void clear_mods(void);
42
43 /* weak modifier */
44 uint8_t get_weak_mods(void);
45 void add_weak_mods(uint8_t mods);
46 void del_weak_mods(uint8_t mods);
47 void set_weak_mods(uint8_t mods);
48 void clear_weak_mods(void);
49
50 /* macro modifier */
51 uint8_t get_macro_mods(void);
52 void add_macro_mods(uint8_t mods);
53 void del_macro_mods(uint8_t mods);
54 void set_macro_mods(uint8_t mods);
55 void clear_macro_mods(void);
56
57 /* oneshot modifier */
58 void set_oneshot_mods(uint8_t mods);
59 uint8_t get_oneshot_mods(void);
60 void clear_oneshot_mods(void);
61 void oneshot_toggle(void);
62 void oneshot_enable(void);
63 void oneshot_disable(void);
64 bool has_oneshot_mods_timed_out(void);
65
66 int8_t get_oneshot_locked_mods(void);
67 void set_oneshot_locked_mods(int8_t mods);
68 void clear_oneshot_locked_mods(void);
69
70 typedef enum {
71   ONESHOT_PRESSED = 0b01,
72   ONESHOT_OTHER_KEY_PRESSED = 0b10,
73   ONESHOT_START = 0b11,
74   ONESHOT_TOGGLED = 0b100
75 } oneshot_fullfillment_t;
76 void set_oneshot_layer(uint8_t layer, uint8_t state);
77 uint8_t get_oneshot_layer(void);
78 void clear_oneshot_layer_state(oneshot_fullfillment_t state);
79 void reset_oneshot_layer(void);
80 bool is_oneshot_layer_active(void);
81 uint8_t get_oneshot_layer_state(void);
82 bool has_oneshot_layer_timed_out(void);
83
84 /* inspect */
85 uint8_t has_anykey(void);
86 uint8_t has_anymod(void);
87 uint8_t get_first_key(void);
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif