Key names to USB HID keyboard usages.
Keys are named by their physical position, as the W3C UI Events
KeyboardEvent.code values that browsers send ("KeyA", "Digit1",
"ShiftLeft", "ArrowUp"): the target computer applies its own layout.
The keyboard has the usages 0x04..0xDD and eight modifier keys.
Summary
Functions
The key that types a character on a US keyboard, and whether with shift;
nil for characters it has no key for.
The report bit of a modifier key, nil for other keys.
The HID usage of any other key, nil when the keyboard has none.
Types
@type code() :: String.t()
A KeyboardEvent.code value.
@type modifier_bit() :: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
A modifier key as a bit of the boot keyboard report.
Functions
The key that types a character on a US keyboard, and whether with shift;
nil for characters it has no key for.
iex> Kuroneko.Gadget.HID.Keymap.character(?A)
{"KeyA", true}
iex> Kuroneko.Gadget.HID.Keymap.character(10)
{"Enter", false}
iex> Kuroneko.Gadget.HID.Keymap.character(?é)
nil
@spec modifier(code()) :: modifier_bit() | nil
The report bit of a modifier key, nil for other keys.
iex> Kuroneko.Gadget.HID.Keymap.modifier("ShiftLeft")
0x02
iex> Kuroneko.Gadget.HID.Keymap.modifier("KeyA")
nil
@spec usage(code()) :: 4..221 | nil
The HID usage of any other key, nil when the keyboard has none.
iex> Kuroneko.Gadget.HID.Keymap.usage("KeyA")
0x04
iex> Kuroneko.Gadget.HID.Keymap.usage("Enter")
0x28