📄 usb_report_desc.c
字号:
/* Copyright (c) 2007 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is confidential property of
* Nordic Semiconductor. The use, copying, transfer or disclosure
* of such information is prohibited except by express written
* agreement with Nordic Semiconductor.
*/
/** @file
* HID report descriptors for mouse, keyboard and remote control
*
* @author Runar Kjellhaug
*
* @addtogroup usb_descriptors
* @{
*/
#include "usb_desc.h"
//-----------------------------------------------------------------------------
// Report Descriptor(s) Declarations
//-----------------------------------------------------------------------------
//const hid_report_descriptor HIDREPORTDESC = changed RSK
code const uint8_t HID_REPORT_DESC_MOUSE[HID_REPORT_DESCRIPTOR_SIZE_MOUSE] = // HID_REPORT_DESCRIPTOR_SIZE
{
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x05, 0x09, // Usage Page (Buttons)
0x19, 0x01, // Usage Minimum (01)
0x29, 0x03, // Usage Maximum (01)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x05, // Report Size (5)
0x81, 0x01, // Input (Constant) for padding
0x75, 0x08, // Report Size (8)
0x95, 0x03, // Report Count (3)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x38, // USAGE (Wheel)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection (Physical)
0xC0 // End Collection (Application)
};
code const uint8_t HID_REPORT_DESC_KEYB[HID_REPORT_DESCRIPTOR_SIZE_KEYB] =
{
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x05, 0x07, // Usage Page (Key Codes)
0x19, 0xe0, // Usage Minimum (224)
0x29, 0xe7, // Usage Maximum (231)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input (Constant) reserved byte(1)
// 0x95, 0x05, // Report Count (5)
// 0x75, 0x01, // Report Size (1)
// 0x05, 0x08, // Usage Page (Page# for LEDs)
// 0x19, 0x01, // Usage Minimum (1)
// 0x29, 0x05, // Usage Maximum (5)
// 0x91, 0x02, // Output (Data, Variable, Absolute), Led report
// 0x95, 0x01, // Report Count (1)
// 0x75, 0x03, // Report Size (3)
// 0x91, 0x01, // Output (Data, Variable, Absolute), Led report padding
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x65, // Logical Maximum (101)
0x05, 0x07, // Usage Page (Key codes)
0x19, 0x00, // Usage Minimum (0)
0x29, 0x65, // Usage Maximum (101)
0x81, 0x00, // Input (Data, Array) Key array(6 bytes)
0xC0 // End Collection (Application)
};
code const uint8_t HID_REPORT_DESC_RC[HID_REPORT_DESCRIPTOR_SIZE_RC] =
{
0x05, 0x0C, //usage page(Consumer Devices)
0x09, 0x01, // usage (consumer control)
0xA1, 0x01, // collection (application)
0x05, 0x0C, //usage page(Consumer Devices)
0x09, 0x01, // usage (consumer control)
0xA1, 0x01, //collection (application)
//-----Start First Byte-----//
0x0A, 0x24, 0x02, //Usage (Back)
0x0A, 0x09, 0x02, //Usage (More Info)
0x09, 0xB0, //Usage (Play)
0x09, 0xB1, //Usage (Pause)
0x09, 0xCD, //Usage (Play/Pause)
0x09, 0xB7, //Usage (Stop)
0x09, 0xB2, //Usage (Record)
0x09, 0xB3, //Usage (Fast Forward)
//-----Start Second Byte-----//
0x09, 0xB4, //Usage (Rewind)
0x09, 0xB5, //Usage (Skip Forward)
0x09, 0xB6, //Usage (Skip Back)
0x09, 0xE9, //Usage (Volume Up)
0x09, 0xEA, //Usage (Volume Down)
0x09, 0xE2, //Usage (Mute)
0x09, 0x9C, //Usage (Chan/Page Up)
0x09, 0x9D, //Usage (Chan/Page Down)
//-----Start Third Byte-----//
0x09, 0x8D, //Usage (Guide)
0x0A, 0x08, 0x02, //Usage (Print)
0x15, 0x00, //LOGICAL_MINIMUM (0)
0x25, 0x01, //LOGICAL_MAXIMUM (1)
0x75, 0x01, //REPORT_SIZE (1)
0x95, 0x12, //REPORT_COUNT(18)
0x81, 0x02, //input (Data, Variable, Absolute)
0xC0, //End collection
0x05, 0x01, //Usage Page (Generic Desktop)
0x09, 0x80, //Usage (System Control)
0xA1, 0x01, //Collection (Application)
0x09, 0x82, //Usage (Power Off)
0x09, 0x82, //Usage (Power toggle (standby))
0x09, 0x83, //Usage (Power On)
0x75, 0x01, //REPORT_SIZE (1)
0x95, 0x03, //REPORT_COUNT(3)
0x81, 0x02, //input (Data, Variable, Absolute)
0x75, 0x01, //report size (1 bits)
0x95, 0x03, //report count (3 reports)
0x81, 0x01, //input (Cnst)
0xC0, //End collection
0xC0, //End Collection
};
/** @} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -