lufa.mk 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. LUFA_DIR = protocol/lufa
  2. # Path to the LUFA library
  3. LUFA_PATH = $(LIB_PATH)/lufa
  4. # Create the LUFA source path variables by including the LUFA makefile
  5. ifneq (, $(wildcard $(LUFA_PATH)/LUFA/Build/lufa_sources.mk))
  6. # New build system from 20120730
  7. LUFA_ROOT_PATH = $(LUFA_PATH)/LUFA
  8. DMBS_LUFA_PATH = $(LUFA_PATH)/LUFA/Build/LUFA
  9. include $(LUFA_PATH)/LUFA/Build/lufa_sources.mk
  10. else
  11. include $(LUFA_PATH)/LUFA/makefile
  12. endif
  13. LUFA_SRC = lufa.c \
  14. usb_descriptor.c \
  15. outputselect.c \
  16. $(LUFA_SRC_USB)
  17. ifeq ($(strip $(MIDI_ENABLE)), yes)
  18. include $(TMK_PATH)/protocol/midi.mk
  19. endif
  20. ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
  21. LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
  22. $(TMK_DIR)/protocol/serial_uart.c
  23. endif
  24. ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
  25. LUFA_SRC += spi_master.c
  26. LUFA_SRC += analog.c
  27. LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp
  28. endif
  29. ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
  30. LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
  31. $(TMK_DIR)/protocol/serial_uart.c
  32. endif
  33. ifeq ($(strip $(BLUETOOTH)), RN42)
  34. LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
  35. $(TMK_DIR)/protocol/serial_uart.c
  36. endif
  37. ifeq ($(strip $(VIRTSER_ENABLE)), yes)
  38. LUFA_SRC += $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c
  39. endif
  40. SRC += $(LUFA_SRC)
  41. # Search Path
  42. VPATH += $(TMK_PATH)/$(LUFA_DIR)
  43. VPATH += $(LUFA_PATH)
  44. VPATH += $(DRIVER_PATH)/avr
  45. # Option modules
  46. #ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
  47. #endif
  48. #ifdef EXTRAKEY_ENABLE
  49. #endif
  50. # LUFA library compile-time options and predefined tokens
  51. LUFA_OPTS = -DUSB_DEVICE_ONLY
  52. LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS
  53. LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
  54. #LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
  55. LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
  56. LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
  57. LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
  58. # Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361
  59. ifeq ($(MCU),atmega32u2)
  60. LUFA_OPTS += -DNO_LIMITED_CONTROLLER_CONNECT
  61. endif
  62. OPT_DEFS += -DF_USB=$(F_USB)UL
  63. OPT_DEFS += -DARCH=ARCH_$(ARCH)
  64. OPT_DEFS += $(LUFA_OPTS)
  65. # This indicates using LUFA stack
  66. OPT_DEFS += -DPROTOCOL_LUFA