Based on the example USB HID keyboard https://developer.mbed.org/users/jbru/code/BLE_HID_KeyboardStreamDemo/
Dependencies: BLE_API mbed nRF51822
Fork of HID-kb by
HID_types.h
00001 /* Copyright (c) 2015 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 * 00018 * Note: this file was pulled from the USBHID library, in mbed SDK 00019 */ 00020 00021 #ifndef USBCLASS_HID_TYPES 00022 #define USBCLASS_HID_TYPES 00023 00024 #include <stdint.h> 00025 00026 #pragma pack(push, 1) 00027 typedef struct { 00028 uint8_t vendorID_source; 00029 uint16_t vendorID; 00030 uint16_t productID; 00031 uint16_t productVersion; 00032 } PnPID_t; 00033 #pragma pack(pop) 00034 00035 /* */ 00036 #define HID_VERSION_1_11 (0x0111) 00037 00038 /* HID Class */ 00039 #define HID_CLASS (3) 00040 #define HID_SUBCLASS_NONE (0) 00041 #define HID_PROTOCOL_NONE (0) 00042 00043 /* Descriptors */ 00044 #define HID_DESCRIPTOR (33) 00045 #define HID_DESCRIPTOR_LENGTH (0x09) 00046 #define REPORT_DESCRIPTOR (34) 00047 00048 /* Class requests */ 00049 #define GET_REPORT (0x1) 00050 #define GET_IDLE (0x2) 00051 #define SET_REPORT (0x9) 00052 #define SET_IDLE (0xa) 00053 00054 /* HID Class Report Descriptor */ 00055 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */ 00056 /* of data as per HID Class standard */ 00057 00058 /* Main items */ 00059 #define INPUT(size) (0x80 | size) 00060 #define OUTPUT(size) (0x90 | size) 00061 #define FEATURE(size) (0xb0 | size) 00062 #define COLLECTION(size) (0xa0 | size) 00063 #define END_COLLECTION(size) (0xc0 | size) 00064 00065 /* Global items */ 00066 #define USAGE_PAGE(size) (0x04 | size) 00067 #define LOGICAL_MINIMUM(size) (0x14 | size) 00068 #define LOGICAL_MAXIMUM(size) (0x24 | size) 00069 #define PHYSICAL_MINIMUM(size) (0x34 | size) 00070 #define PHYSICAL_MAXIMUM(size) (0x44 | size) 00071 #define UNIT_EXPONENT(size) (0x54 | size) 00072 #define UNIT(size) (0x64 | size) 00073 #define REPORT_SIZE(size) (0x74 | size) 00074 #define REPORT_ID(size) (0x84 | size) 00075 #define REPORT_COUNT(size) (0x94 | size) 00076 #define PUSH(size) (0xa4 | size) 00077 #define POP(size) (0xb4 | size) 00078 00079 /* Local items */ 00080 #define USAGE(size) (0x08 | size) 00081 #define USAGE_MINIMUM(size) (0x18 | size) 00082 #define USAGE_MAXIMUM(size) (0x28 | size) 00083 #define DESIGNATOR_INDEX(size) (0x38 | size) 00084 #define DESIGNATOR_MINIMUM(size) (0x48 | size) 00085 #define DESIGNATOR_MAXIMUM(size) (0x58 | size) 00086 #define STRING_INDEX(size) (0x78 | size) 00087 #define STRING_MINIMUM(size) (0x88 | size) 00088 #define STRING_MAXIMUM(size) (0x98 | size) 00089 #define DELIMITER(size) (0xa8 | size) 00090 00091 /* HID Report */ 00092 /* Where report IDs are used the first byte of 'data' will be the */ 00093 /* report ID and 'length' will include this report ID byte. */ 00094 00095 #define MAX_HID_REPORT_SIZE (64) 00096 00097 typedef struct { 00098 uint32_t length; 00099 uint8_t data[MAX_HID_REPORT_SIZE]; 00100 } HID_REPORT; 00101 00102 #endif 00103 00104
Generated on Tue Jul 12 2022 11:10:40 by 1.7.2