Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Descriptors.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Copyright 2010 Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
  10. Permission to use, copy, modify, distribute, and sell this
  11. software and its documentation for any purpose is hereby granted
  12. without fee, provided that the above copyright notice appear in
  13. all copies and that both that the copyright notice and this
  14. permission notice and warranty disclaimer appear in supporting
  15. documentation, and that the name of the author not be used in
  16. advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.
  18. The author disclaims all warranties with regard to this
  19. software, including all implied warranties of merchantability
  20. and fitness. In no event shall the author be liable for any
  21. special, indirect or consequential damages or any damages
  22. whatsoever resulting from loss of use, data or profits, whether
  23. in an action of contract, negligence or other tortious action,
  24. arising out of or in connection with the use or performance of
  25. this software.
  26. */
  27. /** \file
  28. *
  29. * Header file for Descriptors.c.
  30. */
  31. #ifndef _DESCRIPTORS_H_
  32. #define _DESCRIPTORS_H_
  33. /* Includes: */
  34. #include <avr/pgmspace.h>
  35. #include <LUFA/Drivers/USB/USB.h>
  36. #include "Config/AppConfig.h"
  37. /* Macros: */
  38. /** Endpoint address of the Keyboard HID reporting IN endpoint. */
  39. #define KEYBOARD_EPADDR (ENDPOINT_DIR_IN | 1)
  40. /** Size in bytes of the Keyboard HID reporting IN endpoint. */
  41. #define KEYBOARD_EPSIZE 8
  42. /** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
  43. #define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
  44. /** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
  45. #define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
  46. /** Size in bytes of the Mass Storage data endpoints. */
  47. #define MASS_STORAGE_IO_EPSIZE 64
  48. /* Type Defines: */
  49. /** Type define for the device configuration descriptor structure. This must be defined in the
  50. * application code, as the configuration descriptor contains several sub-descriptors which
  51. * vary between devices, and which describe the device's usage to the host.
  52. */
  53. typedef struct
  54. {
  55. USB_Descriptor_Configuration_Header_t Config;
  56. // Mass Storage Interface
  57. USB_Descriptor_Interface_t MS_Interface;
  58. USB_Descriptor_Endpoint_t MS_DataInEndpoint;
  59. USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
  60. // Generic HID Interface
  61. USB_Descriptor_Interface_t HID_KeyboardInterface;
  62. USB_HID_Descriptor_HID_t HID_KeyboardHID;
  63. USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
  64. } USB_Descriptor_Configuration_t;
  65. /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
  66. * should have a unique ID index associated with it, which can be used to refer to the
  67. * interface from other descriptors.
  68. */
  69. enum InterfaceDescriptors_t
  70. {
  71. INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */
  72. INTERFACE_ID_Keyboard = 1, /**< Keyboard interface descriptor ID */
  73. };
  74. /** Enum for the device string descriptor IDs within the device. Each string descriptor should
  75. * have a unique ID index associated with it, which can be used to refer to the string from
  76. * other descriptors.
  77. */
  78. enum StringDescriptors_t
  79. {
  80. STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
  81. STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
  82. STRING_ID_Product = 2, /**< Product string ID */
  83. };
  84. /* Function Prototypes: */
  85. uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
  86. const uint8_t wIndex,
  87. const void** const DescriptorAddress)
  88. ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
  89. #endif