1
0

Descriptors.h 3.3 KB

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