ME11B Sample Code in Maxim Integrated Team

Dependencies:   BMI160 max32630hsp3 MemoryLCD USBDevice

Fork of Host_Software_MAX32664GWEB_HR_EXTENDED by Seyhmus Cacina

Committer:
seyhmus.cacina
Date:
Mon Mar 18 10:21:53 2019 +0300
Revision:
0:ac4dea3e2894
ME11B Sample Code First Commit

Who changed what in which revision?

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