Skip to content

Commit

Permalink
tests: drivers: can: stm32: determine CAN device at compile-time
Browse files Browse the repository at this point in the history
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 24, 2019
1 parent a361d7c commit 70c47cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/drivers/can/stm32/src/main.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 70c47cb

Please sign in to comment.