feat: add device open example and debug logging for sent frames
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -1,3 +1,13 @@
|
|||||||
|
use eskin_finger_sdk::{config::DeviceConfig, device::{EskinDevice, EskinDeviceInner}, transport::SerialPortTransport};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let transport = SerialPortTransport::new("/dev/ttyUSB0", 921600);
|
||||||
|
let config = DeviceConfig::default();
|
||||||
|
let mut device = EskinDeviceInner::new(config, Box::new(transport));
|
||||||
|
device.open().unwrap();
|
||||||
|
|
||||||
|
let data = device.read_register(0x1C00, 168).unwrap();
|
||||||
|
println!("Serial: {:?}", data);
|
||||||
|
|
||||||
|
device.close().unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ impl ProtocolCodec for EskinProtocolCodec {
|
|||||||
|
|
||||||
let crc = self.crc8(&frame);
|
let crc = self.crc8(&frame);
|
||||||
frame.push(crc);
|
frame.push(crc);
|
||||||
|
println!("send: {:02X?}", frame);
|
||||||
Ok(frame)
|
Ok(frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user