ariel_os_sensors/
label.rs

1/// Label of a [`Sample`](crate::sensor::Sample) part of a
2/// [`Samples`](crate::sensor::Samples) tuple.
3///
4/// # For sensor driver implementors
5///
6/// Missing variants can be added when required.
7/// Please open an issue to discuss it.
8#[derive(Debug, Copy, Clone, PartialEq, Eq)]
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
10#[non_exhaustive]
11pub enum Label {
12    /// Acceleration along the X axis.
13    AccelerationX,
14    /// Acceleration along the Y axis.
15    AccelerationY,
16    /// Acceleration along the Z axis.
17    AccelerationZ,
18    /// Altitude.
19    Altitude,
20    /// Angular velocity about the X axis.
21    AngularVelocityX,
22    /// Angular velocity about the Y axis.
23    AngularVelocityY,
24    /// Angular velocity about the Z axis.
25    AngularVelocityZ,
26    /// CO<sub>2</sub> concentration.
27    Co2,
28    /// Ground speed.
29    GroundSpeed,
30    /// Latitude.
31    Latitude,
32    /// Longitude.
33    Longitude,
34    /// Opaque channel: the associated sample is intended for the sensor driver only, and no guarantees are provided.
35    Opaque,
36    /// Opaque channel marker used by `GnssTimeExt`.
37    OpaqueGnssTime,
38    /// Pressure.
39    Pressure,
40    /// Relative humidity.
41    RelativeHumidity,
42    /// Heading.
43    Heading,
44    /// Temperature.
45    Temperature,
46    /// Vertical speed.
47    VerticalSpeed,
48    /// X axis.
49    X,
50    /// Y axis.
51    Y,
52    /// Z axis.
53    Z,
54}
55
56impl core::fmt::Display for Label {
57    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
58        match self {
59            Self::AccelerationX => write!(f, "Acceleration X"),
60            Self::AccelerationY => write!(f, "Acceleration Y"),
61            Self::AccelerationZ => write!(f, "Acceleration Z"),
62            Self::Altitude => write!(f, "Altitude"),
63            Self::AngularVelocityX => write!(f, "Angular velocity X"),
64            Self::AngularVelocityY => write!(f, "Angular velocity Y"),
65            Self::AngularVelocityZ => write!(f, "Angular velocity Z"),
66            Self::Co2 => write!(f, "CO2 concentration"),
67            Self::GroundSpeed => write!(f, "Ground speed"),
68            Self::Latitude => write!(f, "Latitude"),
69            Self::Longitude => write!(f, "Longitude"),
70            Self::Opaque | Self::OpaqueGnssTime => write!(f, "[opaque]"),
71            Self::Pressure => write!(f, "Pressure"),
72            Self::RelativeHumidity => write!(f, "Relative humidity"),
73            Self::Heading => write!(f, "Heading"),
74            Self::Temperature => write!(f, "Temperature"),
75            Self::VerticalSpeed => write!(f, "Vertical speed"),
76            Self::X => write!(f, "X"),
77            Self::Y => write!(f, "Y"),
78            Self::Z => write!(f, "Z"),
79        }
80    }
81}