zlgcan 0.2.2__tar.gz → 0.2.3b0__tar.gz
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-0.2.2 → zlgcan-0.2.3b0}/Cargo.lock +3 -3
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/Cargo.toml +3 -3
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/PKG-INFO +1 -1
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/src/lib.rs +8 -5
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/src/wrappers/mod.rs +5 -5
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/zlgcan/zlgcan.py +6 -5
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/.editorconfig +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/.github/workflows/CI.yml +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/.github/workflows/label-check.yml +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/.gitignore +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/CHANGELOG.md +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/LICENSE.txt +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/README.md +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/pyproject.toml +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/requirements.txt +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/src/wrappers/constants.rs +0 -0
- {zlgcan-0.2.2 → zlgcan-0.2.3b0}/zlgcan/__init__.py +0 -0
@@ -210,7 +210,7 @@ dependencies = [
|
|
210
210
|
[[package]]
|
211
211
|
name = "rs-can"
|
212
212
|
version = "0.3.0"
|
213
|
-
source = "git+https://github.com/jesses2025smith/rust-can.git?
|
213
|
+
source = "git+https://github.com/jesses2025smith/rust-can.git?branch=py#b47be22c135553b723146de65d7bf6f44da26403"
|
214
214
|
dependencies = [
|
215
215
|
"bitflags",
|
216
216
|
"derive-getters",
|
@@ -345,7 +345,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
345
345
|
[[package]]
|
346
346
|
name = "zlgcan"
|
347
347
|
version = "0.3.0"
|
348
|
-
source = "git+https://github.com/jesses2025smith/rust-can.git?
|
348
|
+
source = "git+https://github.com/jesses2025smith/rust-can.git?branch=py#b47be22c135553b723146de65d7bf6f44da26403"
|
349
349
|
dependencies = [
|
350
350
|
"dlopen2",
|
351
351
|
"log",
|
@@ -357,7 +357,7 @@ dependencies = [
|
|
357
357
|
|
358
358
|
[[package]]
|
359
359
|
name = "zlgcan-driver"
|
360
|
-
version = "0.2.
|
360
|
+
version = "0.2.3-beta0"
|
361
361
|
dependencies = [
|
362
362
|
"anyhow",
|
363
363
|
"pyo3",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "zlgcan-driver"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.3-beta0"
|
4
4
|
edition = "2021"
|
5
5
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
@@ -13,8 +13,8 @@ pyo3 = "0.25"
|
|
13
13
|
#iso15765-2 = { version = "0.1.0-alpha0" }
|
14
14
|
#iso14229-1 = { version = "0.1.0-alpha0" }
|
15
15
|
#docan = { version = "0.1.0-alpha0" }
|
16
|
-
rs-can = { git = "https://github.com/jesses2025smith/rust-can.git",
|
17
|
-
zlgcan = { git = "https://github.com/jesses2025smith/rust-can.git",
|
16
|
+
rs-can = { git = "https://github.com/jesses2025smith/rust-can.git", package = "rs-can", branch = "py" }
|
17
|
+
zlgcan = { git = "https://github.com/jesses2025smith/rust-can.git", package = "zlgcan", branch = "py" }
|
18
18
|
|
19
19
|
[dev-dependencies]
|
20
20
|
anyhow = "1"
|
@@ -37,12 +37,12 @@ fn zlgcan_init_can(
|
|
37
37
|
);
|
38
38
|
|
39
39
|
for (i, cfg) in cfgs.into_iter().enumerate() {
|
40
|
-
let
|
40
|
+
let chl_type = ZCanChlType::try_from(cfg.chl_type)
|
41
41
|
.map_err(|e| exceptions::PyValueError::new_err(e.to_string()))?;
|
42
42
|
let chl_mode = ZCanChlMode::try_from(cfg.chl_mode)
|
43
43
|
.map_err(|e| exceptions::PyValueError::new_err(e.to_string()))?;
|
44
44
|
let mut c = ChannelConfig::new(cfg.bitrate);
|
45
|
-
c.add_other(
|
45
|
+
c.add_other(CHANNEL_TYPE, Box::new(chl_type))
|
46
46
|
.add_other(CHANNEL_MODE, Box::new(chl_mode));
|
47
47
|
|
48
48
|
cfg.dbitrate.map(|dbitrate| c.set_data_bitrate(dbitrate));
|
@@ -171,7 +171,10 @@ fn zlgcan_driver(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
171
171
|
|
172
172
|
#[cfg(test)]
|
173
173
|
mod tests {
|
174
|
-
use zlgcan::{
|
174
|
+
use zlgcan::{
|
175
|
+
can::{ZCanChlMode, ZCanChlType},
|
176
|
+
device::ZCanDeviceType,
|
177
|
+
};
|
175
178
|
use super::*;
|
176
179
|
|
177
180
|
#[test]
|
@@ -181,22 +184,22 @@ mod tests {
|
|
181
184
|
let dev_type = ZCanDeviceType::ZCAN_USBCANFD_200U as u32;
|
182
185
|
let dev_idx = 0;
|
183
186
|
let cfg = ZCanChlCfgPy::new(
|
187
|
+
ZCanChlType::CAN as u8,
|
184
188
|
ZCanChlMode::Normal as u8,
|
185
189
|
500_000,
|
186
190
|
None,
|
187
191
|
None,
|
188
|
-
Some(true),
|
189
192
|
None,
|
190
193
|
None,
|
191
194
|
None,
|
192
195
|
None,
|
193
196
|
);
|
194
197
|
let cfg2 = ZCanChlCfgPy::new(
|
198
|
+
ZCanChlType::CAN as u8,
|
195
199
|
ZCanChlMode::Normal as u8,
|
196
200
|
500_000,
|
197
201
|
None,
|
198
202
|
None,
|
199
|
-
Some(true),
|
200
203
|
None,
|
201
204
|
None,
|
202
205
|
None,
|
@@ -38,14 +38,14 @@ pub struct ZCanDriverWrap {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
#[pyclass]
|
41
|
-
#[derive(
|
41
|
+
#[derive(Clone)]
|
42
42
|
pub struct ZCanChlCfgPy {
|
43
|
+
pub(crate) chl_type: u8,
|
43
44
|
pub(crate) chl_mode: u8,
|
44
45
|
pub(crate) bitrate: u32,
|
45
46
|
pub(crate) filter: Option<u8>,
|
46
47
|
pub(crate) dbitrate: Option<u32>,
|
47
48
|
pub(crate) resistance: Option<bool>,
|
48
|
-
pub(crate) fdchl_type: u8,
|
49
49
|
pub(crate) acc_code: Option<u32>,
|
50
50
|
pub(crate) acc_mask: Option<u32>,
|
51
51
|
pub(crate) brp: Option<u32>,
|
@@ -54,25 +54,25 @@ pub struct ZCanChlCfgPy {
|
|
54
54
|
#[pymethods]
|
55
55
|
impl ZCanChlCfgPy {
|
56
56
|
#[new]
|
57
|
-
#[pyo3(signature = (chl_mode, bitrate, filter=None, dbitrate=None, resistance=None,
|
57
|
+
#[pyo3(signature = (chl_type, chl_mode, bitrate, filter=None, dbitrate=None, resistance=None, acc_code=None, acc_mask=None, brp=None))]
|
58
58
|
pub fn new(
|
59
|
+
chl_type: u8,
|
59
60
|
chl_mode: u8,
|
60
61
|
bitrate: u32,
|
61
62
|
filter: Option<u8>,
|
62
63
|
dbitrate: Option<u32>,
|
63
64
|
resistance: Option<bool>,
|
64
|
-
fdchl_type: Option<u8>,
|
65
65
|
acc_code: Option<u32>,
|
66
66
|
acc_mask: Option<u32>,
|
67
67
|
brp: Option<u32>,
|
68
68
|
) -> Self {
|
69
69
|
ZCanChlCfgPy {
|
70
|
+
chl_type,
|
70
71
|
chl_mode,
|
71
72
|
bitrate,
|
72
73
|
filter,
|
73
74
|
dbitrate,
|
74
75
|
resistance,
|
75
|
-
fdchl_type: fdchl_type.unwrap_or(0),
|
76
76
|
acc_code,
|
77
77
|
acc_mask,
|
78
78
|
brp,
|
@@ -28,9 +28,10 @@ except ModuleNotFoundError:
|
|
28
28
|
}.get(_platform, not_support)
|
29
29
|
|
30
30
|
|
31
|
-
class
|
32
|
-
|
33
|
-
|
31
|
+
class ZCanChlType:
|
32
|
+
CAN = 0
|
33
|
+
CANFD_ISO = 1
|
34
|
+
CANFD_NON_ISO = 2
|
34
35
|
|
35
36
|
class ZCanChlMode:
|
36
37
|
Normal = 0
|
@@ -168,12 +169,12 @@ class ZCanBus(can.BusABC):
|
|
168
169
|
dbitrate = cfg.get("dbitrate", None)
|
169
170
|
assert bitrate is not None, "bitrate is required!"
|
170
171
|
_cfg = ZCanChlCfgPy(
|
171
|
-
|
172
|
+
chl_type=cfg.get("chl_type", ZCanChlType.CANFD_ISO if dbitrate else ZCanChlType.CAN),
|
173
|
+
chl_mode=cfg.get("chl_mode", 0),
|
172
174
|
bitrate=bitrate,
|
173
175
|
filter=cfg.get("filter"),
|
174
176
|
dbitrate=dbitrate,
|
175
177
|
resistance=bool(cfg.get("resistance", 1)),
|
176
|
-
fdchl_type=cfg.get("fdchl_type", ZCanFdChlType.ISO),
|
177
178
|
acc_code=cfg.get("acc_code"),
|
178
179
|
acc_mask=cfg.get("acc_mask"),
|
179
180
|
brp=cfg.get("brp")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|