]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/lufa.mk
ibmpc: Add timeout check
[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 #TMK_LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
45 TMK_LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
46 TMK_LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
47 # Remote wakeup fix for ATmega32U2        https://github.com/tmk/tmk_keyboard/issues/361
48 ifeq ($(MCU),atmega32u2)
49         TMK_LUFA_OPTS += -DNO_LIMITED_CONTROLLER_CONNECT
50 endif
51
52 ifeq (yes,$(strip $(TMK_LUFA_DEBUG)))
53     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG
54 endif
55
56 ifeq (yes,$(strip $(TMK_LUFA_DEBUG_SUART)))
57     SRC += common/avr/suart.S
58     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG_SUART
59     # Keep print/debug lines when disabling HID console. See common.mk.
60     DEBUG_PRINT_AVAILABLE = yes
61 endif
62
63 ifeq (yes,$(strip $(TMK_LUFA_DEBUG_UART)))
64     SRC += common/avr/uart.c
65     TMK_LUFA_OPTS += -DTMK_LUFA_DEBUG_UART
66     # Keep print/debug lines when disabling HID console. See common.mk.
67     DEBUG_PRINT_AVAILABLE = yes
68 endif
69
70
71 OPT_DEFS += -DF_USB=$(F_USB)UL
72 OPT_DEFS += -DARCH=ARCH_$(ARCH)
73 OPT_DEFS += $(TMK_LUFA_OPTS)
74
75 # This indicates using LUFA stack
76 OPT_DEFS += -DPROTOCOL_LUFA