Peter's keyboard firmware (QMK) https://qmk.fm/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

common_features.mk 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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. SERIAL_DIR := $(QUANTUM_DIR)/serial_link
  16. SERIAL_PATH := $(QUANTUM_PATH)/serial_link
  17. SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
  18. SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
  19. SERIAL_DEFS += -DSERIAL_LINK_ENABLE
  20. COMMON_VPATH += $(SERIAL_PATH)
  21. ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
  22. OPT_DEFS += -DAPI_SYSEX_ENABLE
  23. SRC += $(QUANTUM_DIR)/api/api_sysex.c
  24. OPT_DEFS += -DAPI_ENABLE
  25. SRC += $(QUANTUM_DIR)/api.c
  26. MIDI_ENABLE=yes
  27. endif
  28. MUSIC_ENABLE := 0
  29. ifeq ($(strip $(AUDIO_ENABLE)), yes)
  30. OPT_DEFS += -DAUDIO_ENABLE
  31. MUSIC_ENABLE := 1
  32. SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
  33. SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
  34. ifeq ($(PLATFORM),AVR)
  35. SRC += $(QUANTUM_DIR)/audio/audio.c
  36. else
  37. SRC += $(QUANTUM_DIR)/audio/audio_arm.c
  38. endif
  39. SRC += $(QUANTUM_DIR)/audio/voices.c
  40. SRC += $(QUANTUM_DIR)/audio/luts.c
  41. endif
  42. ifeq ($(strip $(MIDI_ENABLE)), yes)
  43. OPT_DEFS += -DMIDI_ENABLE
  44. MUSIC_ENABLE := 1
  45. SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
  46. endif
  47. ifeq ($(MUSIC_ENABLE), 1)
  48. SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
  49. endif
  50. ifeq ($(strip $(COMBO_ENABLE)), yes)
  51. OPT_DEFS += -DCOMBO_ENABLE
  52. SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
  53. endif
  54. ifeq ($(strip $(STENO_ENABLE)), yes)
  55. OPT_DEFS += -DSTENO_ENABLE
  56. VIRTSER_ENABLE := yes
  57. SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
  58. endif
  59. ifeq ($(strip $(VIRTSER_ENABLE)), yes)
  60. OPT_DEFS += -DVIRTSER_ENABLE
  61. endif
  62. ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
  63. OPT_DEFS += -DFAUXCLICKY_ENABLE
  64. SRC += $(QUANTUM_DIR)/fauxclicky.c
  65. endif
  66. ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
  67. OPT_DEFS += -DPOINTING_DEVICE_ENABLE
  68. OPT_DEFS += -DMOUSE_ENABLE
  69. SRC += $(QUANTUM_DIR)/pointing_device.c
  70. endif
  71. ifeq ($(strip $(UCIS_ENABLE)), yes)
  72. OPT_DEFS += -DUCIS_ENABLE
  73. UNICODE_COMMON = yes
  74. SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
  75. endif
  76. ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
  77. OPT_DEFS += -DUNICODEMAP_ENABLE
  78. UNICODE_COMMON = yes
  79. SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
  80. endif
  81. ifeq ($(strip $(UNICODE_ENABLE)), yes)
  82. OPT_DEFS += -DUNICODE_ENABLE
  83. UNICODE_COMMON = yes
  84. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
  85. endif
  86. ifeq ($(strip $(UNICODE_COMMON)), yes)
  87. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
  88. endif
  89. ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
  90. POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
  91. OPT_DEFS += -DRGBLIGHT_ENABLE
  92. SRC += $(QUANTUM_DIR)/rgblight.c
  93. CIE1931_CURVE = yes
  94. LED_BREATHING_TABLE = yes
  95. ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
  96. OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
  97. else
  98. SRC += ws2812.c
  99. endif
  100. endif
  101. VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 WS2812 custom
  102. LED_MATRIX_ENABLE ?= no
  103. ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
  104. ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
  105. $(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type)
  106. else
  107. OPT_DEFS += -DLED_MATRIX_ENABLE -DBACKLIGHT_ENABLE -DBACKLIGHT_CUSTOM_DRIVER
  108. SRC += $(QUANTUM_DIR)/led_matrix.c
  109. SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
  110. endif
  111. endif
  112. ifeq ($(strip $(LED_MATRIX_ENABLE)), IS31FL3731)
  113. OPT_DEFS += -DIS31FL3731
  114. COMMON_VPATH += $(DRIVER_PATH)/issi
  115. SRC += is31fl3731-simple.c
  116. SRC += i2c_master.c
  117. endif
  118. RGB_MATRIX_ENABLE ?= no
  119. ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
  120. ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
  121. $(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type)
  122. endif
  123. OPT_DEFS += -DRGB_MATRIX_ENABLE
  124. SRC += $(QUANTUM_DIR)/color.c
  125. SRC += $(QUANTUM_DIR)/rgb_matrix.c
  126. SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
  127. CIE1931_CURVE = yes
  128. endif
  129. ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
  130. RGB_MATRIX_ENABLE = IS31FL3731
  131. endif
  132. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
  133. OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  134. COMMON_VPATH += $(DRIVER_PATH)/issi
  135. SRC += is31fl3731.c
  136. SRC += i2c_master.c
  137. endif
  138. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
  139. OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  140. COMMON_VPATH += $(DRIVER_PATH)/issi
  141. SRC += is31fl3733.c
  142. SRC += i2c_master.c
  143. endif
  144. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737)
  145. OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  146. COMMON_VPATH += $(DRIVER_PATH)/issi
  147. SRC += is31fl3737.c
  148. SRC += i2c_master.c
  149. endif
  150. ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
  151. OPT_DEFS += -DWS2812
  152. SRC += ws2812.c
  153. endif
  154. ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
  155. OPT_DEFS += -DTAP_DANCE_ENABLE
  156. SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
  157. endif
  158. ifeq ($(strip $(KEY_LOCK_ENABLE)), yes)
  159. OPT_DEFS += -DKEY_LOCK_ENABLE
  160. SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c
  161. endif
  162. ifeq ($(strip $(PRINTING_ENABLE)), yes)
  163. OPT_DEFS += -DPRINTING_ENABLE
  164. SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
  165. SRC += $(TMK_DIR)/protocol/serial_uart.c
  166. endif
  167. ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
  168. OPT_DEFS += -DAUTO_SHIFT_ENABLE
  169. SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
  170. ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
  171. OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
  172. endif
  173. endif
  174. ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
  175. SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
  176. OPT_DEFS += $(SERIAL_DEFS)
  177. VAPTH += $(SERIAL_PATH)
  178. endif
  179. ifneq ($(strip $(VARIABLE_TRACE)),)
  180. SRC += $(QUANTUM_DIR)/variable_trace.c
  181. OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
  182. ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
  183. OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
  184. endif
  185. endif
  186. ifeq ($(strip $(LCD_ENABLE)), yes)
  187. CIE1931_CURVE = yes
  188. endif
  189. ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
  190. ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
  191. CIE1931_CURVE = yes
  192. endif
  193. ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
  194. OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
  195. endif
  196. endif
  197. ifeq ($(strip $(CIE1931_CURVE)), yes)
  198. OPT_DEFS += -DUSE_CIE1931_CURVE
  199. LED_TABLES = yes
  200. endif
  201. ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
  202. OPT_DEFS += -DUSE_LED_BREATHING_TABLE
  203. LED_TABLES = yes
  204. endif
  205. ifeq ($(strip $(LED_TABLES)), yes)
  206. SRC += $(QUANTUM_DIR)/led_tables.c
  207. endif
  208. ifeq ($(strip $(TERMINAL_ENABLE)), yes)
  209. SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
  210. OPT_DEFS += -DTERMINAL_ENABLE
  211. OPT_DEFS += -DUSER_PRINT
  212. endif
  213. ifeq ($(strip $(USB_HID_ENABLE)), yes)
  214. include $(TMK_DIR)/protocol/usb_hid.mk
  215. endif
  216. ifeq ($(strip $(ENCODER_ENABLE)), yes)
  217. SRC += $(QUANTUM_DIR)/encoder.c
  218. OPT_DEFS += -DENCODER_ENABLE
  219. endif
  220. ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L)
  221. COMMON_VPATH += $(DRIVER_PATH)/haptic
  222. SRC += haptic.c
  223. SRC += DRV2605L.c
  224. SRC += i2c_master.c
  225. OPT_DEFS += -DHAPTIC_ENABLE
  226. OPT_DEFS += -DDRV2605L
  227. endif
  228. ifeq ($(strip $(HAPTIC_ENABLE)), SOLENOID)
  229. COMMON_VPATH += $(DRIVER_PATH)/haptic
  230. SRC += haptic.c
  231. SRC += solenoid.c
  232. OPT_DEFS += -DHAPTIC_ENABLE
  233. OPT_DEFS += -DSOLENOID_ENABLE
  234. endif
  235. ifeq ($(strip $(HD44780_ENABLE)), yes)
  236. SRC += drivers/avr/hd44780.c
  237. OPT_DEFS += -DHD44780_ENABLE
  238. endif
  239. ifeq ($(strip $(VELOCIKEY_ENABLE)), yes)
  240. OPT_DEFS += -DVELOCIKEY_ENABLE
  241. SRC += $(QUANTUM_DIR)/velocikey.c
  242. endif
  243. ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes)
  244. OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE
  245. SRC += $(QUANTUM_DIR)/dynamic_keymap.c
  246. endif
  247. ifeq ($(strip $(LEADER_ENABLE)), yes)
  248. SRC += $(QUANTUM_DIR)/process_keycode/process_leader.c
  249. OPT_DEFS += -DLEADER_ENABLE
  250. endif
  251. include $(DRIVER_PATH)/qwiic/qwiic.mk
  252. QUANTUM_SRC:= \
  253. $(QUANTUM_DIR)/quantum.c \
  254. $(QUANTUM_DIR)/keymap_common.c \
  255. $(QUANTUM_DIR)/keycode_config.c
  256. # Include the standard or split matrix code if needed
  257. ifneq ($(strip $(CUSTOM_MATRIX)), yes)
  258. ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
  259. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c
  260. else
  261. QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
  262. endif
  263. endif
  264. DEBOUNCE_DIR:= $(QUANTUM_DIR)/debounce
  265. # Debounce Modules. Set DEBOUNCE_TYPE=custom if including one manually.
  266. DEBOUNCE_TYPE?= sym_g
  267. ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
  268. QUANTUM_SRC += $(DEBOUNCE_DIR)/$(strip $(DEBOUNCE_TYPE)).c
  269. endif
  270. ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
  271. POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h
  272. OPT_DEFS += -DSPLIT_KEYBOARD
  273. # Include files used by all split keyboards
  274. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_util.c
  275. # Determine which (if any) transport files are required
  276. ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
  277. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c
  278. # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
  279. # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
  280. QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/serial.c \
  281. i2c_master.c \
  282. i2c_slave.c
  283. endif
  284. COMMON_VPATH += $(QUANTUM_PATH)/split_common
  285. endif
  286. ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
  287. OPT_DEFS += -DOLED_DRIVER_ENABLE
  288. COMMON_VPATH += $(DRIVER_PATH)/oled
  289. QUANTUM_LIB_SRC += i2c_master.c
  290. SRC += oled_driver.c
  291. endif