USBconstant.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __USB_CONST_DATA_H__
  2. #define __USB_CONST_DATA_H__
  3. // clang-format off
  4. #include <stdint.h>
  5. #include "include/ch5xx.h"
  6. #include "include/ch5xx_usb.h"
  7. #include "StdDescriptors.h"
  8. #include "HIDClassCommon.h"
  9. // clang-format on
  10. #define EP0_ADDR 0
  11. #define EP1_ADDR 10
  12. #define KEYBOARD_EPADDR 0x81
  13. #define KEYBOARD_LED_EPADDR 0x01
  14. #define KEYBOARD_MOUSE_EPSIZE 9
  15. /** Type define for the device configuration descriptor structure. This must be
  16. * defined in the application code, as the configuration descriptor contains
  17. * several sub-descriptors which vary between devices, and which describe the
  18. * device's usage to the host.
  19. */
  20. typedef struct {
  21. USB_Descriptor_Configuration_Header_t Config;
  22. // Keyboard HID Interface
  23. USB_Descriptor_Interface_t HID_Interface;
  24. USB_HID_Descriptor_HID_t HID_KeyboardHID;
  25. USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
  26. USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
  27. } USB_Descriptor_Configuration_t;
  28. extern __code USB_Descriptor_Device_t DeviceDescriptor;
  29. extern __code USB_Descriptor_Configuration_t ConfigurationDescriptor;
  30. extern __code uint8_t ReportDescriptor[];
  31. extern __code uint8_t LanguageDescriptor[];
  32. extern __code uint16_t SerialDescriptor[];
  33. extern __code uint16_t ProductDescriptor[];
  34. extern __code uint16_t ManufacturerDescriptor[];
  35. #endif