USB Mouse (relative) example for mbed NXP LPC11U24 beta
HID_devices/USBRawHID.c@0:163560051396, 2011-10-24 (annotated)
- Committer:
- chris
- Date:
- Mon Oct 24 10:26:27 2011 +0000
- Revision:
- 0:163560051396
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:163560051396 | 1 | /* USBMouse.c */ |
chris | 0:163560051396 | 2 | /* USB device example: Relative mouse */ |
chris | 0:163560051396 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
chris | 0:163560051396 | 4 | |
chris | 0:163560051396 | 5 | #include "USBRawHID.h" |
chris | 0:163560051396 | 6 | |
chris | 0:163560051396 | 7 | /* |
chris | 0:163560051396 | 8 | * Descriptors |
chris | 0:163560051396 | 9 | */ |
chris | 0:163560051396 | 10 | |
chris | 0:163560051396 | 11 | #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF |
chris | 0:163560051396 | 12 | #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF |
chris | 0:163560051396 | 13 | |
chris | 0:163560051396 | 14 | uint8_t * USBRawHID::ReportDesc() { |
chris | 0:163560051396 | 15 | static uint8_t reportDescriptor[] = { |
chris | 0:163560051396 | 16 | |
chris | 0:163560051396 | 17 | /* Based on Appendix E.10 of "Device Class Definition for Human Interface |
chris | 0:163560051396 | 18 | Devices (HID)" Version 1.11. */ |
chris | 0:163560051396 | 19 | |
chris | 0:163560051396 | 20 | 0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE), |
chris | 0:163560051396 | 21 | 0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE), |
chris | 0:163560051396 | 22 | 0xA1, 0x01, // Collection 0x01 |
chris | 0:163560051396 | 23 | 0x75, 0x08, // report size = 8 bits |
chris | 0:163560051396 | 24 | 0x15, 0x00, // logical minimum = 0 |
chris | 0:163560051396 | 25 | 0x26, 0xFF, 0x00, // logical maximum = 255 |
chris | 0:163560051396 | 26 | 0x95, 64, // report count |
chris | 0:163560051396 | 27 | 0x09, 0x01, // usage |
chris | 0:163560051396 | 28 | 0x81, 0x02, // Input (array) |
chris | 0:163560051396 | 29 | 0xC0 // end collection |
chris | 0:163560051396 | 30 | }; |
chris | 0:163560051396 | 31 | reportLength = sizeof(reportDescriptor); |
chris | 0:163560051396 | 32 | return reportDescriptor; |
chris | 0:163560051396 | 33 | } |
chris | 0:163560051396 | 34 |