From 29d8f1b4e89f31e2f3b448c4d40c6c2518629686 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 25 Apr 2016 19:47:49 +0200 Subject: HID: added keyboard definition. --- usb/hid.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/usb/hid.h b/usb/hid.h index 1d3c8c1..3501bd5 100644 --- a/usb/hid.h +++ b/usb/hid.h @@ -85,6 +85,7 @@ namespace DesktopUsage { enum _8 : uint8_t { Undefined, Gamepad = 0x05, + Keyboard, X = 0x30, Y, Z, @@ -175,6 +176,24 @@ constexpr auto gamepad(R... r) -> decltype( ); } +template +constexpr auto keyboard(R... r) -> decltype( + pack( + usage_page(UsagePage::Desktop), + usage(DesktopUsage::Keyboard), + collection(Collection::Application, + r... + ) + )) { + return pack( + usage_page(UsagePage::Desktop), + usage(DesktopUsage::Keyboard), + collection(Collection::Application, + r... + ) + ); +} + constexpr auto buttons(uint8_t num) -> decltype( pack( usage_page(UsagePage::Button), -- cgit v1.2.3