host_can/lib.rs
1//! A library for talking to CAN adapters on different platforms
2//! (MacOS via PCANBasic and Linux via socketcan currently).
3//!
4//! **NOTE: this is an early development version and APIs are
5//! not yet stabilized.**
6//!
7//! # Platforms and Adapters
8//! * **MacOS**
9//! * Install PCUSB library from [https://www.mac-can.com](https://www.mac-can.com)
10//! * PCAN-USB is the only adapter supported currently
11//! * **Linux**
12//! * Uses SocketCAN interface, all adapters with kernel drivers supported
13//! * **Windows (PRELIMINARY)**
14//! * Install PCAN-Basic library from [https://www.peak-system.com](https://www.peak-system.com/fileadmin/media/files/PCAN-Basic.zip)
15//! * Note that using `Adapter::recv()` with a timeout will consume excess CPU cycles
16//!
17//! # Usage
18//! Add `host-can` to your project, specifying the `pcan` (MacOS) or `socketcan`
19//! (Linux) feature:
20//!
21//! ```shell
22//! cargo add host-can --features=<pcan | socketcan>
23//! ```
24//! See the `tests/` directory for example code.
25//!
26//! # TODO
27//! * Async APIs
28//! * CanFD support
29//! * Timestamp support
30//! * Adapter-specific APIs for device control/queries
31//! * Handle adapter disconnect/reconnect
32//! * Optimize windows adapter read timeout logic
33//! * More tests / docs / examples
34
35#[cfg(not(any(feature = "pcan", feature = "socketcan")))]
36compile_error!(
37 "Either feature \"pcan\" or \"socketcan\" must be enabled for this crate."
38);
39
40pub mod adapter;
41pub mod frame;
42pub mod id;