File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
tests/drivers/can/api/src Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1515 * @}
1616 */
1717
18+ /**
19+ * Test bitrate in bits/second.
20+ */
21+ #define TEST_BITRATE 125000
22+
1823/**
1924 * @brief Test timeouts.
2025 */
@@ -634,6 +639,17 @@ static void test_set_bitrate_too_high(void)
634639 zassert_equal (err , - ENOTSUP , "too high bitrate accepted" );
635640}
636641
642+ /**
643+ * @brief Test setting bitrate.
644+ */
645+ static void test_set_bitrate (void )
646+ {
647+ int err ;
648+
649+ err = can_set_bitrate (can_dev , TEST_BITRATE , 0 );
650+ zassert_equal (err , 0 , "failed to set bitrate" );
651+ }
652+
637653/**
638654 * @brief Test configuring the CAN controller for loopback mode.
639655 *
@@ -903,6 +919,7 @@ void test_main(void)
903919 ztest_user_unit_test (test_get_core_clock ),
904920 ztest_unit_test (test_set_state_change_callback ),
905921 ztest_user_unit_test (test_set_bitrate_too_high ),
922+ ztest_user_unit_test (test_set_bitrate ),
906923 ztest_user_unit_test (test_set_loopback ),
907924 ztest_user_unit_test (test_send_and_forget ),
908925 ztest_unit_test (test_add_filter ),
You can’t perform that action at this time.
0 commit comments