zlgcan 0.2.1b1__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.1b1 → zlgcan-0.2.3b0}/Cargo.lock +3 -3
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/Cargo.toml +3 -3
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/PKG-INFO +1 -1
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/src/lib.rs +29 -19
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/.editorconfig +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/.github/workflows/CI.yml +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/.github/workflows/label-check.yml +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/.gitignore +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/CHANGELOG.md +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/LICENSE.txt +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/README.md +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/pyproject.toml +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/requirements.txt +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/src/wrappers/constants.rs +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/src/wrappers/mod.rs +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/zlgcan/__init__.py +0 -0
- {zlgcan-0.2.1b1 → zlgcan-0.2.3b0}/zlgcan/zlgcan.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", package = "rs-can",
|
17
|
-
zlgcan = { git = "https://github.com/jesses2025smith/rust-can.git", package = "zlgcan",
|
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,9 +37,13 @@ fn zlgcan_init_can(
|
|
37
37
|
);
|
38
38
|
|
39
39
|
for (i, cfg) in cfgs.into_iter().enumerate() {
|
40
|
+
let chl_type = ZCanChlType::try_from(cfg.chl_type)
|
41
|
+
.map_err(|e| exceptions::PyValueError::new_err(e.to_string()))?;
|
42
|
+
let chl_mode = ZCanChlMode::try_from(cfg.chl_mode)
|
43
|
+
.map_err(|e| exceptions::PyValueError::new_err(e.to_string()))?;
|
40
44
|
let mut c = ChannelConfig::new(cfg.bitrate);
|
41
|
-
c.add_other(CHANNEL_TYPE, Box::new(
|
42
|
-
.add_other(CHANNEL_MODE, Box::new(
|
45
|
+
c.add_other(CHANNEL_TYPE, Box::new(chl_type))
|
46
|
+
.add_other(CHANNEL_MODE, Box::new(chl_mode));
|
43
47
|
|
44
48
|
cfg.dbitrate.map(|dbitrate| c.set_data_bitrate(dbitrate));
|
45
49
|
cfg.resistance.map(|resistance| c.set_resistance(resistance));
|
@@ -167,7 +171,6 @@ fn zlgcan_driver(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
167
171
|
|
168
172
|
#[cfg(test)]
|
169
173
|
mod tests {
|
170
|
-
use std::time::Instant;
|
171
174
|
use zlgcan::{
|
172
175
|
can::{ZCanChlMode, ZCanChlType},
|
173
176
|
device::ZCanDeviceType,
|
@@ -181,35 +184,42 @@ 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(
|
184
|
-
ZCanChlType::
|
187
|
+
ZCanChlType::CAN as u8,
|
185
188
|
ZCanChlMode::Normal as u8,
|
186
189
|
500_000,
|
187
190
|
None,
|
188
|
-
|
191
|
+
None,
|
192
|
+
None,
|
193
|
+
None,
|
194
|
+
None,
|
195
|
+
None,
|
196
|
+
);
|
197
|
+
let cfg2 = ZCanChlCfgPy::new(
|
198
|
+
ZCanChlType::CAN as u8,
|
199
|
+
ZCanChlMode::Normal as u8,
|
200
|
+
500_000,
|
201
|
+
None,
|
202
|
+
None,
|
189
203
|
None,
|
190
204
|
None,
|
191
205
|
None,
|
192
206
|
None,
|
193
207
|
);
|
194
208
|
|
195
|
-
let device = zlgcan_init_can("../../
|
209
|
+
let device = zlgcan_init_can("../../RustRoverProjects/rust-can/zlgcan/library".into(), dev_type, dev_idx, vec![cfg, cfg2], None)?;
|
196
210
|
let dev_info = zlgcan_device_info(&device)?;
|
197
211
|
println!("{}", dev_info);
|
198
212
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
199
213
|
|
200
|
-
let
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
if flag {
|
211
|
-
break;
|
212
|
-
}
|
214
|
+
let mut msg = CanMessage::new(0x7df, &vec![0x02, 0x10, 0x01]).unwrap();
|
215
|
+
msg.set_channel(0);
|
216
|
+
let ret = zlgcan_send(&device, msg.into())?;
|
217
|
+
println!("send: {}", ret);
|
218
|
+
|
219
|
+
std::thread::sleep(std::time::Duration::from_micros(200));
|
220
|
+
let msgs = zlgcan_recv(&device, 1, None)?;
|
221
|
+
if !msgs.is_empty() {
|
222
|
+
println!("{:?}", msgs);
|
213
223
|
}
|
214
224
|
|
215
225
|
zlgcan_close(&device)?;
|
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
|
File without changes
|
File without changes
|