feat: add device open example and debug logging for sent frames

This commit is contained in:
lenn
2026-05-06 14:20:34 +08:00
parent a7b7192341
commit a7ef583d74
2 changed files with 12 additions and 2 deletions

View File

@@ -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();
} }

View File

@@ -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)
} }