1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #18019 from ML-PA-Consulting-GmbH/fix/20220427__drivers-mcp2515__set_bitrate

drivers/mcp2515: fix set bittiming
This commit is contained in:
benpicco 2022-05-02 16:05:51 +02:00 committed by GitHub
commit 95975988a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);