Skip to main content

hid_types/id/usage/
scales.rs

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