local_features.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. define HELIX_CUSTOMISE_MSG
  8. $(info Helix Spacific Build Options)
  9. $(info - OLED_ENABLE = $(OLED_ENABLE))
  10. $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
  11. $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
  12. $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
  13. $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
  14. $(info )
  15. endef
  16. ifneq ($(strip $(HELIX)),)
  17. ### Helix keyboard keymap: convenient command line option
  18. ## make HELIX=<options> helix:<keymap>
  19. ## option= oled | back | under | na | ios
  20. ## ex.
  21. ## make HELIX=oled helix:<keymap>
  22. ## make HELIX=oled,back helix:<keymap>
  23. ## make HELIX=oled,under helix:<keymap>
  24. ## make HELIX=oled,back,na helix:<keymap>
  25. ## make HELIX=oled,back,ios helix:<keymap>
  26. ##
  27. ifeq ($(findstring oled,$(HELIX)), oled)
  28. OLED_ENABLE = yes
  29. endif
  30. ifeq ($(findstring back,$(HELIX)), back)
  31. LED_BACK_ENABLE = yes
  32. else ifeq ($(findstring under,$(HELIX)), under)
  33. LED_UNDERGLOW_ENABLE = yes
  34. endif
  35. ifeq ($(findstring na,$(HELIX)), na)
  36. LED_ANIMATIONS = no
  37. endif
  38. ifeq ($(findstring no_ani,$(HELIX)), no_ani)
  39. LED_ANIMATIONS = no
  40. endif
  41. ifeq ($(findstring ios,$(HELIX)), ios)
  42. IOS_DEVICE_ENABLE = yes
  43. endif
  44. ifeq ($(findstring scan,$(HELIX)), scan)
  45. # use DEBUG_MATRIX_SCAN_RATE
  46. # see docs/newbs_testing_debugging.md
  47. OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
  48. CONSOLE_ENABLE = yes
  49. SHOW_VERBOSE_INFO = yes
  50. endif
  51. ifeq ($(findstring verbose,$(HELIX)), verbose)
  52. SHOW_VERBOSE_INFO = yes
  53. endif
  54. SHOW_HELIX_OPTIONS = yes
  55. endif
  56. ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
  57. SRC += local_drivers/serial.c
  58. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  59. # A workaround until #7089 is merged.
  60. # serial.c must not be compiled with the -lto option.
  61. # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
  62. LIB_SRC += local_drivers/serial.c
  63. CUSTOM_MATRIX = yes
  64. SRC += rev2/matrix.c
  65. SRC += rev2/split_util.c
  66. SRC += rev2/split_scomm.c
  67. endif
  68. ########
  69. # convert Helix-specific options (that represent combinations of standard options)
  70. # into QMK standard options.
  71. ifneq ($(strip $(HELIX_ROWS)), 4)
  72. ifneq ($(strip $(HELIX_ROWS)), 5)
  73. $(error HELIX_ROWS = $(strip $(HELIX_ROWS)) is unexpected value)
  74. endif
  75. endif
  76. OPT_DEFS += -DHELIX_ROWS=$(strip $(HELIX_ROWS))
  77. ifeq ($(strip $(LED_BACK_ENABLE)), yes)
  78. RGBLIGHT_ENABLE = yes
  79. OPT_DEFS += -DRGBLED_BACK
  80. ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  81. $(eval $(call HELIX_CUSTOMISE_MSG))
  82. $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes')
  83. endif
  84. else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
  85. RGBLIGHT_ENABLE = yes
  86. endif
  87. ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
  88. OPT_DEFS += -DIOS_DEVICE_ENABLE
  89. endif
  90. ifeq ($(strip $(LED_ANIMATIONS)), yes)
  91. OPT_DEFS += -DLED_ANIMATIONS
  92. endif
  93. ifeq ($(strip $(OLED_ENABLE)), yes)
  94. SRC += local_drivers/i2c.c
  95. SRC += local_drivers/ssd1306.c
  96. KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
  97. OPT_DEFS += -DOLED_ENABLE
  98. ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
  99. OPT_DEFS += -DLOCAL_GLCDFONT
  100. endif
  101. endif
  102. ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
  103. $(eval $(call HELIX_CUSTOMISE_MSG))
  104. ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
  105. $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
  106. $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE))
  107. $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE))
  108. $(info -- OPT_DEFS = $(OPT_DEFS))
  109. $(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE))
  110. $(info )
  111. endif
  112. endif