HID Specs
This header file provides a detailed reference for various HID (Human Interface Device) keycodes used across keyboard, mouse, gamepad, and consumer devices. Each section defines specific keycode enums and their usage.
For detail value, refer to the source code os/framework/HIDSpecs.h.
Keyboard Keycodesβ
Enum: KeyboardKeycodeβ
enum KeyboardKeycode : uint8_t
Defines keycodes for standard keyboard keys, including alphanumeric characters, function keys, and special keys.
Examples:
KEY_A=4KEY_1=30KEY_ENTER=40
Enum: KeyboardModsβ
enum KeyboardMods : uint16_t
Defines modifiers such as control, shift, alt, and GUI keys.
Examples:
MOD_LEFT_CTRL=(1 << 8)MOD_RIGHT_SHIFT=(1 << 13)
Enum: KeyboardLedsβ
enum KeyboardLeds : uint8_t
Defines keyboard LED states, including NUM LOCK, CAPS LOCK, and more.
Examples:
LED_NUM_LOCK=(1 << 0)LED_CAPS_LOCK=(1 << 1)
Mouse Keycodesβ
Enum: MouseKeycodeβ
enum MouseKeycode : uint8_t
Defines mouse button codes for left, right, and middle buttons, as well as navigation buttons.
Examples:
MOUSE_LEFT=0x01MOUSE_RIGHT=0x02
Gamepad Keycodesβ
Enum: GamepadKeycodeβ
enum GamepadKeycode : uint8_t
Defines keycodes for gamepad buttons, including standard buttons (A, B, etc.) and numbered buttons.
Examples:
GAMEPAD_A=0x00GAMEPAD_B=0x01
Enum: GamepadDPadDirectionβ
enum GamepadDPadDirection : uint8_t
Defines directions for the gamepad D-pad.
Examples:
GAMEPAD_DPAD_CENTERED=0GAMEPAD_DPAD_UP=1
Consumer Keycodesβ
Enum: ConsumerKeycodeβ
enum ConsumerKeycode : uint16_t
Defines keycodes for consumer controls such as media keys and brightness adjustments.
Examples:
MEDIA_PLAY_PAUSE=0xCDMEDIA_VOLUME_UP=0xE9
System Keycodesβ
Enum: SystemKeycodeβ
enum SystemKeycode : uint8_t
Defines keycodes for system-level controls like power, sleep, and wake-up.
Examples:
SYSTEM_POWER_DOWN=0x81HID_SYSTEM_SLEEP=0x82
Detailed Keycode Tablesβ
Keyboard Keycodesβ
| Key | Code |
|---|---|
KEY_A | 4 |
KEY_B | 5 |
KEY_ENTER | 40 |
KEY_CAPS_LOCK | 0x39 |
Modifier Keysβ
| Modifier | Code |
|---|---|
MOD_LEFT_CTRL | (1 << 8) |
MOD_RIGHT_SHIFT | (1 << 13) |
Consumer Keysβ
| Key | Code |
|---|---|
MEDIA_PLAY_PAUSE | 0xCD |
MEDIA_VOLUME_UP | 0xE9 |
System Keysβ
| Key | Code |
|---|---|
SYSTEM_POWER_DOWN | 0x81 |
SYSTEM_SLEEP | 0x82 |
Notesβ
- Some consumer keys might only work on specific operating systems (e.g., Linux).
- Gamepad follows the Dinput standard, which is might not work for all games (They only support Xinput).
This documentation is comprehensive and categorized, providing quick references and details about each set of keycodes. It ensures developers can easily locate and understand the purpose of each keycode.
Comments