Skip to content

Commit eadfa83

Browse files
committed
Implement CanProtocol for NeoViBus
1 parent 41b1979 commit eadfa83

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

can/interfaces/ics_neovi/neovi_bus.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from threading import Event
1717
from warnings import warn
1818

19-
from can import Message, BusABC
19+
from can import Message, BusABC, CanProtocol
2020
from ...exceptions import (
2121
CanError,
2222
CanTimeoutError,
@@ -169,7 +169,14 @@ def __init__(self, channel, can_filters=None, **kwargs):
169169
if ics is None:
170170
raise ImportError("Please install python-ics")
171171

172-
super().__init__(channel=channel, can_filters=can_filters, **kwargs)
172+
is_fd = kwargs.get("fd", False)
173+
174+
super().__init__(
175+
channel=channel,
176+
can_filters=can_filters,
177+
protocol=CanProtocol.CAN_FD if is_fd else CanProtocol.CAN_20,
178+
**kwargs,
179+
)
173180

174181
logger.info(f"CAN Filters: {can_filters}")
175182
logger.info(f"Got configuration of: {kwargs}")
@@ -198,7 +205,7 @@ def __init__(self, channel, can_filters=None, **kwargs):
198205
for channel in self.channels:
199206
ics.set_bit_rate(self.dev, kwargs.get("bitrate"), channel)
200207

201-
if kwargs.get("fd", False):
208+
if is_fd:
202209
if "data_bitrate" in kwargs:
203210
for channel in self.channels:
204211
ics.set_fd_bit_rate(

0 commit comments

Comments
 (0)