hid-types 0.1.1

Rust types for working with USB HID report descriptors
Documentation
//! Well-known Usage ID values from the Arcade Usage Page.

use num_enum::{IntoPrimitive, TryFromPrimitive};

use crate::Ident;

/// Well-known Usage ID values from the Arcade Usage Page.
///
/// See [HID Usage Tables for Universal Serial Bus](https://www.usb.org/document-library/hid-usage-tables-17),
/// section 36.
#[expect(missing_docs)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(u16)]
pub enum KnownUsage {
    Undefined = 0,
    GeneralPurposeIoCard = 0x01,
    CoinDoor = 0x02,
    WatchdogTimer = 0x03,
    // 0x04..0x2F reserved
    GeneralPurposeAnalogInputState = 0x30,
    GeneralPurposeDigitalInputState = 0x31,
    GeneralPurposeOpticalInputState = 0x32,
    GeneralPurposeDigitalOutputState = 0x33,
    NumberOfCoinDoors = 0x34,
    CoinDrawerDropCount = 0x35,
    CoinDrawerStart = 0x36,
    CoinDrawerService = 0x37,
    CoinDrawerTilt = 0x38,
    CoinDoorTest = 0x39,
    // 0x3A-0x3F reserved
    CoinDoorLockout = 0x40,
    WatchdogTimeout = 0x41,
    WatchdogAction = 0x42,
    WatchdogReboot = 0x43,
    WatchdogRestart = 0x44,
    AlarmInput = 0x45,
    CoinDoorCounter = 0x46,
    IoDirectionMapping = 0x47,
    SetIoDirectionMapping = 0x48,
    ExtendedOpticalInputState = 0x49,
    PinPadInputState = 0x4A,
    PinPadStatus = 0x4B,
    PinPadOutput = 0x4C,
    PinPadCommand = 0x4D,
    // 0x4E-0xFFFF reserved
}

/// A __Usage ID__ value.
pub type Usage = Ident<KnownUsage, u16>;