fs3000_rs/
types.rs

1/// Marker trait for FS3000 device types (1005 vs 1015).
2pub trait DeviceType: sealed::Sealed {
3    /// A series of datapoints to translate from the raw measurement (12-bit integer) to meters per second (f32).
4    fn datapoints() -> &'static [(u16, f32)];
5}
6
7/// A marker trait to indicate that we're communicating with a 1005 variant.
8pub struct FS3000_1005;
9/// A marker trait to indicate that we're communicating with a 1015 variant.
10pub struct FS3000_1015;
11
12impl DeviceType for FS3000_1005 {
13    fn datapoints() -> &'static [(u16, f32)] {
14        &[
15            (409, 0.0),
16            (915, 1.07),
17            (1522, 2.01),
18            (2066, 3.00),
19            (2523, 3.97),
20            (2908, 4.96),
21            (3256, 5.98),
22            (3572, 6.99),
23            (3686, 7.23),
24        ]
25    }
26}
27
28impl DeviceType for FS3000_1015 {
29    fn datapoints() -> &'static [(u16, f32)] {
30        &[
31            (409, 0.0),
32            (1203, 2.0),
33            (1597, 3.0),
34            (1908, 4.0),
35            (2187, 5.0),
36            (2400, 6.0),
37            (2629, 7.0),
38            (2801, 8.0),
39            (3006, 9.0),
40            (3178, 10.0),
41            (3309, 11.0),
42            (3563, 13.0),
43            (3686, 15.0),
44        ]
45    }
46}
47
48/// A marker trait to indicate whether the client is blocking or async.
49pub trait ClientType: sealed::Sealed {}
50
51/// A marker trait to indicate that the client is blocking.
52pub struct Blocking;
53/// A marker trait to indicate that the client is async.
54pub struct Async;
55
56impl ClientType for Blocking {}
57impl ClientType for Async {}
58
59mod sealed {
60    pub trait Sealed {}
61
62    impl Sealed for super::FS3000_1005 {}
63    impl Sealed for super::FS3000_1015 {}
64
65    impl Sealed for super::Blocking {}
66    impl Sealed for super::Async {}
67}