Skip to main content

hid_types/id/usage/
scales.rs

1//! Usage ID values from the Scales Usage Page.
2
3use num_enum::{IntoPrimitive, TryFromPrimitive};
4
5use crate::Ident;
6
7/// Usage ID values from the Scales Usage Page.
8///
9/// See [HID Usage Tables for Universal Serial Bus](https://www.usb.org/document-library/hid-usage-tables-17),
10/// section 33.
11#[expect(missing_docs)]
12#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
13#[repr(u16)]
14#[non_exhaustive]
15pub enum KnownUsage {
16    Undefined = 0,
17    Scales = 0x01,
18    // 0x02-0x1F reserved
19    ScaleDevice = 0x20,
20    ScaleClass = 0x21,
21    ScaleClassIMetric = 0x22,
22    ScaleClassIiMetric = 0x23,
23    ScaleClassIiiMetric = 0x24,
24    ScaleClassIiilMetric = 0x25,
25    ScaleClassIvMetric = 0x26,
26    ScaleClassIiiEnglish = 0x27,
27    ScaleClassIiilEnglish = 0x28,
28    ScaleClassIvEnglish = 0x29,
29    ScaleClassGeneric = 0x2A,
30    // 0x2B-0x2F reserved
31    ScaleAttributeReport = 0x30,
32    ScaleControlReport = 0x31,
33    ScaleDataReport = 0x32,
34    ScaleStatusReport = 0x33,
35    ScaleWeightLimitReport = 0x34,
36    ScaleStatisticsReport = 0x35,
37    // 0x36-0x3F reserved
38    DataWeight = 0x40,
39    DataScaling = 0x41,
40    // 0x42-0x4F reserved
41    WeightUnit = 0x50,
42    WeightUnitMilligram = 0x51,
43    WeightUnitGram = 0x52,
44    WeightUnitKilogram = 0x53,
45    WeightUnitCarats = 0x54,
46    WeightUnitTaels = 0x55,
47    WeightUnitGrains = 0x56,
48    WeightUnitPennyweights = 0x57,
49    WeightUnitMetricTon = 0x58,
50    WeightUnitAvoirTon = 0x59,
51    WeightUnitTroyOunce = 0x5A,
52    WeightUnitOunce = 0x5B,
53    WeightUnitPound = 0x5C,
54    // 0x5D-0x5F reserved
55    CalibrationCount = 0x60,
56    ReZeroCount = 0x61,
57    // 0x62-0x6F reserved
58    ScaleStatus = 0x70,
59    ScaleStatusFault = 0x71,
60    ScaleStatusStableAtCenterOfZero = 0x72,
61    ScaleStatusInMotion = 0x73,
62    ScaleStatusWeightStable = 0x74,
63    ScaleStatusUnderZero = 0x75,
64    ScaleStatusOverWeightLimit = 0x76,
65    ScaleStatusRequiresCalibration = 0x77,
66    ScaleStatusRequiresRezeroing = 0x78,
67    // 0x79-0x7F reserved
68    ZeroScale = 0x80,
69    EnforcedZeroReturn = 0x81,
70    // 0x82-0xFFFF reserved
71}
72
73/// A __Usage ID__ value.
74pub type Usage = Ident<KnownUsage, u16>;