Serialport Support

- allow communication to elm327 device via a serialport
- allow creation of elm327 device without requiring unwrap()
- added some extra documentation
- expose reset() functionality of device
- serial_comm and ftdi_comm abstractions added
This commit is contained in:
Nicholas Orlowsky 2025-05-23 20:40:30 -04:00
parent 83ce026d23
commit c1cea1e488
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
11 changed files with 194 additions and 58 deletions

View file

@ -6,14 +6,20 @@
//!
//! # Usage
//! ```
//! use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};
//! use obd2::{commands::Obd2DataRetrieval, device::{Elm327, FTDIDevice}, Obd2};
//!
//! fn main() -> Result<(), obd2::Error> {
//! let mut device = Obd2::<Elm327>::default();
//! let mut device = Obd2::new(Elm327::new(FTDIDevice::new()?)?)?;
//! println!("VIN: {}", device.get_vin()?);
//! Ok(())
//! }
//! ```
//!
//! alternatively, you could use a serial port provided by your operating system such as
//! /dev/ttyUSB0 on unix-like systems
//! ```
//! let mut device = Obd2::new(Elm327::new(SerialPort::new("/dev/ttyUSB0")?)?)?;
//! ```
#![forbid(unsafe_code)]
#![warn(missing_docs, clippy::panic)]