Descriptors.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2018.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. #ifndef _DESCRIPTORS_H_
  8. #define _DESCRIPTORS_H_
  9. /* Includes: */
  10. #include <avr/pgmspace.h>
  11. #include <LUFA/Drivers/USB/USB.h>
  12. #include "TempDataLogger.h"
  13. #include "Config/AppConfig.h"
  14. /* Macros: */
  15. /** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
  16. #define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
  17. /** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
  18. #define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
  19. /** Size in bytes of the Mass Storage data endpoints. */
  20. #define MASS_STORAGE_IO_EPSIZE 64
  21. /** Endpoint address of the Generic HID reporting IN endpoint. */
  22. #define GENERIC_IN_EPADDR (ENDPOINT_DIR_IN | 1)
  23. /** Size in bytes of the Generic HID reporting endpoint. */
  24. #define GENERIC_EPSIZE 16
  25. /** Size in bytes of the Generic HID reports (including report ID byte). */
  26. #define GENERIC_REPORT_SIZE sizeof(Device_Report_t)
  27. /* Type Defines: */
  28. /** Type define for the device configuration descriptor structure. This must be defined in the
  29. * application code, as the configuration descriptor contains several sub-descriptors which
  30. * vary between devices, and which describe the device's usage to the host.
  31. */
  32. typedef struct
  33. {
  34. USB_Descriptor_Configuration_Header_t Config;
  35. // Mass Storage Interface
  36. USB_Descriptor_Interface_t MS_Interface;
  37. USB_Descriptor_Endpoint_t MS_DataInEndpoint;
  38. USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
  39. // Settings Management Generic HID Interface
  40. USB_Descriptor_Interface_t HID_Interface;
  41. USB_HID_Descriptor_HID_t HID_GenericHID;
  42. USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
  43. } USB_Descriptor_Configuration_t;
  44. /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
  45. * should have a unique ID index associated with it, which can be used to refer to the
  46. * interface from other descriptors.
  47. */
  48. enum InterfaceDescriptors_t
  49. {
  50. INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */
  51. INTERFACE_ID_HID = 1, /**< HID interface descriptor ID */
  52. };
  53. /** Enum for the device string descriptor IDs within the device. Each string descriptor should
  54. * have a unique ID index associated with it, which can be used to refer to the string from
  55. * other descriptors.
  56. */
  57. enum StringDescriptors_t
  58. {
  59. STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
  60. STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
  61. STRING_ID_Product = 2, /**< Product string ID */
  62. };
  63. /* Function Prototypes: */
  64. uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
  65. const uint16_t wIndex,
  66. const void** const DescriptorAddress)
  67. ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
  68. #endif