]> git.gir.st - tmk_keyboard.git/blob - common/action.h
Just ignore ADB Service Request
[tmk_keyboard.git] / common / action.h
1 /*
2 Copyright 2012,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_H
18 #define ACTION_H
19
20 #include <stdint.h>
21 #include <stdbool.h>
22 #include "keyboard.h"
23 #include "keycode.h"
24 #include "action_code.h"
25 #include "action_macro.h"
26
27
28 /* tapping count and state */
29 typedef struct {
30 bool interrupted :1;
31 bool reserved2 :1;
32 bool reserved1 :1;
33 bool reserved0 :1;
34 uint8_t count :4;
35 } tap_t;
36
37 /* Key event container for recording */
38 typedef struct {
39 keyevent_t event;
40 #ifndef NO_ACTION_TAPPING
41 tap_t tap;
42 #endif
43 } keyrecord_t;
44
45
46 /* Execute action per keyevent */
47 void action_exec(keyevent_t event);
48
49 /* action for key */
50 action_t action_for_key(uint8_t layer, key_t key);
51
52 /* macro */
53 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
54
55 /* user defined special function */
56 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
57
58 /* Utilities for actions. */
59 void process_action(keyrecord_t *record);
60 void register_code(uint8_t code);
61 void unregister_code(uint8_t code);
62 void register_mods(uint8_t mods);
63 void unregister_mods(uint8_t mods);
64 //void set_mods(uint8_t mods);
65 void clear_keyboard(void);
66 void clear_keyboard_but_mods(void);
67 void layer_switch(uint8_t new_layer);
68 bool is_tap_key(key_t key);
69
70 /* debug */
71 void debug_event(keyevent_t event);
72 void debug_record(keyrecord_t record);
73 void debug_action(action_t action);
74
75 #endif /* ACTION_H */
Imprint / Impressum