local_features.mk 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #
  2. # local_features.mk contains post-processing rules for the Helix keyboard.
  3. #
  4. # Post-processing rules convert keyboard-specific shortcuts (that represent
  5. # combinations of standard options) into QMK standard options.
  6. #
  7. KEYBOARD_LOCAL_FEATURES_MK :=
  8. define HELIX_CUSTOMISE_MSG
  9. $(info Helix Spacific Build Options)
  10. $(info - OLED_ENABLE = $(OLED_ENABLE))
  11. $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
  12. $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
  13. $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
  14. $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
  15. $(info )
  16. endef
  17. define HELIX_HELP_MSG
  18. $(info Helix keyboard convenient command line option)
  19. $(info - make HELIX=<options> helix/pico:<keymap>)
  20. $(info - option= oled | back | under | na | no-ani)
  21. $(info - ios | sc | split-common | scan | verbose)
  22. $(info - ex.)
  23. $(info - make HELIX=oled helix/pico:<keymap>)
  24. $(info - make HELIX=back helix/pico:<keymap>)
  25. $(info - make HELIX=under helix/pico:<keymap>)
  26. $(info - make HELIX=back,na helix/pico:<keymap>)
  27. $(info - make HELIX=back,ios helix/pico:<keymap>)
  28. $(info )
  29. endef
  30. ifneq ($(strip $(HELIX)),)
  31. COMMA=,
  32. helix_option := $(subst $(COMMA), , $(HELIX))
  33. ifneq ($(filter help,$(helix_option)),)
  34. $(eval $(call HELIX_HELP_MSG))
  35. $(error )
  36. endif
  37. ifneq ($(filter oled,$(helix_option)),)
  38. OLED_ENABLE = yes
  39. endif
  40. ifneq ($(filter back,$(helix_option)),)
  41. LED_BACK_ENABLE = yes
  42. else ifneq ($(filter under,$(helix_option)),)
  43. LED_UNDERGLOW_ENABLE = yes
  44. endif
  45. ifneq ($(filter na,$(helix_option)),)
  46. LED_ANIMATIONS = no
  47. endif
  48. ifneq ($(filter no_ani,$(helix_option)),)
  49. LED_ANIMATIONS = no
  50. endif
  51. ifneq ($(filter no-ani,$(helix_option)),)
  52. LED_ANIMATIONS = no
  53. endif
  54. ifneq ($(filter ios,$(helix_option)),)
  55. IOS_DEVICE_ENABLE = yes
  56. endif
  57. ifneq ($(filter sc,$(helix_option)),)
  58. SPLIT_KEYBOARD = yes
  59. endif
  60. ifneq ($(filter split-common,$(helix_option)),)
  61. SPLIT_KEYBOARD = yes
  62. endif
  63. ifneq ($(filter scan,$(helix_option)),)
  64. # use DEBUG_MATRIX_SCAN_RATE
  65. # see docs/newbs_testing_debugging.md
  66. OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
  67. CONSOLE_ENABLE = yes
  68. SHOW_VERBOSE_INFO = yes
  69. endif
  70. ifneq ($(filter verbose,$(helix_option)),)
  71. SHOW_VERBOSE_INFO = yes
  72. endif
  73. SHOW_HELIX_OPTIONS = yes
  74. endif
  75. ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
  76. SRC += local_drivers/serial.c
  77. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  78. # A workaround until #7089 is merged.
  79. # serial.c must not be compiled with the -lto option.
  80. # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
  81. LIB_SRC += local_drivers/serial.c
  82. CUSTOM_MATRIX = yes
  83. SRC += pico/matrix.c
  84. SRC += pico/split_util.c
  85. endif
  86. ########
  87. # convert Helix-specific options (that represent combinations of standard options)
  88. # into QMK standard options.
  89. ifeq ($(strip $(LED_BACK_ENABLE)), yes)
  90. RGBLIGHT_ENABLE = yes
  91. OPT_DEFS += -DRGBLED_BACK
  92. ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  93. $(eval $(call HELIX_CUSTOMISE_MSG))
  94. $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes')
  95. endif
  96. else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  97. RGBLIGHT_ENABLE = yes
  98. endif
  99. ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
  100. OPT_DEFS += -DIOS_DEVICE_ENABLE
  101. endif
  102. ifeq ($(strip $(LED_ANIMATIONS)), yes)
  103. OPT_DEFS += -DLED_ANIMATIONS
  104. endif
  105. ifeq ($(strip $(OLED_ENABLE)), yes)
  106. SRC += local_drivers/i2c.c
  107. SRC += local_drivers/ssd1306.c
  108. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  109. OPT_DEFS += -DOLED_ENABLE
  110. ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
  111. OPT_DEFS += -DLOCAL_GLCDFONT
  112. endif
  113. endif
  114. ifeq ($(strip $(AUDIO_ENABLE)),yes)
  115. ifeq ($(strip $(RGBLIGHT_ENABLE)),yes)
  116. LTO_ENABLE = yes
  117. endif
  118. ifeq ($(strip $(OLED_ENABLE)),yes)
  119. LTO_ENABLE = yes
  120. endif
  121. endif
  122. ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
  123. $(eval $(call HELIX_CUSTOMISE_MSG))
  124. ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
  125. $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
  126. $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE))
  127. $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE))
  128. $(info -- OPT_DEFS = $(OPT_DEFS))
  129. $(info -- SPLIT_KEYBOARD = $(SPLIT_KEYBOARD))
  130. $(info -- LTO_ENABLE = $(LTO_ENABLE))
  131. $(info )
  132. endif
  133. endif