lufa.mk 1.7 KB

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