Skip to content
Permalink
Browse files

tests: drivers: can: stm32: determine CAN device at compile-time

Determine the CAN device (CAN_0 or CAN_1) at compile-time.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
  • Loading branch information...
henrikbrixandersen authored and MaureenHelm committed Jun 18, 2019
1 parent a361d7c commit 70c47cba043af1823ac7e45b8e0614e25863475a
Showing with 8 additions and 2 deletions.
  1. +8 −2 tests/drivers/can/stm32/src/main.c
@@ -33,7 +33,13 @@
* @}
*/


#if defined(DT_CAN_0_NAME)
#define CAN_NAME DT_CAN_0_NAME
#elif defined(DT_CAN_1_NAME)
#define CAN_NAME DT_CAN_1_NAME
#else
#error No CAN device available
#endif

#define TEST_SEND_TIMEOUT K_MSEC(100)
#define TEST_RECEIVE_TIMEOUT K_MSEC(100)
@@ -132,7 +138,7 @@ static void test_filter_handling(void)
int ret, filter_id_1, filter_id_2;
struct zcan_frame msg_buffer;

can_dev = device_get_binding(DT_CAN_1_NAME);
can_dev = device_get_binding(CAN_NAME);

ret = can_configure(can_dev, CAN_LOOPBACK_MODE, 0);

0 comments on commit 70c47cb

Please sign in to comment.
You can’t perform that action at this time.