feat: add FFI layer, protocol tests, mock transport, README

- FFI: eskin_open/close/read_register/write_register for C/C++/Python
- Protocol: encode/decode tests with golden bytes verification
- Stream: implement PollingSampleCollector producing FingerSample
- Register: add parse_combined_forces/parse_module_errors
- Transport: add MockSerialTransport for testing
- Include: add C header file eskin_ffi.h
- Examples: C++ and Python usage examples
- README: full usage guide for Rust/C++/Python
- Exclude docs/ from repo (internal only)
This commit is contained in:
lenn
2026-05-06 00:54:44 +08:00
parent 60f9ad15e7
commit a7b7192341
13 changed files with 721 additions and 1915 deletions

View File

@@ -54,6 +54,43 @@ pub enum SensorModule {
Palm8 = 27,
}
impl SensorModule {
pub fn from_index(index: u8) -> Self {
match index {
0 => Self::ThumbProximal,
1 => Self::ThumbMiddle,
2 => Self::ThumbTip,
3 => Self::ThumbNail,
4 => Self::IndexProximal,
5 => Self::IndexMiddle,
6 => Self::IndexTip,
7 => Self::IndexNail,
8 => Self::MiddleProximal,
9 => Self::MiddleMiddle,
10 => Self::MiddleTip,
11 => Self::MiddleNail,
12 => Self::RingProximal,
13 => Self::RingMiddle,
14 => Self::RingTip,
15 => Self::RingNail,
16 => Self::PinkyProximal,
17 => Self::PinkyMiddle,
18 => Self::PinkyTip,
19 => Self::PinkyNail,
20 => Self::Palm1,
21 => Self::Palm2,
22 => Self::Palm3,
23 => Self::Palm4,
24 => Self::Palm5,
25 => Self::Palm6,
26 => Self::Palm7,
27 => Self::Palm8,
_ => Self::ThumbProximal,
}
}
}
pub const SENSOR_MODULE_COUNT: usize = 28;
#[repr(C)]