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:
parent
aa5a18f833
commit
257ffdb442
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user