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:
parent
83ce026d23
commit
c1cea1e488
11 changed files with 194 additions and 58 deletions
12
src/device/serial_comm.rs
Normal file
12
src/device/serial_comm.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use super::Result;
|
||||
|
||||
#[cfg(any(feature = "serialport_comm", feature = "ftdi_comm"))]
|
||||
pub const DEFAULT_BAUD_RATE: u32 = 38_400;
|
||||
|
||||
/// An API to communicate with a serial device
|
||||
pub trait SerialComm {
|
||||
fn write_all(&mut self, data: &[u8]) -> Result<()>;
|
||||
fn read(&mut self, data: &mut [u8]) -> Result<usize>;
|
||||
fn set_baud_rate(&mut self, baud_rate: u32) -> Result<()>;
|
||||
fn purge_buffers(&mut self) -> Result<()>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue