constants.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. # The root of the qmk_firmware tree.
  7. QMK_FIRMWARE = Path.cwd()
  8. # Upstream repo url
  9. QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
  10. # This is the number of directories under `qmk_firmware/keyboards` that will be traversed. This is currently a limitation of our make system.
  11. MAX_KEYBOARD_SUBFOLDERS = 5
  12. # Supported processor types
  13. CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66F18', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443'
  14. LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
  15. VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
  16. # Common format strings
  17. DATE_FORMAT = '%Y-%m-%d'
  18. DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
  19. TIME_FORMAT = '%H:%M:%S'
  20. # Used when generating matrix locations
  21. COL_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijilmnopqrstuvwxyz'
  22. ROW_LETTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop'
  23. # Mapping between info.json and config.h keys
  24. LED_INDICATORS = {
  25. 'caps_lock': 'LED_CAPS_LOCK_PIN',
  26. 'num_lock': 'LED_NUM_LOCK_PIN',
  27. 'scroll_lock': 'LED_SCROLL_LOCK_PIN',
  28. }
  29. # Constants that should match their counterparts in make
  30. BUILD_DIR = environ.get('BUILD_DIR', '.build')
  31. KEYBOARD_OUTPUT_PREFIX = f'{BUILD_DIR}/obj_'
  32. # Headers for generated files
  33. this_year = date.today().year
  34. GPL2_HEADER_C_LIKE = f'''\
  35. /* Copyright {this_year} QMK
  36. *
  37. * This program is free software: you can redistribute it and/or modify
  38. * it under the terms of the GNU General Public License as published by
  39. * the Free Software Foundation, either version 2 of the License, or
  40. * (at your option) any later version.
  41. *
  42. * This program is distributed in the hope that it will be useful,
  43. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  44. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  45. * GNU General Public License for more details.
  46. *
  47. * You should have received a copy of the GNU General Public License
  48. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  49. */
  50. '''
  51. GPL2_HEADER_SH_LIKE = f'''\
  52. # Copyright {this_year} QMK
  53. #
  54. # This program is free software: you can redistribute it and/or modify
  55. # it under the terms of the GNU General Public License as published by
  56. # the Free Software Foundation, either version 2 of the License, or
  57. # (at your option) any later version.
  58. #
  59. # This program is distributed in the hope that it will be useful,
  60. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  61. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  62. # GNU General Public License for more details.
  63. #
  64. # You should have received a copy of the GNU General Public License
  65. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  66. '''
  67. GENERATED_HEADER_C_LIKE = '''\
  68. /*******************************************************************************
  69. 88888888888 888 d8b .d888 d8b 888 d8b
  70. 888 888 Y8P d88P" Y8P 888 Y8P
  71. 888 888 888 888
  72. 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
  73. 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
  74. 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
  75. 888 888 888 888 X88 888 888 888 Y8b. 888 X88
  76. 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
  77. 888 888
  78. 888 888
  79. 888 888
  80. .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
  81. d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
  82. 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
  83. Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
  84. "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
  85. 888
  86. Y8b d88P
  87. "Y88P"
  88. *******************************************************************************/
  89. '''
  90. GENERATED_HEADER_SH_LIKE = '''\
  91. ################################################################################
  92. #
  93. # 88888888888 888 d8b .d888 d8b 888 d8b
  94. # 888 888 Y8P d88P" Y8P 888 Y8P
  95. # 888 888 888 888
  96. # 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b
  97. # 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K
  98. # 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b.
  99. # 888 888 888 888 X88 888 888 888 Y8b. 888 X88
  100. # 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P'
  101. #
  102. # 888 888
  103. # 888 888
  104. # 888 888
  105. # .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888
  106. # d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888
  107. # 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888
  108. # Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888
  109. # "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888
  110. # 888
  111. # Y8b d88P
  112. # "Y88P"
  113. #
  114. ################################################################################
  115. '''