]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/lufa.mk
Merge remote-tracking branch 'tmk/master'
[max/tmk_keyboard.git] / tmk_core / protocol / lufa.mk
1 TMK_LUFA_DIR = protocol/lufa
2
3 # Path to the LUFA library
4 TMK_LUFA_PATH ?= $(TMK_LUFA_DIR)/lufa-abcminiuser
5
6
7 # Create the LUFA source path variables by including the LUFA makefile
8 ifneq (, $(wildcard $(TMK_DIR)/$(TMK_LUFA_PATH)/LUFA/Build/LUFA/lufa-sources.mk))
9         LUFA_PATH = $(TMK_LUFA_PATH)/LUFA
10         include $(TMK_DIR)/$(TMK_LUFA_PATH)/LUFA/Build/LUFA/lufa-sources.mk
11 else
12     $(error LUFA may be too old or not found: try 'git submodule update --init')
13 #    ifneq (, $(wildcard $(TMK_DIR)/$(TMK_LUFA_PATH)/LUFA/Build/lufa_sources.mk))
14 #        # build system from 20120730
15 #        LUFA_PATH = $(TMK_LUFA_PATH)
16 #        LUFA_ROOT_PATH = $(TMK_LUFA_PATH)/LUFA
17 #        include $(TMK_DIR)/$(TMK_LUFA_PATH)/LUFA/Build/lufa_sources.mk
18 #    else
19 #        include $(TMK_DIR)/$(TMK_LUFA_PATH)/LUFA/makefile
20 #    endif
21 endif
22
23 TMK_LUFA_SRC = $(TMK_LUFA_DIR)/lufa.c \
24                $(TMK_LUFA_DIR)/descriptor.c \
25                $(LUFA_SRC_USB_DEVICE)
26
27 SRC += $(TMK_LUFA_SRC)
28
29 # Search Path
30 VPATH += $(TMK_DIR)/$(TMK_LUFA_DIR)
31 VPATH += $(TMK_DIR)/$(TMK_LUFA_PATH)
32
33 # Option modules
34 #ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
35 #endif
36
37 #ifdef EXTRAKEY_ENABLE
38 #endif
39
40 # LUFA library compile-time options and predefined tokens
41 TMK_LUFA_OPTS  = -DUSB_DEVICE_ONLY
42 TMK_LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS
43 TMK_LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
44 # Do not enable this for converters in particular, it blocks other tasks long.
45 #TMK_LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
46 TMK_LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
47 TMK_LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
48 # Remote wakeup fix for ATmega32U2        https://github.com/tmk/tmk_keyboard/issues/361
49 ifeq ($(MCU),atmega32u2)
50         TMK_LUFA_OPTS += -DNO_LIMITED_CONTROLLER_CONNECT
51 endif
52
53 ifeq (yes,$(strip $(TMK_LUFA_DEBUG)))
54     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG
55 endif
56
57 ifeq (yes,$(strip $(TMK_LUFA_DEBUG_SUART)))
58     SRC += common/avr/suart.S
59     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG_SUART
60     # Keep print/debug lines when disabling HID console. See common.mk.
61     DEBUG_PRINT_AVAILABLE = yes
62 endif
63
64 ifeq (yes,$(strip $(TMK_LUFA_DEBUG_UART)))
65     SRC += common/avr/uart.c
66     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG_UART
67     # Keep print/debug lines when disabling HID console. See common.mk.
68     DEBUG_PRINT_AVAILABLE = yes
69 endif
70
71
72 OPT_DEFS += -DF_USB=$(F_USB)UL
73 OPT_DEFS += -DARCH=ARCH_$(ARCH)
74 OPT_DEFS += $(TMK_LUFA_OPTS)
75
76 # This indicates using LUFA stack
77 OPT_DEFS += -DPROTOCOL_LUFA