lufa.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 $(ADAFRUIT_BLE_ENABLE)), yes)
  19. LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp
  20. endif
  21. ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
  22. LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
  23. $(TMK_DIR)/protocol/serial_uart.c
  24. endif
  25. ifeq ($(strip $(VIRTSER_ENABLE)), yes)
  26. LUFA_SRC += $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c
  27. endif
  28. SRC += $(LUFA_SRC)
  29. # Search Path
  30. VPATH += $(TMK_PATH)/$(LUFA_DIR)
  31. VPATH += $(TMK_PATH)/$(LUFA_PATH)
  32. # Option modules
  33. #ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
  34. #endif
  35. #ifdef EXTRAKEY_ENABLE
  36. #endif
  37. # LUFA library compile-time options and predefined tokens
  38. LUFA_OPTS = -DUSB_DEVICE_ONLY
  39. LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS
  40. LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
  41. #LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
  42. LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
  43. LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
  44. # Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361
  45. ifeq ($(MCU),atmega32u2)
  46. LUFA_OPTS += -DNO_LIMITED_CONTROLLER_CONNECT
  47. endif
  48. OPT_DEFS += -DF_USB=$(F_USB)UL
  49. OPT_DEFS += -DARCH=ARCH_$(ARCH)
  50. OPT_DEFS += $(LUFA_OPTS)
  51. # This indicates using LUFA stack
  52. OPT_DEFS += -DPROTOCOL_LUFA