Skip to content

Commit e5cede3

Browse files
Shaoyuhardbyte
authored andcommitted
add canalysstii documentation
1 parent 8dbbf65 commit e5cede3

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

can/interfaces/canalystii.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ class VCI_CAN_OBJ(Structure):
4646

4747
class CANalystIIBus(BusABC):
4848
def __init__(self, channel, device=0, baud=10000000, Timing0=0x00, Timing1=0x14, can_filters=None):
49+
"""
50+
51+
:param channel: channel number
52+
:param device: device number
53+
:param baud: baud rate
54+
:param Timing0: customize the timing register if baudrate is not specified
55+
:param Timing1:
56+
:param can_filters: filters for packet
57+
"""
4958
super(CANalystIIBus, self).__init__(channel, can_filters)
5059

5160
if isinstance(channel, (list, tuple)):
@@ -58,6 +67,8 @@ def __init__(self, channel, device=0, baud=10000000, Timing0=0x00, Timing1=0x14,
5867

5968
self.device = device
6069

70+
self.channel_info = "CANalyst-II: device {}, channels {}".format(self.device, self.channels)
71+
6172
if baud == 1000000:
6273
Timing0, Timing1 = (0x00, 0x14)
6374
elif baud == 800000:
@@ -149,5 +160,9 @@ def _recv_internal(self, timeout=None):
149160
False,
150161
)
151162

163+
def flush_tx_buffer(self):
164+
for channel in self.channels:
165+
CANalystII.VCI_ClearBUffer(VCI_USBCAN2, self.device, channel)
166+
152167
def shutdown(self):
153168
CANalystII.VCI_CloseDevice(VCI_USBCAN2, self.device)

doc/interfaces.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The available interfaces are:
2323
interfaces/neovi
2424
interfaces/vector
2525
interfaces/virtual
26+
interfaces/canalystii
2627

2728
Additional interfaces can be added via a plugin interface. An external package
2829
can register a new interface by using the ``can.interface`` entry point in its setup.py.

doc/interfaces/canalystii.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CANalyst-II
2+
===========
3+
4+
CANalyst-II(+) is a USB to CAN Analyzer. The controlcan library is originally developed by `ZLG ZHIYUAN Electronics`_.
5+
6+
7+
Bus
8+
---
9+
10+
.. autoclass:: can.interfaces.canalystii.CANalystIIBus
11+
12+
13+
.. _ZLG ZHIYUAN Electronics: http://www.zlg.com/can/can/product/id/42.html

0 commit comments

Comments
 (0)