tests: drivers: can: timing: test that calculated timings can be set
Test that each calculated set of timing values can be set. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
35a78fd034
commit
578454b78d
1 changed files with 11 additions and 0 deletions
|
@ -193,6 +193,17 @@ static void test_timing_values(const struct device *dev, const struct can_timing
|
|||
assert_timing_within_bounds(&timing, min, max);
|
||||
assert_sp_within_margin(&timing, test->sp, SAMPLE_POINT_MARGIN);
|
||||
|
||||
if (IS_ENABLED(CONFIG_CAN_FD_MODE)) {
|
||||
if (data_phase) {
|
||||
err = can_set_timing(dev, can_get_timing_min(dev), &timing);
|
||||
} else {
|
||||
err = can_set_timing(dev, &timing, can_get_timing_min_data(dev));
|
||||
}
|
||||
} else {
|
||||
err = can_set_timing(dev, &timing, NULL);
|
||||
}
|
||||
zassert_equal(err, 0, "failed to set timing (err %d)", err);
|
||||
|
||||
printk("OK, sample point error %d.%d%%\n", err / 10, err % 10);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue