1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mcp2515: fix set bittiming

- apply hardware dependent parameters to bittiming struct before
  reinitializing the hardware with the new parameter set
This commit is contained in:
Daniel Lockau 2022-04-27 08:25:50 +02:00
parent aa5a18f833
commit 257ffdb442

View File

@ -305,6 +305,11 @@ static int _set(candev_t *candev, canopt_t opt, void *value, size_t value_len)
}
else {
memcpy(&candev->bittiming, value, sizeof(candev->bittiming));
if (can_device_calc_bittiming(dev->conf->clk / 2 /* f_quantum = f_osc / 2 */,
&bittiming_const, &candev->bittiming) < 0) {
DEBUG_PUTS("set0_Failed to calculate bittiming");
return -ERANGE;
}
res = _init(candev);
if (res == 0) {
res = sizeof(candev->bittiming);