diff --git a/tests/candev/Makefile b/tests/candev/Makefile index f7b1d3adae..b96b30d0d0 100644 --- a/tests/candev/Makefile +++ b/tests/candev/Makefile @@ -1,11 +1,21 @@ include ../Makefile.tests_common +BOARD_WHITELIST := native USEMODULE += shell USEMODULE += can USEMODULE += isrpipe # define the CAN driver you want to use here -CAN_DRIVER ?= native +CAN_DRIVER ?= CAN_NATIVE + +# prevent using native driver on non-native board +ifeq ($(CAN_DRIVER), CAN_NATIVE) + ifneq ($(BOARD), native) + $(error native can driver can only be used on native board!) + endif +endif + + ifeq ($(CAN_DRIVER), PERIPH_CAN) # periph_can modules/variables go here @@ -15,6 +25,4 @@ else ifeq ($(CAN_DRIVER), CAN_NATIVE) endif -CFLAGS += -DCAN_DRIVER_$(CAN_DRIVER) - include $(RIOTBASE)/Makefile.include diff --git a/tests/candev/main.c b/tests/candev/main.c index b2a9421ea8..7e6e692507 100644 --- a/tests/candev/main.c +++ b/tests/candev/main.c @@ -30,7 +30,7 @@ #include "shell.h" #include "can/device.h" -#ifdef BOARD_NATIVE +#if IS_USED(MODULE_CAN_LINUX) #include @@ -192,7 +192,7 @@ int main(void) puts("candev test application\n"); isrpipe_init(&rxbuf, (uint8_t *)rx_ringbuf, sizeof(rx_ringbuf)); -#ifdef BOARD_NATIVE +#if IS_USED(MODULE_CAN_LINUX) puts("Initializing Linux Can device"); candev_linux_init( &linux_dev, &(candev_linux_conf[0])); /* vcan0 */ candev = (candev_t *)&linux_dev;