1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/usb_minimal: Set PID/VID if Kconfig is not used

This commit is contained in:
Leandro Lanzieri 2019-12-05 15:42:21 +01:00
parent a1836d36a4
commit 84c3676e36

View File

@ -16,18 +16,29 @@ USEMODULE += usbus
USEMODULE += auto_init_usbus
# USB device vendor and product ID
DEFAULT_VID = 1209
DEFAULT_PID = 0001
export DEFAULT_VID = 1209
export DEFAULT_PID = 0001
USB_VID ?= $(DEFAULT_VID)
USB_PID ?= $(DEFAULT_PID)
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
include $(RIOTBASE)/Makefile.include
# Set USB VID/PID via CFLAGS if not being set via Kconfig
ifndef CONFIG_USB_VID
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID)
else
USB_VID = $(patsubst 0x%,%,$(CONFIG_USB_VID))
endif
ifndef CONFIG_USB_PID
CFLAGS += -DCONFIG_USB_PID=0x$(USB_PID)
else
USB_PID = $(patsubst 0x%,%,$(CONFIG_USB_PID))
endif
.PHONY: usb_id_check
usb_id_check:
@if [ $(USB_VID) = $(DEFAULT_VID) -o $(USB_PID) = $(DEFAULT_PID) ] ; then \