Keyboard firmwares for Atmel AVR and Cortex-M
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

descriptor.c 23KB

Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
Squashed 'tmk_core/' changes from 8da1898..e5f9940 e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc1284176834cbe7ca2134e4b36bec5828' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa1311dfa0b58ba882a96db740640871' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
7 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. /*
  2. * Copyright 2012 Jun Wako <[email protected]>
  3. * This file is based on:
  4. * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse
  5. * LUFA-120219/Demos/Device/Lowlevel/GenericHID
  6. */
  7. /*
  8. LUFA Library
  9. Copyright (C) Dean Camera, 2012.
  10. dean [at] fourwalledcubicle [dot] com
  11. www.lufa-lib.org
  12. */
  13. /*
  14. Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  15. Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
  16. Permission to use, copy, modify, distribute, and sell this
  17. software and its documentation for any purpose is hereby granted
  18. without fee, provided that the above copyright notice appear in
  19. all copies and that both that the copyright notice and this
  20. permission notice and warranty disclaimer appear in supporting
  21. documentation, and that the name of the author not be used in
  22. advertising or publicity pertaining to distribution of the
  23. software without specific, written prior permission.
  24. The author disclaim all warranties with regard to this
  25. software, including all implied warranties of merchantability
  26. and fitness. In no event shall the author be liable for any
  27. special, indirect or consequential damages or any damages
  28. whatsoever resulting from loss of use, data or profits, whether
  29. in an action of contract, negligence or other tortious action,
  30. arising out of or in connection with the use or performance of
  31. this software.
  32. */
  33. #include "util.h"
  34. #include "report.h"
  35. #include "descriptor.h"
  36. /*******************************************************************************
  37. * HID Report Descriptors
  38. ******************************************************************************/
  39. const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
  40. {
  41. HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
  42. HID_RI_USAGE(8, 0x06), /* Keyboard */
  43. HID_RI_COLLECTION(8, 0x01), /* Application */
  44. HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */
  45. HID_RI_USAGE_MINIMUM(8, 0xE0), /* Keyboard Left Control */
  46. HID_RI_USAGE_MAXIMUM(8, 0xE7), /* Keyboard Right GUI */
  47. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  48. HID_RI_LOGICAL_MAXIMUM(8, 0x01),
  49. HID_RI_REPORT_COUNT(8, 0x08),
  50. HID_RI_REPORT_SIZE(8, 0x01),
  51. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
  52. HID_RI_REPORT_COUNT(8, 0x01),
  53. HID_RI_REPORT_SIZE(8, 0x08),
  54. HID_RI_INPUT(8, HID_IOF_CONSTANT), /* reserved */
  55. HID_RI_USAGE_PAGE(8, 0x08), /* LEDs */
  56. HID_RI_USAGE_MINIMUM(8, 0x01), /* Num Lock */
  57. HID_RI_USAGE_MAXIMUM(8, 0x05), /* Kana */
  58. HID_RI_REPORT_COUNT(8, 0x05),
  59. HID_RI_REPORT_SIZE(8, 0x01),
  60. HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
  61. HID_RI_REPORT_COUNT(8, 0x01),
  62. HID_RI_REPORT_SIZE(8, 0x03),
  63. HID_RI_OUTPUT(8, HID_IOF_CONSTANT),
  64. HID_RI_USAGE_PAGE(8, 0x07), /* Keyboard */
  65. HID_RI_USAGE_MINIMUM(8, 0x00),
  66. HID_RI_USAGE_MAXIMUM(8, 0xFF), /* Usage ID 0x00-0xFF */
  67. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  68. HID_RI_LOGICAL_MAXIMUM(16, 0x00FF), /* needs 16 bit to indicate positive value */
  69. HID_RI_REPORT_COUNT(8, 0x06),
  70. HID_RI_REPORT_SIZE(8, 0x08),
  71. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
  72. HID_RI_END_COLLECTION(0),
  73. };
  74. #ifdef MOUSE_ENABLE
  75. const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
  76. {
  77. HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
  78. HID_RI_USAGE(8, 0x02), /* Mouse */
  79. HID_RI_COLLECTION(8, 0x01), /* Application */
  80. HID_RI_USAGE(8, 0x01), /* Pointer */
  81. HID_RI_COLLECTION(8, 0x00), /* Physical */
  82. HID_RI_USAGE_PAGE(8, 0x09), /* Button */
  83. HID_RI_USAGE_MINIMUM(8, 0x01), /* Button 1 */
  84. HID_RI_USAGE_MAXIMUM(8, 0x05), /* Button 5 */
  85. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  86. HID_RI_LOGICAL_MAXIMUM(8, 0x01),
  87. HID_RI_REPORT_COUNT(8, 0x05),
  88. HID_RI_REPORT_SIZE(8, 0x01),
  89. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
  90. HID_RI_REPORT_COUNT(8, 0x01),
  91. HID_RI_REPORT_SIZE(8, 0x03),
  92. HID_RI_INPUT(8, HID_IOF_CONSTANT),
  93. HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
  94. HID_RI_USAGE(8, 0x30), /* Usage X */
  95. HID_RI_USAGE(8, 0x31), /* Usage Y */
  96. HID_RI_LOGICAL_MINIMUM(8, -127),
  97. HID_RI_LOGICAL_MAXIMUM(8, 127),
  98. HID_RI_REPORT_COUNT(8, 0x02),
  99. HID_RI_REPORT_SIZE(8, 0x08),
  100. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
  101. HID_RI_USAGE(8, 0x38), /* Wheel */
  102. HID_RI_LOGICAL_MINIMUM(8, -127),
  103. HID_RI_LOGICAL_MAXIMUM(8, 127),
  104. HID_RI_REPORT_COUNT(8, 0x01),
  105. HID_RI_REPORT_SIZE(8, 0x08),
  106. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
  107. HID_RI_USAGE_PAGE(8, 0x0C), /* Consumer */
  108. HID_RI_USAGE(16, 0x0238), /* AC Pan (Horizontal wheel) */
  109. HID_RI_LOGICAL_MINIMUM(8, -127),
  110. HID_RI_LOGICAL_MAXIMUM(8, 127),
  111. HID_RI_REPORT_COUNT(8, 0x01),
  112. HID_RI_REPORT_SIZE(8, 0x08),
  113. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE),
  114. HID_RI_END_COLLECTION(0),
  115. HID_RI_END_COLLECTION(0),
  116. };
  117. #endif
  118. #ifdef EXTRAKEY_ENABLE
  119. const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
  120. {
  121. HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
  122. HID_RI_USAGE(8, 0x80), /* System Control */
  123. HID_RI_COLLECTION(8, 0x01), /* Application */
  124. HID_RI_REPORT_ID(8, REPORT_ID_SYSTEM),
  125. HID_RI_LOGICAL_MINIMUM(16, 0x0081),
  126. HID_RI_LOGICAL_MAXIMUM(16, 0x00B7),
  127. HID_RI_USAGE_MINIMUM(16, 0x0081), /* System Power Down */
  128. HID_RI_USAGE_MAXIMUM(16, 0x00B7), /* System Display LCD Autoscale */
  129. HID_RI_REPORT_SIZE(8, 16),
  130. HID_RI_REPORT_COUNT(8, 1),
  131. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
  132. HID_RI_END_COLLECTION(0),
  133. HID_RI_USAGE_PAGE(8, 0x0C), /* Consumer */
  134. HID_RI_USAGE(8, 0x01), /* Consumer Control */
  135. HID_RI_COLLECTION(8, 0x01), /* Application */
  136. HID_RI_REPORT_ID(8, REPORT_ID_CONSUMER),
  137. HID_RI_LOGICAL_MINIMUM(16, 0x0001),
  138. HID_RI_LOGICAL_MAXIMUM(16, 0x029C),
  139. HID_RI_USAGE_MINIMUM(16, 0x0001), /* +10 */
  140. HID_RI_USAGE_MAXIMUM(16, 0x029C), /* AC Distribute Vertically */
  141. HID_RI_REPORT_SIZE(8, 16),
  142. HID_RI_REPORT_COUNT(8, 1),
  143. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
  144. HID_RI_END_COLLECTION(0),
  145. };
  146. #endif
  147. #ifdef CONSOLE_ENABLE
  148. const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
  149. {
  150. HID_RI_USAGE_PAGE(16, 0xFF31), /* Vendor Page(PJRC Teensy compatible) */
  151. HID_RI_USAGE(8, 0x74), /* Vendor Usage(PJRC Teensy compatible) */
  152. HID_RI_COLLECTION(8, 0x01), /* Application */
  153. HID_RI_USAGE(8, 0x75), /* Vendor Usage 0x75 */
  154. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  155. HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
  156. HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
  157. HID_RI_REPORT_SIZE(8, 0x08),
  158. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
  159. HID_RI_USAGE(8, 0x76), /* Vendor Usage 0x76 */
  160. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  161. HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
  162. HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE),
  163. HID_RI_REPORT_SIZE(8, 0x08),
  164. HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
  165. HID_RI_END_COLLECTION(0),
  166. };
  167. #endif
  168. #ifdef NKRO_ENABLE
  169. const USB_Descriptor_HIDReport_Datatype_t PROGMEM NKROReport[] =
  170. {
  171. HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
  172. HID_RI_USAGE(8, 0x06), /* Keyboard */
  173. HID_RI_COLLECTION(8, 0x01), /* Application */
  174. HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */
  175. HID_RI_USAGE_MINIMUM(8, 0xE0), /* Keyboard Left Control */
  176. HID_RI_USAGE_MAXIMUM(8, 0xE7), /* Keyboard Right GUI */
  177. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  178. HID_RI_LOGICAL_MAXIMUM(8, 0x01),
  179. HID_RI_REPORT_COUNT(8, 0x08),
  180. HID_RI_REPORT_SIZE(8, 0x01),
  181. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
  182. HID_RI_USAGE_PAGE(8, 0x08), /* LEDs */
  183. HID_RI_USAGE_MINIMUM(8, 0x01), /* Num Lock */
  184. HID_RI_USAGE_MAXIMUM(8, 0x05), /* Kana */
  185. HID_RI_REPORT_COUNT(8, 0x05),
  186. HID_RI_REPORT_SIZE(8, 0x01),
  187. HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
  188. HID_RI_REPORT_COUNT(8, 0x01),
  189. HID_RI_REPORT_SIZE(8, 0x03),
  190. HID_RI_OUTPUT(8, HID_IOF_CONSTANT),
  191. HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */
  192. HID_RI_USAGE_MINIMUM(8, 0x00), /* Keyboard 0 */
  193. HID_RI_USAGE_MAXIMUM(8, (NKRO_EPSIZE-1)*8-1), /* Keyboard Right GUI */
  194. HID_RI_LOGICAL_MINIMUM(8, 0x00),
  195. HID_RI_LOGICAL_MAXIMUM(8, 0x01),
  196. HID_RI_REPORT_COUNT(8, (NKRO_EPSIZE-1)*8),
  197. HID_RI_REPORT_SIZE(8, 0x01),
  198. HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
  199. HID_RI_END_COLLECTION(0),
  200. };
  201. #endif
  202. /*******************************************************************************
  203. * Device Descriptors
  204. ******************************************************************************/
  205. const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
  206. {
  207. .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
  208. .USBSpecification = VERSION_BCD(1,1,0),
  209. .Class = USB_CSCP_NoDeviceClass,
  210. .SubClass = USB_CSCP_NoDeviceSubclass,
  211. .Protocol = USB_CSCP_NoDeviceProtocol,
  212. .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
  213. /* specified in config.h */
  214. .VendorID = VENDOR_ID,
  215. .ProductID = PRODUCT_ID,
  216. .ReleaseNumber = DEVICE_VER,
  217. .ManufacturerStrIndex = 0x01,
  218. .ProductStrIndex = 0x02,
  219. .SerialNumStrIndex = NO_DESCRIPTOR,
  220. .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
  221. };
  222. /*******************************************************************************
  223. * Configuration Descriptors
  224. ******************************************************************************/
  225. const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
  226. {
  227. .Config =
  228. {
  229. .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
  230. .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
  231. .TotalInterfaces = TOTAL_INTERFACES,
  232. .ConfigurationNumber = 1,
  233. .ConfigurationStrIndex = NO_DESCRIPTOR,
  234. .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_REMOTEWAKEUP),
  235. .MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
  236. },
  237. /*
  238. * Keyboard
  239. */
  240. .Keyboard_Interface =
  241. {
  242. .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  243. .InterfaceNumber = KEYBOARD_INTERFACE,
  244. .AlternateSetting = 0x00,
  245. .TotalEndpoints = 1,
  246. .Class = HID_CSCP_HIDClass,
  247. .SubClass = HID_CSCP_BootSubclass,
  248. .Protocol = HID_CSCP_KeyboardBootProtocol,
  249. .InterfaceStrIndex = NO_DESCRIPTOR
  250. },
  251. .Keyboard_HID =
  252. {
  253. .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
  254. .HIDSpec = VERSION_BCD(1,1,1),
  255. .CountryCode = 0x00,
  256. .TotalReportDescriptors = 1,
  257. .HIDReportType = HID_DTYPE_Report,
  258. .HIDReportLength = sizeof(KeyboardReport)
  259. },
  260. .Keyboard_INEndpoint =
  261. {
  262. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  263. .EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
  264. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  265. .EndpointSize = KEYBOARD_EPSIZE,
  266. .PollingIntervalMS = 0x0A
  267. },
  268. /*
  269. * Mouse
  270. */
  271. #ifdef MOUSE_ENABLE
  272. .Mouse_Interface =
  273. {
  274. .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  275. .InterfaceNumber = MOUSE_INTERFACE,
  276. .AlternateSetting = 0x00,
  277. .TotalEndpoints = 1,
  278. .Class = HID_CSCP_HIDClass,
  279. .SubClass = HID_CSCP_BootSubclass,
  280. .Protocol = HID_CSCP_MouseBootProtocol,
  281. .InterfaceStrIndex = NO_DESCRIPTOR
  282. },
  283. .Mouse_HID =
  284. {
  285. .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
  286. .HIDSpec = VERSION_BCD(1,1,1),
  287. .CountryCode = 0x00,
  288. .TotalReportDescriptors = 1,
  289. .HIDReportType = HID_DTYPE_Report,
  290. .HIDReportLength = sizeof(MouseReport)
  291. },
  292. .Mouse_INEndpoint =
  293. {
  294. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  295. .EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
  296. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  297. .EndpointSize = MOUSE_EPSIZE,
  298. .PollingIntervalMS = 0x0A
  299. },
  300. #endif
  301. /*
  302. * Extra
  303. */
  304. #ifdef EXTRAKEY_ENABLE
  305. .Extrakey_Interface =
  306. {
  307. .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  308. .InterfaceNumber = EXTRAKEY_INTERFACE,
  309. .AlternateSetting = 0x00,
  310. .TotalEndpoints = 1,
  311. .Class = HID_CSCP_HIDClass,
  312. .SubClass = HID_CSCP_NonBootSubclass,
  313. .Protocol = HID_CSCP_NonBootProtocol,
  314. .InterfaceStrIndex = NO_DESCRIPTOR
  315. },
  316. .Extrakey_HID =
  317. {
  318. .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
  319. .HIDSpec = VERSION_BCD(1,1,1),
  320. .CountryCode = 0x00,
  321. .TotalReportDescriptors = 1,
  322. .HIDReportType = HID_DTYPE_Report,
  323. .HIDReportLength = sizeof(ExtrakeyReport)
  324. },
  325. .Extrakey_INEndpoint =
  326. {
  327. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  328. .EndpointAddress = (ENDPOINT_DIR_IN | EXTRAKEY_IN_EPNUM),
  329. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  330. .EndpointSize = EXTRAKEY_EPSIZE,
  331. .PollingIntervalMS = 0x0A
  332. },
  333. #endif
  334. /*
  335. * Console
  336. */
  337. #ifdef CONSOLE_ENABLE
  338. .Console_Interface =
  339. {
  340. .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  341. .InterfaceNumber = CONSOLE_INTERFACE,
  342. .AlternateSetting = 0x00,
  343. .TotalEndpoints = 2,
  344. .Class = HID_CSCP_HIDClass,
  345. .SubClass = HID_CSCP_NonBootSubclass,
  346. .Protocol = HID_CSCP_NonBootProtocol,
  347. .InterfaceStrIndex = NO_DESCRIPTOR
  348. },
  349. .Console_HID =
  350. {
  351. .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
  352. .HIDSpec = VERSION_BCD(1,1,1),
  353. .CountryCode = 0x00,
  354. .TotalReportDescriptors = 1,
  355. .HIDReportType = HID_DTYPE_Report,
  356. .HIDReportLength = sizeof(ConsoleReport)
  357. },
  358. .Console_INEndpoint =
  359. {
  360. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  361. .EndpointAddress = (ENDPOINT_DIR_IN | CONSOLE_IN_EPNUM),
  362. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  363. .EndpointSize = CONSOLE_EPSIZE,
  364. .PollingIntervalMS = 0x01
  365. },
  366. .Console_OUTEndpoint =
  367. {
  368. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  369. .EndpointAddress = (ENDPOINT_DIR_OUT | CONSOLE_OUT_EPNUM),
  370. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  371. .EndpointSize = CONSOLE_EPSIZE,
  372. .PollingIntervalMS = 0x01
  373. },
  374. #endif
  375. /*
  376. * NKRO
  377. */
  378. #ifdef NKRO_ENABLE
  379. .NKRO_Interface =
  380. {
  381. .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  382. .InterfaceNumber = NKRO_INTERFACE,
  383. .AlternateSetting = 0x00,
  384. .TotalEndpoints = 1,
  385. .Class = HID_CSCP_HIDClass,
  386. .SubClass = HID_CSCP_NonBootSubclass,
  387. .Protocol = HID_CSCP_NonBootProtocol,
  388. .InterfaceStrIndex = NO_DESCRIPTOR
  389. },
  390. .NKRO_HID =
  391. {
  392. .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
  393. .HIDSpec = VERSION_BCD(1,1,1),
  394. .CountryCode = 0x00,
  395. .TotalReportDescriptors = 1,
  396. .HIDReportType = HID_DTYPE_Report,
  397. .HIDReportLength = sizeof(NKROReport)
  398. },
  399. .NKRO_INEndpoint =
  400. {
  401. .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  402. .EndpointAddress = (ENDPOINT_DIR_IN | NKRO_IN_EPNUM),
  403. .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  404. .EndpointSize = NKRO_EPSIZE,
  405. .PollingIntervalMS = 0x01
  406. },
  407. #endif
  408. };
  409. /*******************************************************************************
  410. * String Descriptors
  411. ******************************************************************************/
  412. const USB_Descriptor_String_t PROGMEM LanguageString =
  413. {
  414. .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
  415. .UnicodeString = {LANGUAGE_ID_ENG}
  416. };
  417. const USB_Descriptor_String_t PROGMEM ManufacturerString =
  418. {
  419. /* subtract 1 for null terminator */
  420. .Header = {.Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER))-1), .Type = DTYPE_String},
  421. .UnicodeString = LSTR(MANUFACTURER)
  422. };
  423. const USB_Descriptor_String_t PROGMEM ProductString =
  424. {
  425. /* subtract 1 for null terminator */
  426. .Header = {.Size = USB_STRING_LEN(sizeof(STR(PRODUCT))-1), .Type = DTYPE_String},
  427. .UnicodeString = LSTR(PRODUCT)
  428. };
  429. /** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
  430. * documentation) by the application code so that the address and size of a requested descriptor can be given
  431. * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
  432. * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
  433. * USB host.
  434. */
  435. uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
  436. const uint8_t wIndex,
  437. const void** const DescriptorAddress)
  438. {
  439. const uint8_t DescriptorType = (wValue >> 8);
  440. const uint8_t DescriptorIndex = (wValue & 0xFF);
  441. const void* Address = NULL;
  442. uint16_t Size = NO_DESCRIPTOR;
  443. switch (DescriptorType)
  444. {
  445. case DTYPE_Device:
  446. Address = &DeviceDescriptor;
  447. Size = sizeof(USB_Descriptor_Device_t);
  448. break;
  449. case DTYPE_Configuration:
  450. Address = &ConfigurationDescriptor;
  451. Size = sizeof(USB_Descriptor_Configuration_t);
  452. break;
  453. case DTYPE_String:
  454. switch (DescriptorIndex )
  455. {
  456. case 0x00:
  457. Address = &LanguageString;
  458. Size = pgm_read_byte(&LanguageString.Header.Size);
  459. break;
  460. case 0x01:
  461. Address = &ManufacturerString;
  462. Size = pgm_read_byte(&ManufacturerString.Header.Size);
  463. break;
  464. case 0x02:
  465. Address = &ProductString;
  466. Size = pgm_read_byte(&ProductString.Header.Size);
  467. break;
  468. }
  469. break;
  470. case HID_DTYPE_HID:
  471. switch (wIndex) {
  472. case KEYBOARD_INTERFACE:
  473. Address = &ConfigurationDescriptor.Keyboard_HID;
  474. Size = sizeof(USB_HID_Descriptor_HID_t);
  475. break;
  476. #ifdef MOUSE_ENABLE
  477. case MOUSE_INTERFACE:
  478. Address = &ConfigurationDescriptor.Mouse_HID;
  479. Size = sizeof(USB_HID_Descriptor_HID_t);
  480. break;
  481. #endif
  482. #ifdef EXTRAKEY_ENABLE
  483. case EXTRAKEY_INTERFACE:
  484. Address = &ConfigurationDescriptor.Extrakey_HID;
  485. Size = sizeof(USB_HID_Descriptor_HID_t);
  486. break;
  487. #endif
  488. #ifdef CONSOLE_ENABLE
  489. case CONSOLE_INTERFACE:
  490. Address = &ConfigurationDescriptor.Console_HID;
  491. Size = sizeof(USB_HID_Descriptor_HID_t);
  492. break;
  493. #endif
  494. #ifdef NKRO_ENABLE
  495. case NKRO_INTERFACE:
  496. Address = &ConfigurationDescriptor.NKRO_HID;
  497. Size = sizeof(USB_HID_Descriptor_HID_t);
  498. break;
  499. #endif
  500. }
  501. break;
  502. case HID_DTYPE_Report:
  503. switch (wIndex) {
  504. case KEYBOARD_INTERFACE:
  505. Address = &KeyboardReport;
  506. Size = sizeof(KeyboardReport);
  507. break;
  508. #ifdef MOUSE_ENABLE
  509. case MOUSE_INTERFACE:
  510. Address = &MouseReport;
  511. Size = sizeof(MouseReport);
  512. break;
  513. #endif
  514. #ifdef EXTRAKEY_ENABLE
  515. case EXTRAKEY_INTERFACE:
  516. Address = &ExtrakeyReport;
  517. Size = sizeof(ExtrakeyReport);
  518. break;
  519. #endif
  520. #ifdef CONSOLE_ENABLE
  521. case CONSOLE_INTERFACE:
  522. Address = &ConsoleReport;
  523. Size = sizeof(ConsoleReport);
  524. break;
  525. #endif
  526. #ifdef NKRO_ENABLE
  527. case NKRO_INTERFACE:
  528. Address = &NKROReport;
  529. Size = sizeof(NKROReport);
  530. break;
  531. #endif
  532. }
  533. break;
  534. }
  535. *DescriptorAddress = Address;
  536. return Size;
  537. }