Skip to main content

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