logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

constants.py (13687B)


  1. """Information that should be available to the python library.
  2. """
  3. from os import environ
  4. from datetime import date
  5. from pathlib import Path
  6. from qmk.userspace import detect_qmk_userspace
  7. # The root of the qmk_firmware tree.
  8. QMK_FIRMWARE = Path.cwd()
  9. # The detected userspace tree
  10. QMK_USERSPACE = detect_qmk_userspace()
  11. # Whether or not we have a separate userspace directory
  12. HAS_QMK_USERSPACE = True if QMK_USERSPACE is not None else False
  13. # Upstream repo url
  14. QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
  15. # This is the number of directories under `qmk_firmware/keyboards` that will be traversed. This is currently a limitation of our make system.
  16. MAX_KEYBOARD_SUBFOLDERS = 5
  17. # Supported processor types
  18. CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G0B1', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'AT32F415'
  19. LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
  20. VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
  21. # Bootloaders of the supported processors
  22. MCU2BOOTLOADER = {
  23. "RP2040": "rp2040",
  24. "MKL26Z64": "halfkay",
  25. "MK20DX128": "halfkay",
  26. "MK20DX256": "halfkay",
  27. "MK66FX1M0": "halfkay",
  28. "STM32F042": "stm32-dfu",
  29. "STM32F072": "stm32-dfu",
  30. "STM32F103": "stm32duino",
  31. "STM32F303": "stm32-dfu",
  32. "STM32F401": "stm32-dfu",
  33. "STM32F405": "stm32-dfu",
  34. "STM32F407": "stm32-dfu",
  35. "STM32F411": "stm32-dfu",
  36. "STM32F446": "stm32-dfu",
  37. "STM32G0B1": "stm32-dfu",
  38. "STM32G431": "stm32-dfu",
  39. "STM32G474": "stm32-dfu",
  40. "STM32H723": "stm32-dfu",
  41. "STM32H733": "stm32-dfu",
  42. "STM32L412": "stm32-dfu",
  43. "STM32L422": "stm32-dfu",
  44. "STM32L432": "stm32-dfu",
  45. "STM32L433": "stm32-dfu",
  46. "STM32L442": "stm32-dfu",
  47. "STM32L443": "stm32-dfu",
  48. "GD32VF103": "gd32v-dfu",
  49. "WB32F3G71": "wb32-dfu",
  50. "WB32FQ95": "wb32-dfu",
  51. "AT32F415": "at32-dfu",
  52. "atmega16u2": "atmel-dfu",
  53. "atmega32u2": "atmel-dfu",
  54. "atmega16u4": "atmel-dfu",
  55. "atmega32u4": "atmel-dfu",
  56. "at90usb162": "atmel-dfu",
  57. "at90usb646": "atmel-dfu",
  58. "at90usb647": "atmel-dfu",
  59. "at90usb1286": "atmel-dfu",
  60. "at90usb1287": "atmel-dfu",
  61. "atmega32a": "bootloadhid",
  62. "atmega328p": "usbasploader",
  63. "atmega328": "usbasploader",
  64. }
  65. # Map of legacy keycodes that can be automatically updated
  66. LEGACY_KEYCODES = { # Comment here is to force multiline formatting
  67. 'RESET': 'QK_BOOT'
  68. }
  69. # Map VID:PID values to bootloaders
  70. BOOTLOADER_VIDS_PIDS = {
  71. 'atmel-dfu': {
  72. ("03eb", "2fef"), # ATmega16U2
  73. ("03eb", "2ff0"), # ATmega32U2
  74. ("03eb", "2ff3"), # ATmega16U4
  75. ("03eb", "2ff4"), # ATmega32U4
  76. ("03eb", "2ff9"), # AT90USB64
  77. ("03eb", "2ffa"), # AT90USB162
  78. ("03eb", "2ffb") # AT90USB128
  79. },
  80. 'kiibohd': {("1c11", "b007")},
  81. 'stm32-dfu': {
  82. ("1eaf", "0003"), # STM32duino
  83. ("0483", "df11") # STM32 DFU
  84. },
  85. 'apm32-dfu': {("314b", "0106")},
  86. 'gd32v-dfu': {("28e9", "0189")},
  87. 'wb32-dfu': {("342d", "dfa0")},
  88. 'at32-dfu': {("2e3c", "df11")},
  89. 'bootloadhid': {("16c0", "05df")},
  90. 'usbasploader': {("16c0", "05dc")},
  91. 'usbtinyisp': {("1782", "0c9f")},
  92. 'md-boot': {("03eb", "6124")},
  93. 'caterina': {
  94. # pid.codes shared PID
  95. ("1209", "2302"), # Keyboardio Atreus 2 Bootloader
  96. # Spark Fun Electronics
  97. ("1b4f", "9203"), # Pro Micro 3V3/8MHz
  98. ("1b4f", "9205"), # Pro Micro 5V/16MHz
  99. ("1b4f", "9207"), # LilyPad 3V3/8MHz (and some Pro Micro clones)
  100. # Pololu Electronics
  101. ("1ffb", "0101"), # A-Star 32U4
  102. # Arduino SA
  103. ("2341", "0036"), # Leonardo
  104. ("2341", "0037"), # Micro
  105. # Adafruit Industries LLC
  106. ("239a", "000c"), # Feather 32U4
  107. ("239a", "000d"), # ItsyBitsy 32U4 3V3/8MHz
  108. ("239a", "000e"), # ItsyBitsy 32U4 5V/16MHz
  109. # dog hunter AG
  110. ("2a03", "0036"), # Leonardo
  111. ("2a03", "0037") # Micro
  112. },
  113. 'hid-bootloader': {
  114. ("03eb", "2067"), # QMK HID
  115. ("16c0", "0478") # PJRC halfkay
  116. }
  117. }
  118. # Common format strings
  119. DATE_FORMAT = '%Y-%m-%d'
  120. DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
  121. TIME_FORMAT = '%H:%M:%S'
  122. # Used when generating matrix locations
  123. COL_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijilmnopqrstuvwxyz'
  124. ROW_LETTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop'
  125. # Constants that should match their counterparts in make
  126. BUILD_DIR = environ.get('BUILD_DIR', '.build')
  127. INTERMEDIATE_OUTPUT_PREFIX = f'{BUILD_DIR}/obj_'
  128. # Headers for generated files
  129. GPL2_HEADER_C_LIKE = f'''\
  130. // Copyright {date.today().year} QMK
  131. // SPDX-License-Identifier: GPL-2.0-or-later
  132. '''
  133. GPL2_HEADER_SH_LIKE = f'''\
  134. # Copyright {date.today().year} QMK
  135. # SPDX-License-Identifier: GPL-2.0-or-later
  136. '''
  137. GENERATED_HEADER_C_LIKE = '''\
  138. /*******************************************************************************
  139. 88888888888 888 d8b .d888 d8b 888 d8b
  140. 888 888 Y8P d88P" Y8P 888 Y8P
  141. 888 888 888 888
  142. 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
  143. 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
  144. 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
  145. 888 888 888 888 X88 888 888 888 Y8b. 888 X88
  146. 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
  147. 888 888
  148. 888 888
  149. 888 888
  150. .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
  151. d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
  152. 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
  153. Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
  154. "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
  155. 888
  156. Y8b d88P
  157. "Y88P"
  158. *******************************************************************************/
  159. '''
  160. GENERATED_HEADER_SH_LIKE = '''\
  161. ################################################################################
  162. #
  163. # 88888888888 888 d8b .d888 d8b 888 d8b
  164. # 888 888 Y8P d88P" Y8P 888 Y8P
  165. # 888 888 888 888
  166. # 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
  167. # 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
  168. # 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
  169. # 888 888 888 888 X88 888 888 888 Y8b. 888 X88
  170. # 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
  171. #
  172. # 888 888
  173. # 888 888
  174. # 888 888
  175. # .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
  176. # d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
  177. # 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
  178. # Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
  179. # "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
  180. # 888
  181. # Y8b d88P
  182. # "Y88P"
  183. #
  184. ################################################################################
  185. '''
  186. LICENSE_TEXTS = [
  187. (
  188. 'GPL-2.0-or-later', [
  189. """\
  190. This program is free software; you can redistribute it and/or
  191. modify it under the terms of the GNU General Public License
  192. as published by the Free Software Foundation; either version 2
  193. of the License, or (at your option) any later version.
  194. """, """\
  195. This program is free software; you can redistribute it and/or
  196. modify it under the terms of the GNU General Public License
  197. as published by the Free Software Foundation; either version 2
  198. of the License, or any later version.
  199. """
  200. ]
  201. ),
  202. ('GPL-2.0-only', ["""\
  203. This program is free software; you can redistribute it and/or
  204. modify it under the terms of the GNU General Public License as
  205. published by the Free Software Foundation; version 2.
  206. """]),
  207. (
  208. 'GPL-3.0-or-later', [
  209. """\
  210. This program is free software: you can redistribute it and/or
  211. modify it under the terms of the GNU General Public License as
  212. published by the Free Software Foundation, either version 3 of
  213. the License, or (at your option) any later version.
  214. """, """\
  215. This program is free software: you can redistribute it and/or
  216. modify it under the terms of the GNU General Public License as
  217. published by the Free Software Foundation, either version 3 of
  218. the License, or any later version.
  219. """
  220. ]
  221. ),
  222. ('GPL-3.0-only', ["""\
  223. This program is free software: you can redistribute it and/or
  224. modify it under the terms of the GNU General Public License as
  225. published by the Free Software Foundation, version 3.
  226. """]),
  227. (
  228. 'LGPL-2.1-or-later', [
  229. """\
  230. This program is free software; you can redistribute it and/or
  231. modify it under the terms of the GNU Lesser General Public License
  232. as published by the Free Software Foundation; either version 2.1
  233. of the License, or (at your option) any later version.
  234. """, """\
  235. This program is free software; you can redistribute it and/or
  236. modify it under the terms of the GNU Lesser General Public License
  237. as published by the Free Software Foundation; either version 2.1
  238. of the License, or any later version.
  239. """, """\
  240. This library is free software; you can redistribute it and/or
  241. modify it under the terms of the GNU Lesser General Public License
  242. as published by the Free Software Foundation; either version 2.1
  243. of the License, or (at your option) any later version.
  244. """, """\
  245. This library is free software; you can redistribute it and/or
  246. modify it under the terms of the GNU Lesser General Public License
  247. as published by the Free Software Foundation; either version 2.1
  248. of the License, or any later version.
  249. """
  250. ]
  251. ),
  252. (
  253. 'LGPL-2.1-only', [
  254. """\
  255. This program is free software; you can redistribute it and/or
  256. modify it under the terms of the GNU Lesser General Public License as
  257. published by the Free Software Foundation; version 2.1.
  258. """, """\
  259. This library is free software; you can redistribute it and/or
  260. modify it under the terms of the GNU Lesser General Public License as
  261. published by the Free Software Foundation; version 2.1.
  262. """
  263. ]
  264. ),
  265. (
  266. 'LGPL-3.0-or-later', [
  267. """\
  268. This program is free software; you can redistribute it and/or
  269. modify it under the terms of the GNU Lesser General Public License
  270. as published by the Free Software Foundation; either version 3
  271. of the License, or (at your option) any later version.
  272. """, """\
  273. This program is free software; you can redistribute it and/or
  274. modify it under the terms of the GNU Lesser General Public License
  275. as published by the Free Software Foundation; either version 3
  276. of the License, or any later version.
  277. """, """\
  278. This library is free software; you can redistribute it and/or
  279. modify it under the terms of the GNU Lesser General Public License
  280. as published by the Free Software Foundation; either version 3
  281. of the License, or (at your option) any later version.
  282. """, """\
  283. This library is free software; you can redistribute it and/or
  284. modify it under the terms of the GNU Lesser General Public License
  285. as published by the Free Software Foundation; either version 3
  286. of the License, or any later version.
  287. """
  288. ]
  289. ),
  290. (
  291. 'LGPL-3.0-only', [
  292. """\
  293. This program is free software; you can redistribute it and/or
  294. modify it under the terms of the GNU Lesser General Public License as
  295. published by the Free Software Foundation; version 3.
  296. """, """\
  297. This library is free software; you can redistribute it and/or
  298. modify it under the terms of the GNU Lesser General Public License as
  299. published by the Free Software Foundation; version 3.
  300. """
  301. ]
  302. ),
  303. ('Apache-2.0', ["""\
  304. Licensed under the Apache License, Version 2.0 (the "License");
  305. you may not use this file except in compliance with the License.
  306. """]),
  307. ]
  308. JOYSTICK_AXES = ['x', 'y', 'z', 'rx', 'ry', 'rz']