Have clang ignore the code in bootloader_size.c
[jackhill/qmk/firmware.git] / tmk_core / common / action_util.h
CommitLineData
a074364c 1/*
2Copyright 2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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
24extern "C" {
25#endif
26
27extern report_keyboard_t *keyboard_report;
28
29void send_keyboard_report(void);
30
31/* key */
fb95d86b
FS
32inline void add_key(uint8_t key) {
33 add_key_to_report(keyboard_report, key);
34}
35
36inline void del_key(uint8_t key) {
37 del_key_from_report(keyboard_report, key);
38}
39
40inline void clear_keys(void) {
41 clear_keys_from_report(keyboard_report);
42}
a074364c 43
44/* modifier */
45uint8_t get_mods(void);
46void add_mods(uint8_t mods);
47void del_mods(uint8_t mods);
48void set_mods(uint8_t mods);
49void clear_mods(void);
50
51/* weak modifier */
52uint8_t get_weak_mods(void);
53void add_weak_mods(uint8_t mods);
54void del_weak_mods(uint8_t mods);
55void set_weak_mods(uint8_t mods);
56void clear_weak_mods(void);
57
b7a81f04
DL
58/* macro modifier */
59uint8_t get_macro_mods(void);
60void add_macro_mods(uint8_t mods);
61void del_macro_mods(uint8_t mods);
62void set_macro_mods(uint8_t mods);
63void clear_macro_mods(void);
64
a074364c 65/* oneshot modifier */
66void set_oneshot_mods(uint8_t mods);
74e97eef 67uint8_t get_oneshot_mods(void);
a074364c 68void clear_oneshot_mods(void);
69void oneshot_toggle(void);
70void oneshot_enable(void);
71void oneshot_disable(void);
74e97eef
TA
72bool has_oneshot_mods_timed_out(void);
73
47051f50
TB
74uint8_t get_oneshot_locked_mods(void);
75void set_oneshot_locked_mods(uint8_t mods);
74e97eef
TA
76void clear_oneshot_locked_mods(void);
77
78typedef enum {
79 ONESHOT_PRESSED = 0b01,
80 ONESHOT_OTHER_KEY_PRESSED = 0b10,
81 ONESHOT_START = 0b11,
82 ONESHOT_TOGGLED = 0b100
83} oneshot_fullfillment_t;
84void set_oneshot_layer(uint8_t layer, uint8_t state);
85uint8_t get_oneshot_layer(void);
86void clear_oneshot_layer_state(oneshot_fullfillment_t state);
87void reset_oneshot_layer(void);
88bool is_oneshot_layer_active(void);
89uint8_t get_oneshot_layer_state(void);
90bool has_oneshot_layer_timed_out(void);
a074364c 91
47051f50
TB
92void oneshot_locked_mods_changed_user(uint8_t mods);
93void oneshot_locked_mods_changed_kb(uint8_t mods);
94void oneshot_mods_changed_user(uint8_t mods);
95void oneshot_mods_changed_kb(uint8_t mods);
96void oneshot_layer_changed_user(uint8_t layer);
97void oneshot_layer_changed_kb(uint8_t layer);
98
a074364c 99/* inspect */
a074364c 100uint8_t has_anymod(void);
a074364c 101
102#ifdef __cplusplus
103}
104#endif
105
106#endif