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    /// Illuminance.
31    Illuminance,
32    /// Latitude.
33    Latitude,
34    /// Longitude.
35    Longitude,
36    /// Opaque channel: the associated sample is intended for the sensor driver only, and no guarantees are provided.
37    Opaque,
38    /// Opaque channel marker used by `GnssTimeExt`.
39    OpaqueGnssTime,
40    /// Pressure.
41    Pressure,
42    /// Relative humidity.
43    RelativeHumidity,
44    /// Heading.
45    Heading,
46    /// Temperature.
47    Temperature,
48    /// Vertical speed.
49    VerticalSpeed,
50    /// X axis.
51    X,
52    /// Y axis.
53    Y,
54    /// Z axis.
55    Z,
56}
57
58impl core::fmt::Display for Label {
59    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
60        match self {
61            Self::AccelerationX => write!(f, "Acceleration X"),
62            Self::AccelerationY => write!(f, "Acceleration Y"),
63            Self::AccelerationZ => write!(f, "Acceleration Z"),
64            Self::Altitude => write!(f, "Altitude"),
65            Self::AngularVelocityX => write!(f, "Angular velocity X"),
66            Self::AngularVelocityY => write!(f, "Angular velocity Y"),
67            Self::AngularVelocityZ => write!(f, "Angular velocity Z"),
68            Self::Co2 => write!(f, "CO2 concentration"),
69            Self::GroundSpeed => write!(f, "Ground speed"),
70            Self::Illuminance => write!(f, "Illuminance"),
71            Self::Latitude => write!(f, "Latitude"),
72            Self::Longitude => write!(f, "Longitude"),
73            Self::Opaque | Self::OpaqueGnssTime => write!(f, "[opaque]"),
74            Self::Pressure => write!(f, "Pressure"),
75            Self::RelativeHumidity => write!(f, "Relative humidity"),
76            Self::Heading => write!(f, "Heading"),
77            Self::Temperature => write!(f, "Temperature"),
78            Self::VerticalSpeed => write!(f, "Vertical speed"),
79            Self::X => write!(f, "X"),
80            Self::Y => write!(f, "Y"),
81            Self::Z => write!(f, "Z"),
82        }
83    }
84}