NimBLE-Arduino
2.1.2
Loading...
Searching...
No Matches
HIDTypes.h
1
/* Copyright (c) 2010-2011 mbed.org, MIT License
2
*
3
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
* and associated documentation files (the "Software"), to deal in the Software without
5
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
6
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
* Software is furnished to do so, subject to the following conditions:
8
*
9
* The above copyright notice and this permission notice shall be included in all copies or
10
* substantial portions of the Software.
11
*
12
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
13
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
*/
18
19
#ifndef USBCLASS_HID_TYPES
20
#define USBCLASS_HID_TYPES
21
22
#include <stdint.h>
23
24
/* */
25
#define HID_VERSION_1_11 (0x0111)
26
27
/* HID Class */
28
#define BLE_HID_CLASS (3)
29
#define BLE_HID_SUBCLASS_NONE (0)
30
#define BLE_HID_PROTOCOL_NONE (0)
31
32
/* Descriptors */
33
#define HID_DESCRIPTOR (33)
34
#define HID_DESCRIPTOR_LENGTH (0x09)
35
#define REPORT_DESCRIPTOR (34)
36
37
/* Class requests */
38
#define GET_REPORT (0x1)
39
#define GET_IDLE (0x2)
40
#define SET_REPORT (0x9)
41
#define SET_IDLE (0xa)
42
43
/* HID Class Report Descriptor */
44
/* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
45
/* of data as per HID Class standard */
46
47
/* Main items */
48
#define HIDINPUT(size) (0x80 | size)
49
#define HIDOUTPUT(size) (0x90 | size)
50
#define FEATURE(size) (0xb0 | size)
51
#define COLLECTION(size) (0xa0 | size)
52
#define END_COLLECTION(size) (0xc0 | size)
53
54
/* Global items */
55
#define USAGE_PAGE(size) (0x04 | size)
56
#define LOGICAL_MINIMUM(size) (0x14 | size)
57
#define LOGICAL_MAXIMUM(size) (0x24 | size)
58
#define PHYSICAL_MINIMUM(size) (0x34 | size)
59
#define PHYSICAL_MAXIMUM(size) (0x44 | size)
60
#define UNIT_EXPONENT(size) (0x54 | size)
61
#define UNIT(size) (0x64 | size)
62
#define REPORT_SIZE(size) (0x74 | size)
//bits
63
#define REPORT_ID(size) (0x84 | size)
64
#define REPORT_COUNT(size) (0x94 | size)
//bytes
65
#define PUSH(size) (0xa4 | size)
66
#define POP(size) (0xb4 | size)
67
68
/* Local items */
69
#define USAGE(size) (0x08 | size)
70
#define USAGE_MINIMUM(size) (0x18 | size)
71
#define USAGE_MAXIMUM(size) (0x28 | size)
72
#define DESIGNATOR_INDEX(size) (0x38 | size)
73
#define DESIGNATOR_MINIMUM(size) (0x48 | size)
74
#define DESIGNATOR_MAXIMUM(size) (0x58 | size)
75
#define STRING_INDEX(size) (0x78 | size)
76
#define STRING_MINIMUM(size) (0x88 | size)
77
#define STRING_MAXIMUM(size) (0x98 | size)
78
#define DELIMITER(size) (0xa8 | size)
79
80
/* HID Report */
81
/* Where report IDs are used the first byte of 'data' will be the */
82
/* report ID and 'length' will include this report ID byte. */
83
84
#define MAX_HID_REPORT_SIZE (64)
85
86
typedef
struct
{
87
uint32_t length;
88
uint8_t data[MAX_HID_REPORT_SIZE];
89
} HID_REPORT;
90
91
#endif
src
HIDTypes.h
Generated by
1.9.8