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
=4
KEY_1
=30
KEY_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
=0x01
MOUSE_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
=0x00
GAMEPAD_B
=0x01
Enum: GamepadDPadDirection
​
enum GamepadDPadDirection : uint8_t
Defines directions for the gamepad D-pad.
Examples:
GAMEPAD_DPAD_CENTERED
=0
GAMEPAD_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
=0xCD
MEDIA_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
=0x81
HID_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