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//!
14//! # Usage
15//! Add `host-can` to your project, specifying the `pcan` (MacOS) or `socketcan`
16//! (Linux) feature:
17//!
18//! ```
19//! cargo add host-can --features=<pcan | socketcan>
20//! ```
21//! See the `tests/` directory for example code.
22//!
23//! # TODO
24//! * Async APIs
25//! * CanFD support
26//! * Timestamp support
27//! * Adapter-specific APIs for device control/queries
28//! * More tests / docs / examples
29
30#[cfg(not(any(feature = "pcan", feature = "socketcan")))]
31compile_error!(
32 "Either feature \"pcan\" or \"socketcan\" must be enabled for this crate."
33);
34
35pub mod adapter;
36pub mod frame;
37pub mod id;