Crates.io | pandacan |
lib.rs | pandacan |
version | 0.1.1 |
source | src |
created_at | 2021-03-28 20:14:17.348684 |
updated_at | 2021-03-28 20:20:39.152341 |
description | Library to send/receive CAN data using a panda OBD dongle. See https://github.com/commaai/panda for more information. |
homepage | |
repository | https://github.com/pd0wm/pandacan-rs |
max_upload_size | |
id | 374794 |
size | 22,942 |
Rust library to communicate with a comma.ai panda.
let context = libusb::Context::new().unwrap();
let panda = Panda::new(&context, Duration::from_millis(100));
panda.set_safety_model(SafetyModel::AllOutput, 0).expect("Error setting safety mode");
loop {
if let Ok(h) = panda.health() {
println!("{:?}", h);
}
if let Ok(c) = panda.can_receive() {
for msg in c {
println!("{:?}", msg);
}
}
thread::sleep(Duration::from_millis(500));
}
The examples folder contains a small helper binary to print all traffic on a certain bus:
cargo run --example can_printer -- --bus=0