mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/candev: adapt to use periph_can
This makes tests/candev use periph_can by default instead of old native specific driver.
This commit is contained in:
parent
b4f29035ce
commit
e2fa5bcb7c
@ -1,20 +1,16 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
# the test currently only works with can_linux, so on "native"
|
||||
BOARD_WHITELIST := native
|
||||
|
||||
USEMODULE += shell
|
||||
USEMODULE += can
|
||||
USEMODULE += isrpipe
|
||||
|
||||
FEATURES_OPTIONAL += periph_can
|
||||
|
||||
# define the CAN driver you want to use here
|
||||
CAN_DRIVER ?= CAN_NATIVE
|
||||
CAN_DRIVER ?= CAN_EXT
|
||||
|
||||
ifeq ($(CAN_DRIVER), PERIPH_CAN)
|
||||
# periph_can modules/variables go here
|
||||
|
||||
else ifeq ($(CAN_DRIVER), CAN_NATIVE)
|
||||
# can_native modules/variables go here
|
||||
ifeq ($(CAN_DRIVER), CAN_EXT)
|
||||
# external CAN driver modules/variables go here
|
||||
|
||||
endif
|
||||
|
||||
|
@ -30,11 +30,12 @@
|
||||
#include "shell.h"
|
||||
#include "can/device.h"
|
||||
|
||||
#if IS_USED(MODULE_CAN_LINUX)
|
||||
#if IS_USED(MODULE_PERIPH_CAN)
|
||||
|
||||
#include <candev_linux.h>
|
||||
#include "periph/can.h"
|
||||
#include "can_params.h"
|
||||
|
||||
static can_t linux_dev;
|
||||
static can_t periph_dev;
|
||||
|
||||
#else
|
||||
/* add other candev drivers here */
|
||||
@ -192,10 +193,10 @@ int main(void)
|
||||
puts("candev test application\n");
|
||||
|
||||
isrpipe_init(&rxbuf, (uint8_t *)rx_ringbuf, sizeof(rx_ringbuf));
|
||||
#if IS_USED(MODULE_CAN_LINUX)
|
||||
puts("Initializing Linux Can device");
|
||||
can_init( &linux_dev, &(candev_conf[0])); /* vcan0 */
|
||||
candev = (candev_t *)&linux_dev;
|
||||
#if IS_USED(MODULE_PERIPH_CAN)
|
||||
puts("Initializing CAN periph device");
|
||||
can_init(&periph_dev, &(candev_conf[0])); /* vcan0 on native */
|
||||
candev = (candev_t *)&periph_dev;
|
||||
#else
|
||||
/* add initialization for other candev drivers here */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user