2 releases
Uses new Rust 2024
new 0.1.1 | Mar 25, 2025 |
---|---|
0.1.0 | Mar 24, 2025 |
#12 in #peak
30 downloads per month
155KB
4K
SLoC
peak-can-rs
A Rust wrapper for PEAK-System's PCAN-Basic API, providing access to PEAK CAN interfaces.
Features
- Supports sending and receiving CAN messages.
- Provides a safe Rust interface for working with PCAN devices.
- FFI bindings to the PCAN-Basic library.
Requirements
- Windows OS
- PEAK-System PCAN drivers installed
PCANBasic.lib
andPCANBasic.dll
available
Installation
1. Install the PCAN-Basic Library
Download and install the PCAN-Basic API from PEAK-System.
2. Add peak-can-rs
to Your Cargo Project
[dependencies]
peak-can = "0.1.0"
Usage
Example: Sending a CAN Message
cargo run --example receive
Example: Receiving a CAN Message
cargo run --example receive
Linking PCANBasic.lib
If you get a linking error, ensure PCANBasic.lib
is in your library path:
- Download
PCANBasic.lib
from https://www.peak-system.com/Software-Information.77.0.html?&L=1. - Modify
build.rs
in your Rust project:
fn main() {
println!("cargo:rustc-link-search=native=C:\\Libraries\\PCANBasic");
println!("cargo:rustc-link-lib=static=PCANBasic");
}
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions
Contributions are welcome! Feel free to open an issue or a pull request.
Dependencies
~22KB