Open FFBoard
Open source force feedback firmware
Loading...
Searching...
No Matches
usb_descriptors.h
Go to the documentation of this file.
1/*
2 * usb_descriptors.h
3 *
4 * Created on: 16.02.2021
5 * Author: Yannick
6 */
7
8#ifndef USB_TINYUSB_USB_DESCRIPTORS_H_
9#define USB_TINYUSB_USB_DESCRIPTORS_H_
10
11#include "constants.h"
12#include "tusb.h"
13#include <string>
14#include <vector>
15
16
17#define HID_BINTERVAL 0x01 // 1 = 1000hz, 2 = 500hz, 3 = 333hz 4 = 250hz, 5 = 200hz 6 = 166hz, 7 = 125hz...
18
19typedef struct usb_string_desc
20{
21 const uint16_t langId = 0x0904 ;
22 const std::string manufacturer;
23 const std::string product;
24 const std::vector<std::string> interfaces;
26
27/*
28 * Base combined usb config descriptor for HID and CDC composite device
29 */
30#define USB_CONF_DESC_HID_CDC(HIDREPSIZE,EPSIZE) \
31 /* Config number, interface count, string index, total length, attribute, power in mA*/\
32 TUD_CONFIG_DESCRIPTOR(1, 3, 0, (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_HID_INOUT_DESC_LEN), TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP | TUSB_DESC_CONFIG_ATT_SELF_POWERED, 100),\
33 /* 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.*/\
34 TUD_CDC_DESCRIPTOR(0, 4, 0x82, 8, 0x01, 0x81, EPSIZE),\
35 /* HID Descriptor. EP 83 and 2*/\
36 TUD_HID_INOUT_DESCRIPTOR(2, 5, HID_ITF_PROTOCOL_NONE, HIDREPSIZE, 0x83, 0x02,EPSIZE, HID_BINTERVAL)
37
38/*
39 * Device descriptors
40 */
42
43/*
44 * Config descriptors
45 */
46extern const uint8_t usb_cdc_conf[];
47
48#ifdef AXIS1_FFB_HID_DESC
49extern const uint8_t usb_cdc_hid_conf_1axis[];
50#endif
51
52#ifdef AXIS2_FFB_HID_DESC
53extern const uint8_t usb_cdc_hid_conf_2axis[];
54#endif
55#ifdef AXIS2_FFB_HID_DESC_32B
56extern const uint8_t usb_cdc_hid_conf_2axis_32b[];
57#endif
58#ifdef FFB_HID_DESC_GAMEPAD
59extern const uint8_t usb_cdc_hid_conf_gamepad[];
60#endif
61
62extern const uint8_t usb_cdc_midi_conf[];
63
64// Default strings
66
67#endif /* USB_TINYUSB_USB_DESCRIPTORS_H_ */
const std::string product
const std::string manufacturer
const uint16_t langId
const std::vector< std::string > interfaces
TU_ATTR_PACKED_BEGIN TU_ATTR_BIT_FIELD_ORDER_BEGIN struct TU_ATTR_PACKED tusb_desc_device_t
USB Device Descriptor.
const uint8_t usb_cdc_conf[]
const uint8_t usb_cdc_hid_conf_2axis[]
const uint8_t usb_cdc_hid_conf_gamepad[]
const uint8_t usb_cdc_midi_conf[]
const tusb_desc_device_t usb_devdesc_ffboard_composite
struct usb_string_desc usb_string_desc_t
const uint8_t usb_cdc_hid_conf_2axis_32b[]
const usb_string_desc_t usb_ffboard_strings_default
const uint8_t usb_cdc_hid_conf_1axis[]