USB Mouse (relative) example for mbed NXP LPC11U24 beta

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBRawHID.c Source File

USBRawHID.c

00001 /* USBMouse.c */
00002 /* USB device example: Relative mouse */
00003 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
00004 
00005 #include "USBRawHID.h"
00006 
00007 /*
00008  *  Descriptors
00009  */
00010  
00011 #define RAWHID_USAGE_PAGE   0xFFAB  // recommended: 0xFF00 to 0xFFFF
00012 #define RAWHID_USAGE        0x0200  // recommended: 0x0100 to 0xFFFF
00013 
00014 uint8_t * USBRawHID::ReportDesc() {
00015     static uint8_t reportDescriptor[] = {
00016 
00017         /* Based on Appendix E.10 of "Device Class Definition for Human Interface
00018            Devices (HID)" Version 1.11. */
00019 
00020     0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE),
00021     0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE),
00022     0xA1, 0x01,             // Collection 0x01
00023     0x75, 0x08,             // report size = 8 bits
00024     0x15, 0x00,             // logical minimum = 0
00025     0x26, 0xFF, 0x00,           // logical maximum = 255
00026     0x95, 64,           // report count
00027     0x09, 0x01,             // usage
00028     0x81, 0x02,             // Input (array)
00029     0xC0                    // end collection
00030     };
00031     reportLength = sizeof(reportDescriptor);
00032     return reportDescriptor;
00033 }
00034