Committer:
chris
Date:
Thu Oct 20 14:07:30 2011 +0000
Revision:
0:e98d1c2b16c6

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:e98d1c2b16c6 1 /* USBKeyboard.c */
chris 0:e98d1c2b16c6 2 /* USB device example: Standard keyboard */
chris 0:e98d1c2b16c6 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
chris 0:e98d1c2b16c6 4
chris 0:e98d1c2b16c6 5 #include "stdint.h"
chris 0:e98d1c2b16c6 6
chris 0:e98d1c2b16c6 7 #include "USBKeyboard.h"
chris 0:e98d1c2b16c6 8
chris 0:e98d1c2b16c6 9 /*
chris 0:e98d1c2b16c6 10 * Descriptors
chris 0:e98d1c2b16c6 11 */
chris 0:e98d1c2b16c6 12
chris 0:e98d1c2b16c6 13 uint8_t * USBKeyboard::ReportDesc() {
chris 0:e98d1c2b16c6 14 static uint8_t reportDescriptor[] = {
chris 0:e98d1c2b16c6 15
chris 0:e98d1c2b16c6 16 /* Based on Appendix E.6 of "Device Class Definition for Human Interface
chris 0:e98d1c2b16c6 17 Devices (HID)" Version 1.11. */
chris 0:e98d1c2b16c6 18
chris 0:e98d1c2b16c6 19 USAGE_PAGE(1), 0x01, /* Generic Desktop */
chris 0:e98d1c2b16c6 20 USAGE(1), 0x06, /* Keyboard */
chris 0:e98d1c2b16c6 21 COLLECTION(1), 0x01, /* Application*/
chris 0:e98d1c2b16c6 22 REPORT_ID(1), REPORT_ID_KEYBOARD,
chris 0:e98d1c2b16c6 23
chris 0:e98d1c2b16c6 24 USAGE_PAGE(1), 0x07, /* Key Codes */
chris 0:e98d1c2b16c6 25 USAGE_MINIMUM(1), 0xE0,
chris 0:e98d1c2b16c6 26 USAGE_MAXIMUM(1), 0xE7,
chris 0:e98d1c2b16c6 27 LOGICAL_MINIMUM(1), 0x00,
chris 0:e98d1c2b16c6 28 LOGICAL_MAXIMUM(1), 0x01,
chris 0:e98d1c2b16c6 29 REPORT_SIZE(1), 0x01,
chris 0:e98d1c2b16c6 30 REPORT_COUNT(1), 0x08,
chris 0:e98d1c2b16c6 31 INPUT(1), 0x02, /* Data, Variable, Absolute */
chris 0:e98d1c2b16c6 32 REPORT_COUNT(1), 0x01,
chris 0:e98d1c2b16c6 33 REPORT_SIZE(1), 0x08,
chris 0:e98d1c2b16c6 34 INPUT(1), 0x01, /* Constant */
chris 0:e98d1c2b16c6 35 REPORT_COUNT(1), 0x05,
chris 0:e98d1c2b16c6 36 REPORT_SIZE(1), 0x01,
chris 0:e98d1c2b16c6 37
chris 0:e98d1c2b16c6 38
chris 0:e98d1c2b16c6 39 USAGE_PAGE(1), 0x08, /* LEDs */
chris 0:e98d1c2b16c6 40 USAGE_MINIMUM(1), 0x01,
chris 0:e98d1c2b16c6 41 USAGE_MAXIMUM(1), 0x05,
chris 0:e98d1c2b16c6 42 OUTPUT(1), 0x02, /* Data, Variable, Absolute */
chris 0:e98d1c2b16c6 43 REPORT_COUNT(1), 0x01,
chris 0:e98d1c2b16c6 44 REPORT_SIZE(1), 0x03,
chris 0:e98d1c2b16c6 45 OUTPUT(1), 0x01, /* Constant */
chris 0:e98d1c2b16c6 46 REPORT_COUNT(1), 0x06,
chris 0:e98d1c2b16c6 47 REPORT_SIZE(1), 0x08,
chris 0:e98d1c2b16c6 48 LOGICAL_MINIMUM(1), 0x00,
chris 0:e98d1c2b16c6 49 LOGICAL_MAXIMUM(1), 0x65,
chris 0:e98d1c2b16c6 50
chris 0:e98d1c2b16c6 51
chris 0:e98d1c2b16c6 52 USAGE_PAGE(1), 0x07, /* Key Codes */
chris 0:e98d1c2b16c6 53 USAGE_MINIMUM(1), 0x00,
chris 0:e98d1c2b16c6 54 USAGE_MAXIMUM(1), 0x65,
chris 0:e98d1c2b16c6 55 INPUT(1), 0x00, /* Data, Array */
chris 0:e98d1c2b16c6 56 END_COLLECTION(0),
chris 0:e98d1c2b16c6 57
chris 0:e98d1c2b16c6 58 /* Media Control */
chris 0:e98d1c2b16c6 59 USAGE_PAGE(1), 0x0C,
chris 0:e98d1c2b16c6 60 USAGE(1), 0x01,
chris 0:e98d1c2b16c6 61 COLLECTION(1), 0x01,
chris 0:e98d1c2b16c6 62 REPORT_ID(1), REPORT_ID_VOLUME,
chris 0:e98d1c2b16c6 63 USAGE_PAGE(1), 0x0C,
chris 0:e98d1c2b16c6 64 LOGICAL_MINIMUM(1), 0x00,
chris 0:e98d1c2b16c6 65 LOGICAL_MAXIMUM(1), 0x01,
chris 0:e98d1c2b16c6 66 REPORT_SIZE(1), 0x01,
chris 0:e98d1c2b16c6 67 REPORT_COUNT(1), 0x07,
chris 0:e98d1c2b16c6 68 USAGE(1), 0xB5, /* Next Track */
chris 0:e98d1c2b16c6 69 USAGE(1), 0xB6, /* Previous Track */
chris 0:e98d1c2b16c6 70 USAGE(1), 0xB7, /* Stop */
chris 0:e98d1c2b16c6 71 USAGE(1), 0xCD, /* Play / Pause */
chris 0:e98d1c2b16c6 72 USAGE(1), 0xE2, /* Mute */
chris 0:e98d1c2b16c6 73 USAGE(1), 0xE9, /* Volume Up */
chris 0:e98d1c2b16c6 74 USAGE(1), 0xEA, /* Volume Down */
chris 0:e98d1c2b16c6 75 INPUT(1), 0x02, /* Input (Data, Variable, Absolute) */
chris 0:e98d1c2b16c6 76 REPORT_COUNT(1), 0x01,
chris 0:e98d1c2b16c6 77 INPUT(1), 0x01,
chris 0:e98d1c2b16c6 78 END_COLLECTION(0),
chris 0:e98d1c2b16c6 79
chris 0:e98d1c2b16c6 80 };
chris 0:e98d1c2b16c6 81 reportLength = sizeof(reportDescriptor);
chris 0:e98d1c2b16c6 82 return reportDescriptor;
chris 0:e98d1c2b16c6 83 }