Skip to content

Commit 40f6cce

Browse files
authored
extend XL api wrapper (hardbyte#1387)
1 parent ad8b948 commit 40f6cce

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

can/interfaces/vector/xlclass.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class s_xl_chip_state(ctypes.Structure):
4545
]
4646

4747

48+
class s_xl_sync_pulse(ctypes.Structure):
49+
_fields_ = [
50+
("pulseCode", ctypes.c_ubyte),
51+
("time", XLuint64),
52+
]
53+
54+
4855
class s_xl_can_ev_chip_state(ctypes.Structure):
4956
_fields_ = [
5057
("busStatus", ctypes.c_ubyte),
@@ -65,7 +72,11 @@ class s_xl_can_ev_sync_pulse(ctypes.Structure):
6572

6673
# BASIC bus message structure
6774
class s_xl_tag_data(ctypes.Union):
68-
_fields_ = [("msg", s_xl_can_msg), ("chipState", s_xl_chip_state)]
75+
_fields_ = [
76+
("msg", s_xl_can_msg),
77+
("chipState", s_xl_chip_state),
78+
("syncPulse", s_xl_sync_pulse),
79+
]
6980

7081

7182
# CAN FD messages

can/interfaces/vector/xldefine.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class XL_BusTypes(IntFlag):
6464
XL_BUS_TYPE_A429 = 8192 # =0x00002000
6565

6666

67-
class XL_CANFD_BusParams_CanOpMode(IntEnum):
67+
class XL_CANFD_BusParams_CanOpMode(IntFlag):
6868
XL_BUS_PARAMS_CANOPMODE_CAN20 = 1
6969
XL_BUS_PARAMS_CANOPMODE_CANFD = 2
7070
XL_BUS_PARAMS_CANOPMODE_CANFD_NO_ISO = 8
@@ -318,3 +318,9 @@ class XL_HardwareType(IntEnum):
318318
XL_HWTYPE_VX1161A = 114
319319
XL_HWTYPE_VX1161B = 115
320320
XL_MAX_HWTYPE = 120
321+
322+
323+
class XL_SyncPulseSource(IntEnum):
324+
XL_SYNC_PULSE_EXTERNAL = 0
325+
XL_SYNC_PULSE_OUR = 1
326+
XL_SYNC_PULSE_OUR_SHARED = 2

can/interfaces/vector/xldriver.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,18 @@ def check_status_initialization(result, function, arguments):
272272
xlCanGetEventString = _xlapi_dll.xlCanGetEventString
273273
xlCanGetEventString.argtypes = [ctypes.POINTER(xlclass.XLcanRxEvent)]
274274
xlCanGetEventString.restype = xlclass.XLstringType
275+
276+
xlGetReceiveQueueLevel = _xlapi_dll.xlGetReceiveQueueLevel
277+
xlGetReceiveQueueLevel.argtypes = [xlclass.XLportHandle, ctypes.POINTER(ctypes.c_int)]
278+
xlGetReceiveQueueLevel.restype = xlclass.XLstatus
279+
xlGetReceiveQueueLevel.errcheck = check_status_operation
280+
281+
xlGenerateSyncPulse = _xlapi_dll.xlGenerateSyncPulse
282+
xlGenerateSyncPulse.argtypes = [xlclass.XLportHandle, xlclass.XLaccess]
283+
xlGenerateSyncPulse.restype = xlclass.XLstatus
284+
xlGenerateSyncPulse.errcheck = check_status_operation
285+
286+
xlFlushReceiveQueue = _xlapi_dll.xlFlushReceiveQueue
287+
xlFlushReceiveQueue.argtypes = [xlclass.XLportHandle]
288+
xlFlushReceiveQueue.restype = xlclass.XLstatus
289+
xlFlushReceiveQueue.errcheck = check_status_operation

0 commit comments

Comments
 (0)