zlgcan 0.1.17__cp38-cp38-win32.whl → 0.2.0__cp38-cp38-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
zlgcan/zlgcan.py CHANGED
@@ -131,6 +131,7 @@ class ZCanBus(can.BusABC):
131
131
 
132
132
  def __init__(self,
133
133
  channel: Union[int, Sequence[int], str] = None, *,
134
+ libpath: str = "library/",
134
135
  device_type: int,
135
136
  device_index: int = 0,
136
137
  derive: ZDeriveInfoPy = None,
@@ -142,6 +143,7 @@ class ZCanBus(can.BusABC):
142
143
  Constructor
143
144
 
144
145
  :param channel: Not used(from super).
146
+ :param libpath: The library root path.
145
147
  :param device_type: The device type that your device belongs, see `ZCANDeviceType`.
146
148
  :param device_index: The device index.
147
149
  :param derive: The deriver info for specifying the channels and canfd supported if your device is not official.
@@ -180,7 +182,7 @@ class ZCanBus(can.BusABC):
180
182
  cfg_list.append(_cfg)
181
183
  self.channels.append(idx)
182
184
 
183
- self.device = zlgcan_init_can(device_type, device_index, cfg_list, derive)
185
+ self.device = zlgcan_init_can(libpath, device_type, device_index, cfg_list, derive)
184
186
 
185
187
  self.dev_info = zlgcan_device_info(self.device)
186
188
  if self.dev_info is not None:
@@ -235,7 +237,9 @@ class ZCanBus(can.BusABC):
235
237
 
236
238
 
237
239
  if __name__ == '__main__':
238
- with ZCanBus(interface="zlgcan", device_type=ZCANDeviceType.ZCAN_USBCANFD_200U,
240
+ with ZCanBus(interface="zlgcan",
241
+ libpath="../../../RustProjects/rust-can/zlgcan/library",
242
+ device_type=ZCANDeviceType.ZCAN_USBCANFD_200U,
239
243
  configs=[{'bitrate': 500000, 'dbitrate': 1_000_000, 'resistance': 1}]) as bus:
240
244
  # bus.send(can.Message(
241
245
  # arbitration_id=0x7DF,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zlgcan
3
- Version: 0.1.17
3
+ Version: 0.2.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -23,39 +23,26 @@ Project-URL: repository, https://github.com/zhuyu4839/zlgcan-driver
23
23
  * 确保安装相关驱动(USBCAN-I/II驱动得额外安装)
24
24
  * 确保安装相[VC++运行环境](https://manual.zlg.cn/web/#/152?page_id=5332)
25
25
  * 下载[library](https://github.com/zhuyu4839/rust-can/tree/master/zlgcan/library)文件夹(里面包含[bitrate.cfg.yaml](https://github.com/zhuyu4839/rust-can/tree/master/zlgcan/library/bitrate.cfg.yaml))
26
- * 在当前工程目录下(相对运行脚本)新建一个`zcan.env`文件, 中间配置`ZCAN_LIBRARY`环境变量(相对路径/绝对路径),否则使用默认(相对运行脚本)路径:
27
- * 默认(相对运行脚本)路径文件夹内容示例:
26
+ * 库文件示例:
28
27
  ```shell
29
- ├─main.py
30
- ├─library
31
- ├──linux
32
- │ │ └─x86_64
33
- │ └─windows
34
- │ ├─x86
35
- │ └─x86_64
36
- └─ bitrate.cfg.yaml
37
- ```
38
- * (相对运行脚本)`zcan.env`文件指定`library`示例:
39
- ```shell
40
- ├─main.py
41
- ├─zcan.env
42
- └─library
43
- ├─linux
44
- │ └─x86_64
45
- ├─windows
46
- │ ├─x86
28
+ library
29
+ ├──bitrate.cfg.yaml
30
+ ├──linux
47
31
  │ └─x86_64
48
- └─ bitrate.cfg.yaml
32
+ └─windows
33
+ ├─x86
34
+ └─x86_64
35
+ ```
36
+ * 在初始化can.Bus的时候指定zlgcan库路径(从0.2.0开始移除`zcan.env`配置), 默认为相对工程运行文件同级目录下`library`
37
+ ```python
38
+ libpath=r"C:\your\library\path"
49
39
  ```
50
- * 以下为`zcan.env`文件内容示例
51
- ```shell
52
- ZCAN_LIBRARY="C:/your_library_path"
53
- ```
54
40
 
55
- 2. 安装zlgcan-driver-py(不建议使用低于0.1.10版本)
41
+ 2. 安装zlgcan(不建议使用低于0.2.0版本)
56
42
 
57
43
  ```shell
58
- pip install zlgcan >= 0.1.10
44
+ pip install zlgcan >= 0.2.0
45
+ ```
59
46
 
60
47
  3. 使用:
61
48
  ```python
@@ -63,6 +50,7 @@ Project-URL: repository, https://github.com/zhuyu4839/zlgcan-driver
63
50
  from zlgcan.zlgcan import ZCanTxMode, ZCANDeviceType
64
51
 
65
52
  with can.Bus(interface="zlgcan", device_type=ZCANDeviceType.ZCAN_USBCANFD_200U,
53
+ libpath="library/",
66
54
  configs=[{'bitrate': 500000, 'resistance': 1}, {'bitrate': 500000, 'resistance': 1}]) as bus:
67
55
  bus.send(can.Message(
68
56
  arbitration_id=0x123,
@@ -75,6 +63,7 @@ Project-URL: repository, https://github.com/zhuyu4839/zlgcan-driver
75
63
  # time.sleep(0.1)
76
64
  _msg = bus.recv()
77
65
  print(_msg)
66
+ ```
78
67
 
79
68
  4. CAN测试列表:
80
69
  * USBCAN-I-mini - ZCAN_USBCAN1, ZCAN_USBCAN2
@@ -0,0 +1,9 @@
1
+ zlgcan-0.2.0.dist-info/METADATA,sha256=_qFeUR5r2G38Qs5SvkvgoMCfW8H9AXmmuiugarpNHds,3827
2
+ zlgcan-0.2.0.dist-info/WHEEL,sha256=I0oh3Vvc4dQIPlo9T2OQSgeCvmDsIw855l8Cuc55nN8,90
3
+ zlgcan-0.2.0.dist-info/entry_points.txt,sha256=1BprfQnq7A25SfDsPk1ZbOgMv_SmYEUWc7Xz-oAf-V4,45
4
+ zlgcan-0.2.0.dist-info/licenses/LICENSE.txt,sha256=6n0EnHcF3BOvwgLdGOGCfzSE-CEv0_p7gvxKDDY0Msk,7816
5
+ zlgcan/__init__.py,sha256=uspwQytd3RGSaVs6LQADIa9MS_qvzySlfL2S9OhFBQA,21
6
+ zlgcan/zlgcan.py,sha256=mllOSEBmxG1hvpdfajCdKd-UTdgu5dgML0qSsYN4ph0,8837
7
+ zlgcan_driver/__init__.py,sha256=JBAj4WkBypBiHIJqXHIJTNHF4kpmhRmKqY48oDAmY3E,135
8
+ zlgcan_driver/zlgcan_driver.cp38-win32.pyd,sha256=fNz3_3p4Eanb5N31N7bl8HV1W2YFs4AdLRkM_3dXb-c,621056
9
+ zlgcan-0.2.0.dist-info/RECORD,,
Binary file
@@ -1,9 +0,0 @@
1
- zlgcan-0.1.17.dist-info/METADATA,sha256=agacrPmok9gdrKoAjJP0_pbn7fFQrCpHXdKtXjg4Oa0,4260
2
- zlgcan-0.1.17.dist-info/WHEEL,sha256=I0oh3Vvc4dQIPlo9T2OQSgeCvmDsIw855l8Cuc55nN8,90
3
- zlgcan-0.1.17.dist-info/entry_points.txt,sha256=1BprfQnq7A25SfDsPk1ZbOgMv_SmYEUWc7Xz-oAf-V4,45
4
- zlgcan-0.1.17.dist-info/licenses/LICENSE.txt,sha256=6n0EnHcF3BOvwgLdGOGCfzSE-CEv0_p7gvxKDDY0Msk,7816
5
- zlgcan/__init__.py,sha256=uspwQytd3RGSaVs6LQADIa9MS_qvzySlfL2S9OhFBQA,21
6
- zlgcan/zlgcan.py,sha256=Tyo7ITIkJlLdLYwh74zAXe-3QXsKaT27c1NLBVXcgAo,8642
7
- zlgcan_driver/__init__.py,sha256=JBAj4WkBypBiHIJqXHIJTNHF4kpmhRmKqY48oDAmY3E,135
8
- zlgcan_driver/zlgcan_driver.cp38-win32.pyd,sha256=OGJ51CQ3v7R7EV96Ns5x3qpNEw5vFYFW7gkuM9aITYM,637952
9
- zlgcan-0.1.17.dist-info/RECORD,,