Fixes STM32F303XC timer issue for Planck Rev 6 (#3777)
[jackhill/qmk/firmware.git] / common_features.mk
CommitLineData
1c0fe956
FS
1# Copyright 2017 Fred Sundvik
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
16SERIAL_DIR := $(QUANTUM_DIR)/serial_link
17SERIAL_PATH := $(QUANTUM_PATH)/serial_link
18SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
19SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
20SERIAL_DEFS += -DSERIAL_LINK_ENABLE
1aa0be4c 21COMMON_VPATH += $(SERIAL_PATH)
1c0fe956
FS
22
23ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
24 OPT_DEFS += -DAPI_SYSEX_ENABLE
25 SRC += $(QUANTUM_DIR)/api/api_sysex.c
26 OPT_DEFS += -DAPI_ENABLE
27 SRC += $(QUANTUM_DIR)/api.c
28 MIDI_ENABLE=yes
29endif
30
31MUSIC_ENABLE := 0
32
33ifeq ($(strip $(AUDIO_ENABLE)), yes)
34 OPT_DEFS += -DAUDIO_ENABLE
35 MUSIC_ENABLE := 1
36 SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
33fdd1d2 37 SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
5836d1a0 38 ifeq ($(PLATFORM),AVR)
39 SRC += $(QUANTUM_DIR)/audio/audio.c
40 else
41 SRC += $(QUANTUM_DIR)/audio/audio_arm.c
42 endif
1c0fe956
FS
43 SRC += $(QUANTUM_DIR)/audio/voices.c
44 SRC += $(QUANTUM_DIR)/audio/luts.c
45endif
46
47ifeq ($(strip $(MIDI_ENABLE)), yes)
48 OPT_DEFS += -DMIDI_ENABLE
49 MUSIC_ENABLE := 1
50 SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
51endif
52
53ifeq ($(MUSIC_ENABLE), 1)
54 SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
55endif
56
57ifeq ($(strip $(COMBO_ENABLE)), yes)
58 OPT_DEFS += -DCOMBO_ENABLE
59 SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
60endif
61
5987f679
JW
62ifeq ($(strip $(STENO_ENABLE)), yes)
63 OPT_DEFS += -DSTENO_ENABLE
64 VIRTSER_ENABLE := yes
65 SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
66endif
67
1c0fe956
FS
68ifeq ($(strip $(VIRTSER_ENABLE)), yes)
69 OPT_DEFS += -DVIRTSER_ENABLE
70endif
71
72ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
73 OPT_DEFS += -DFAUXCLICKY_ENABLE
74 SRC += $(QUANTUM_DIR)/fauxclicky.c
75endif
76
ee132284 77ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
2d77f9cb
RR
78 OPT_DEFS += -DPOINTING_DEVICE_ENABLE
79 OPT_DEFS += -DMOUSE_ENABLE
80 SRC += $(QUANTUM_DIR)/pointing_device.c
ee132284
S
81endif
82
1c0fe956
FS
83ifeq ($(strip $(UCIS_ENABLE)), yes)
84 OPT_DEFS += -DUCIS_ENABLE
85 UNICODE_COMMON = yes
86 SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
87endif
88
89ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
90 OPT_DEFS += -DUNICODEMAP_ENABLE
91 UNICODE_COMMON = yes
92 SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
93endif
94
95ifeq ($(strip $(UNICODE_ENABLE)), yes)
96 OPT_DEFS += -DUNICODE_ENABLE
97 UNICODE_COMMON = yes
98 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
99endif
100
101ifeq ($(strip $(UNICODE_COMMON)), yes)
102 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
103endif
104
105ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
106 OPT_DEFS += -DRGBLIGHT_ENABLE
024f0455 107 SRC += $(QUANTUM_DIR)/rgblight.c
1c0fe956
FS
108 CIE1931_CURVE = yes
109 LED_BREATHING_TABLE = yes
d5486265
LR
110 ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
111 OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
112 else
024f0455 113 SRC += ws2812.c
d5486265 114 endif
1c0fe956
FS
115endif
116
14b7602a
JH
117ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
118 OPT_DEFS += -DRGB_MATRIX_ENABLE
119 SRC += is31fl3731.c
a98a91cf 120 SRC += i2c_master.c
14b7602a
JH
121 SRC += $(QUANTUM_DIR)/color.c
122 SRC += $(QUANTUM_DIR)/rgb_matrix.c
123 CIE1931_CURVE = yes
124endif
125
1c0fe956
FS
126ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
127 OPT_DEFS += -DTAP_DANCE_ENABLE
128 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
129endif
130
8e1be7c7
FS
131ifeq ($(strip $(KEY_LOCK_ENABLE)), yes)
132 OPT_DEFS += -DKEY_LOCK_ENABLE
133 SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c
134endif
135
1c0fe956
FS
136ifeq ($(strip $(PRINTING_ENABLE)), yes)
137 OPT_DEFS += -DPRINTING_ENABLE
138 SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
139 SRC += $(TMK_DIR)/protocol/serial_uart.c
140endif
141
abba393f
JC
142ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
143 OPT_DEFS += -DAUTO_SHIFT_ENABLE
144 SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
00b4dce6
JS
145 ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
146 OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
147 endif
abba393f
JC
148endif
149
1c0fe956
FS
150ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
151 SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
152 OPT_DEFS += $(SERIAL_DEFS)
153 VAPTH += $(SERIAL_PATH)
154endif
155
156ifneq ($(strip $(VARIABLE_TRACE)),)
157 SRC += $(QUANTUM_DIR)/variable_trace.c
158 OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
159ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
160 OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
161endif
162endif
163
164ifeq ($(strip $(LCD_ENABLE)), yes)
165 CIE1931_CURVE = yes
166endif
167
168ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
169 ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
170 CIE1931_CURVE = yes
365b8635
KA
171 endif
172 ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
173 OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
1c0fe956
FS
174 endif
175endif
176
177ifeq ($(strip $(CIE1931_CURVE)), yes)
178 OPT_DEFS += -DUSE_CIE1931_CURVE
179 LED_TABLES = yes
180endif
181
182ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
183 OPT_DEFS += -DUSE_LED_BREATHING_TABLE
184 LED_TABLES = yes
185endif
186
187ifeq ($(strip $(LED_TABLES)), yes)
188 SRC += $(QUANTUM_DIR)/led_tables.c
189endif
190
7ad924ba
JH
191ifeq ($(strip $(TERMINAL_ENABLE)), yes)
192 SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
193 OPT_DEFS += -DTERMINAL_ENABLE
194endif
195
800ec55d
JH
196ifeq ($(strip $(USB_HID_ENABLE)), yes)
197 include $(TMK_DIR)/protocol/usb_hid.mk
198endif
199
bbea9dad
MA
200
201ifeq ($(strip $(HD44780_ENABLE)), yes)
202 SRC += drivers/avr/hd44780.c
203 OPT_DEFS += -DHD44780_ENABLE
204endif
205
1c0fe956
FS
206QUANTUM_SRC:= \
207 $(QUANTUM_DIR)/quantum.c \
208 $(QUANTUM_DIR)/keymap_common.c \
209 $(QUANTUM_DIR)/keycode_config.c \
210 $(QUANTUM_DIR)/process_keycode/process_leader.c
211
212ifndef CUSTOM_MATRIX
0fab3bbd
TC
213 ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
214 QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c
215 else
216 QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
217 endif
218endif
219
220ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
221 OPT_DEFS += -DSPLIT_KEYBOARD
222 QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_flags.c \
223 $(QUANTUM_DIR)/split_common/split_util.c \
224 $(QUANTUM_DIR)/split_common/i2c.c \
225 $(QUANTUM_DIR)/split_common/serial.c
8e1be7c7 226endif