stm32 hid 键盘描述
/* USB Standard Device Descriptor */ const uint8_t Joystick_DeviceDescriptor[JOYSTICK_SIZ_DEVICE_DESC] = { 0x12, /*bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/ 0x00, /*bcdUSB */ 0x02, 0x00, /*bDeviceClass*/ 0x00, /*bDeviceSubClass*/ 0x00, /*bDeviceProtocol*/ 0x40, /*bMaxPacketSize40*/ 0x08, /*idVendor (0x0483)*/ 0x48, 0x57, /*idProduct = 0x5710*/ 0x10, 0x00, /*bcdDevice rel. 2.00*/ 0x02, , /*Index of string descriptor describing manufacturer */ , /*Index of string descriptor describing product*/ , /*Index of string descriptor describing the device serial number */ 0x01 /*bNumConfigurations*/ } ; /* Joystick_DeviceDescriptor */ /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ const uint8_t Joystick_ConfigDescriptor[JOYSTICK_SIZ_CONFIG_DESC] = { 0x09, /* bLength: Configuation Descriptor size */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */ JOYSTICK_SIZ_CONFIG_DESC, /* wTotalLength: Bytes returned */ 0x00, 0x01, /*bNumInterfaces: 1 interface*/ 0x01, /*bConfigurationValue: Configuration value*/ 0x00, /*iConfiguration: Index of string descriptor describing the configuration*/ 0xC0, /*bmAttributes: bus powered */ 0x32, /*MaxPower 100 mA: this current is used for detecting Vbus*/ /************** Descriptor of Joystick Mouse interface ****************/ /* 09 */ 0x09, /*bLength: Interface Descriptor size*/ USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/ 0x00, /*bInterfaceNumber: Number of Interface*/ 0x00, /*bAlternateSetting: Alternate setting*/ 0x02, /*bNumEndpoints*/ 0x03, /*bInterfaceClass: HID*/ 0x01, /*bInterfaceSubClass : 1=BOOT, 0=no boot*/ 0x01, /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/ , /*iInterface: Index of string descriptor*/ /******************** Descriptor of Joystick Mouse HID ********************/ /* 18 */ 0x09, /*bLength: HID Descriptor size*/ HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/ 0x00, /*bcdHID: HID Class Spec release number*/ 0x01, 0x00, /*bCountryCode: Hardware target country*/ 0x01, /*bNumDescriptors: Number of HID class descriptors to follow*/ 0x22, /*bDescriptorType*/ JOYSTICK_SIZ_REPORT_DESC,/*wItemLength: Total length of Report descriptor*/ 0x00, /******************** Descriptor of Joystick Mouse endpoint ********************/ /* 27 */ 0x07, /*bLength: Endpoint Descriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ 0x81, /*bEndpointAddress: Endpoint Address (IN)*/ 0x03, /*bmAttributes: Interrupt endpoint*/ 0x08, /*wMaxPacketSize: 4 Byte max */ 0x00, 0x20, /*bInterval: Polling Interval (32 ms)*/ /* 34 */ 0x07, /*bLength: Endpoint Descriptor size*/ USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ 0x01, /*bEndpointAddress: Endpoint Address (OUT)*/ 0x03, /*bmAttributes: Interrupt endpoint*/ 0x08, /*wMaxPacketSize: 8 Byte max */ 0x00, 0x05, //0x20 /*bInterval: Polling Interval (32 ms)*/ /* 41 */ } ; /* MOUSE_ConfigDescriptor */ const uint8_t Joystick_ReportDescriptor[JOYSTICK_SIZ_REPORT_DESC] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x06, // USAGE (Keyboard) 0xa1, 0x01, // COLLECTION (Application) 0x05, 0x07, // USAGE_PAGE (Keyboard/Keypad) 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x95, 0x08, // REPORT_COUNT (8) 0x75, 0x01, // REPORT_SIZE (1) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x08, // REPORT_SIZE (8) 0x81, 0x03, // INPUT (Cnst,Var,Abs) 0x95, 0x06, // REPORT_COUNT (6) 0x75, 0x08, // REPORT_SIZE (8) 0x25, 0xFF, // LOGICAL_MAXIMUM (255) 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) 0x81, 0x00, // INPUT (Data,Ary,Abs) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x95, 0x02, // REPORT_COUNT (2) 0x75, 0x01, // REPORT_SIZE (1) 0x05, 0x08, // USAGE_PAGE (LEDs) 0x19, 0x01, // USAGE_MINIMUM (Num Lock) 0x29, 0x02, // USAGE_MAXIMUM (Caps Lock) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x06, // REPORT_SIZE (6) 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) 0xc0 // END_COLLECTION } ; /* Joystick_ReportDescriptor */ /* USB String Descriptors (optional) */ const uint8_t Joystick_StringLangID[JOYSTICK_SIZ_STRING_LANGID] = { JOYSTICK_SIZ_STRING_LANGID, USB_STRING_DESCRIPTOR_TYPE, 0x09, 0x04 } ; /* LangID = 0x0409: U.S. English */
stm32 hid 键盘描述的更多相关文章
- HID 报告描述符精细说明.
1,报告描述符概述 1.1) 报表描述符 报表描述符和USB的其他描述符是不一样的,它不是一个简单的表格,报表描述符是USB所有描述符中最复杂的.报表描述符非常复杂而有弹性,因为它 ...
- USB小白学习之路(4)HID键盘程序
HID键盘程序 1. 特别注意 需要特别注意,各个例程中的设备描述符,配置描述符等各种描述符都是已经配置好了的,我们需要做的只是在例程中将代码修改为自己需要的部分即可,一般情况下是不可以串搭配的. 2 ...
- 从头调试stm32 HID
目录: 第1部分:参照“正点原子USB虚拟串口工程移植步骤”移植ST的USB HID工程(失败了): 第2部分:在1的基础上,替换USB HID初始化代码为ST 例程中的代码,编译后根据报错调试(失败 ...
- 关于USBHID协议以及鼠标键盘描述符的解释【转】
转自:https://blog.csdn.net/jiujiujiuqiuqiuqiu/article/details/47277685 一.HID设备识别 前面有提到关于SCSI协议的USB设备实现 ...
- 基于STM32 HID 游戏手柄开发调试
stm32自带usb接口,非常适合做hid设备,免驱开发也很方便. 使用stm32通过正确的报告描述符配置后,插入usb,电脑正确识别如下(设备和打印机) 可以通过右键,游戏控制器设置 通过选择属性 ...
- 浅析USB HID ReportDesc (HID报告描述符)
在USB中,USB Host是通过各种描述符来识别识别设备的,一般在设备枚举的过程将会获取有设备描述符/配置描述符/接口描述符/端点描述符/字符串描述符等 现在我们来介绍一下HID ReportDes ...
- stm32矩阵键盘扫描数据通过USB发送
Keyboard.c #include "keyboard.h"#include "my_usb.h"#include " ...
- USB HID Report Descriptor 报告描述符详解
Report descriptors are composed of pieces of information. Each piece of information is called an Ite ...
- STM32实现HID和u盘复合设备
USB设备可以定义一个复合设备,复合设备分两种,一种是一个设备多个配置,还有一种是一个配置多个接口,在本例中采用一个配置多个接口的方式 首先修改设备描述符,标准设备描述符和报告描述符都不需要修改, ...
随机推荐
- phpcurl 请求Chunked-Encoded data 遇到的一个问题
最早出现的问题情况是提供es的部门在es的外部封装了一个gateway做请求中转. 当我们转换到gateway上之后,发现了问题: 有的请求可以获取到数据,有的请求获取不到数据. 仔细分析了业务代码, ...
- ios7.1 in-house app的发布方法
iOS7.1版本的in-house app必须发布到https站点才能下载安装,原来的连接: itms-services://?action=download-manifest&url=htt ...
- XML 动态 插入 父类标示 子类标示
由于第一次写博客,写的不好的地方,还请各位大神多多指点, 讲解一下:xml动态插入数据并保存,写这个时候费了我不少劲,最后终于皇天不负有心人让我搞出来了,特意分享给大家,写的不完美的地方还请大家多多指 ...
- 类型转换及返回json对象的问题
@ResponseBody @RequestMapping(value="/user/getUserId.do")//method=RequestMethod.POST publi ...
- Python爬取代理ip
# -*- coding:utf-8 -*- #author : willowj import urllib import urllib2 from bs4 import BeautifulSoup ...
- 【linux草鞋应用编程系列】_4_ 应用程序多线程
一.应用程序多线程 当一个计算机上具有多个CPU核心的时候,每个CPU核心都可以执行代码,此时如果使用单线程,那么这个线程只能在一个 CPU上运行,那么其他的CPU核心就处于空闲状态,浪费了系 ...
- powershell脚本,命令行参数传值,并绑定变量的例子
这是小技巧文章,所以文章不长.但原创唯一,非常重要.我搜了下,还真没有人发 powershell怎样 [命令行 参数 绑定],所以我决定写成博客. 搜索关键字如下: powershell 命令行 参数 ...
- XSS跨站测试代码大全
'><script>alert(document.cookie)</script>='><script>alert(document.cookie)&l ...
- ArcGIS API for Silverlight 使用GeometryService求解线与线的交点
///画线 void btn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Button btn = sender as B ...
- iOS HTML 字符串中的图片 自适应大小
本文原文地址:http://www.cnblogs.com/qianLL/p/6095988.html 有时候 我们接收数据的时候 后台给的数据室一串HTML 的字符串 但是 我们要显示出来 这 ...