]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/quantum.h
Merge pull request #1601 from dlaroe/master
[qmk_firmware.git] / quantum / quantum.h
1 /* Copyright 2016-2017 Erez Zukerman, Jack Humbert
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef QUANTUM_H
17 #define QUANTUM_H
18
19 #if defined(__AVR__)
20 #include <avr/pgmspace.h>
21 #include <avr/io.h>
22 #include <avr/interrupt.h>
23 #endif
24 #include "wait.h"
25 #include "matrix.h"
26 #include "keymap.h"
27 #ifdef BACKLIGHT_ENABLE
28     #include "backlight.h"
29 #endif
30 #ifdef RGBLIGHT_ENABLE
31   #include "rgblight.h"
32 #endif
33 #include "action_layer.h"
34 #include "eeconfig.h"
35 #include <stddef.h>
36 #include "bootloader.h"
37 #include "timer.h"
38 #include "config_common.h"
39 #include "led.h"
40 #include "action_util.h"
41 #include <stdlib.h>
42 #include "print.h"
43
44
45 extern uint32_t default_layer_state;
46
47 #ifndef NO_ACTION_LAYER
48         extern uint32_t layer_state;
49 #endif
50
51 #ifdef MIDI_ENABLE
52         #include <lufa.h>
53 #ifdef MIDI_ADVANCED
54         #include "process_midi.h"
55 #endif
56 #endif // MIDI_ENABLE
57
58 #ifdef AUDIO_ENABLE
59         #include "audio.h"
60         #include "process_audio.h"
61 #endif
62
63 #ifdef STENO_ENABLE
64         #include "process_steno.h"
65 #endif
66
67 #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
68         #include "process_music.h"
69 #endif
70
71 #ifndef DISABLE_LEADER
72         #include "process_leader.h"
73 #endif
74
75 #define DISABLE_CHORDING
76 #ifndef DISABLE_CHORDING
77         #include "process_chording.h"
78 #endif
79
80 #ifdef UNICODE_ENABLE
81         #include "process_unicode.h"
82 #endif
83
84 #ifdef UCIS_ENABLE
85         #include "process_ucis.h"
86 #endif
87
88 #ifdef UNICODEMAP_ENABLE
89         #include "process_unicodemap.h"
90 #endif
91
92 #include "process_tap_dance.h"
93
94 #ifdef PRINTING_ENABLE
95         #include "process_printer.h"
96 #endif
97
98 #ifdef COMBO_ENABLE
99         #include "process_combo.h"
100 #endif
101
102 #ifdef KEY_LOCK_ENABLE
103         #include "process_key_lock.h"
104 #endif
105
106 #define SEND_STRING(str) send_string(PSTR(str))
107 extern const bool ascii_to_shift_lut[0x80];
108 extern const uint8_t ascii_to_keycode_lut[0x80];
109 void send_string(const char *str);
110 void send_string_with_delay(const char *str, uint8_t interval);
111
112 // For tri-layer
113 void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
114
115 void set_single_persistent_default_layer(uint8_t default_layer);
116
117 void tap_random_base64(void);
118
119 #define IS_LAYER_ON(layer)  (layer_state & (1UL << (layer)))
120 #define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
121
122 void matrix_init_kb(void);
123 void matrix_scan_kb(void);
124 void matrix_init_user(void);
125 void matrix_scan_user(void);
126 bool process_action_kb(keyrecord_t *record);
127 bool process_record_kb(uint16_t keycode, keyrecord_t *record);
128 bool process_record_user(uint16_t keycode, keyrecord_t *record);
129
130 void reset_keyboard(void);
131
132 void startup_user(void);
133 void shutdown_user(void);
134
135 void register_code16 (uint16_t code);
136 void unregister_code16 (uint16_t code);
137
138 #ifdef BACKLIGHT_ENABLE
139 void backlight_init_ports(void);
140 void backlight_task(void);
141
142 #ifdef BACKLIGHT_BREATHING
143 void breathing_enable(void);
144 void breathing_pulse(void);
145 void breathing_disable(void);
146 void breathing_self_disable(void);
147 void breathing_toggle(void);
148 bool is_breathing(void);
149
150 void breathing_defaults(void);
151 void breathing_intensity_default(void);
152 void breathing_speed_default(void);
153 void breathing_speed_set(uint8_t value);
154 void breathing_speed_inc(uint8_t value);
155 void breathing_speed_dec(uint8_t value);
156 #endif
157
158 #endif
159 void send_dword(uint32_t number);
160 void send_word(uint16_t number);
161 void send_byte(uint8_t number);
162 void send_nibble(uint8_t number);
163 uint16_t hex_to_keycode(uint8_t hex);
164
165 void led_set_user(uint8_t usb_led);
166 void led_set_kb(uint8_t usb_led);
167
168 void api_send_unicode(uint32_t unicode);
169
170 #endif