remove TUSB prefix for class enum definitions

add most of HID USAGE TABLE and definitions etc ...
This commit is contained in:
hathach
2013-02-05 13:57:06 +07:00
parent aa040c4c98
commit aeccdfde3f
11 changed files with 624 additions and 112 deletions

View File

@@ -58,16 +58,34 @@
#include "common/common.h"
enum {
TUSB_HID_SUBCLASS_NONE = 0,
TUSB_HID_SUBCLASS_BOOT = 1
HID_SUBCLASS_NONE = 0,
HID_SUBCLASS_BOOT = 1
};
enum {
TUSB_HID_PROTOCOL_NONE = 0,
TUSB_HID_PROTOCOL_KEYBOARD = 1,
TUSB_HID_PROTOCOL_MOUSE = 2
HID_PROTOCOL_NONE = 0,
HID_PROTOCOL_KEYBOARD = 1,
HID_PROTOCOL_MOUSE = 2
};
/** \struct tusb_mouse_report_t
enum {
HID_DESC_HID = 0x21,
HID_DESC_REPORT = 0x22,
HID_DESC_PHYSICAL = 0x23
};
typedef ATTR_PREPACKED struct ATTR_PACKED {
uint8_t bLength; /**< Numeric expression that is the total size of the HID descriptor */
uint8_t bDescriptorType; /**< Constant name specifying type of HID descriptor. */
uint16_t bcdHID; /**< Numeric expression identifying the HID Class Specification release */
uint8_t bCountryCode; /**< Numeric expression identifying country code of the localized hardware. */
uint8_t bNumDescriptors; /**< Numeric expression specifying the number of class descriptors */
uint8_t bReportType; /**< Type of HID class report. */
uint16_t wReportLength; /**< the total size of the Report descriptor. */
} tusb_hid_descriptor_hid_t;
/**
* \brief Standard HID Boot Protocol Mouse Report.
*
* Type define for a standard Boot Protocol Mouse report
@@ -79,7 +97,7 @@ typedef ATTR_PREPACKED struct
int8_t y; /**< Current delta y movement on the mouse. */
} ATTR_PACKED tusb_mouse_report_t;
/** \struct tusb_keyboard_report_t
/**
* \brief Standard HID Boot Protocol Keyboard Report.
*
* Type define for a standard Boot Protocol Keyboard report
@@ -91,42 +109,42 @@ typedef ATTR_PREPACKED struct
uint8_t keycode[6]; /**< Key codes of the currently pressed keys. */
} ATTR_PACKED tusb_keyboard_report_t;
/** \enum USB_HID_MOUSE_BUTTON_CODE
/**
* \brief buttons codes for HID mouse
*/
enum USB_HID_MOUSE_BUTTON_CODE
enum
{
HID_MOUSEBUTTON_RIGHT = 0,
HID_MOUSEBUTTON_LEFT = 1,
HID_MOUSEBUTTON_MIDDLE = 2
};
/** \enum USB_HID_KB_KEYMODIFIER_CODE
/**
* \brief KB modifier codes for HID KB
*/
enum TUSB_KEYBOARD_MODIFIER_CODE
enum
{
TUSB_KEYBOARD_MODIFIER_LEFTCTRL = BIN8(00000001),
TUSB_KEYBOARD_MODIFIER_LEFTSHIFT = BIN8(00000010),
TUSB_KEYBOARD_MODIFIER_LEFTALT = BIN8(00000100),
TUSB_KEYBOARD_MODIFIER_LEFTGUI = BIN8(00001000),
TUSB_KEYBOARD_MODIFIER_RIGHTCTRL = BIN8(00010000),
TUSB_KEYBOARD_MODIFIER_RIGHTSHIFT = BIN8(00100000),
TUSB_KEYBOARD_MODIFIER_RIGHTALT = BIN8(01000000),
TUSB_KEYBOARD_MODIFIER_RIGHTGUI = BIN8(10000000)
KEYBOARD_MODIFIER_LEFTCTRL = BIN8(00000001),
KEYBOARD_MODIFIER_LEFTSHIFT = BIN8(00000010),
KEYBOARD_MODIFIER_LEFTALT = BIN8(00000100),
KEYBOARD_MODIFIER_LEFTGUI = BIN8(00001000),
KEYBOARD_MODIFIER_RIGHTCTRL = BIN8(00010000),
KEYBOARD_MODIFIER_RIGHTSHIFT = BIN8(00100000),
KEYBOARD_MODIFIER_RIGHTALT = BIN8(01000000),
KEYBOARD_MODIFIER_RIGHTGUI = BIN8(10000000)
};
enum TUSB_KEYBOARD_KEYCODE
enum
{
TUSB_KEYBOARD_KEYCODE_a = 0x04,
TUSB_KEYBOARD_KEYCODE_z = 0x1d,
KEYBOARD_KEYCODE_a = 0x04,
KEYBOARD_KEYCODE_z = 0x1d,
TUSB_KEYBOARD_KEYCODE_1 = 0x1e,
TUSB_KEYBOARD_KEYCODE_0 = 0x27
KEYBOARD_KEYCODE_1 = 0x1e,
KEYBOARD_KEYCODE_0 = 0x27
// TODO complete keycode table
};
/** \enum USB_HID_LOCAL_CODE
/**
* \brief Local Country code for HID
*/
enum USB_HID_LOCAL_CODE
@@ -169,6 +187,218 @@ enum USB_HID_LOCAL_CODE
HID_Local_Turkish_F
};
//--------------------------------------------------------------------+
// REPORT DESCRIPTOR
//--------------------------------------------------------------------+
//------------- ITEM & TAG -------------//
#define HID_REPORT_DATA_0(data)
#define HID_REPORT_DATA_1(data) data
#define HID_REPORT_DATA_2(data) U16_TO_U8S_LE(data)
#define HID_REPORT_DATA_3(data) U32_TO_U8S_LE(data)
#define HID_REPORT_ITEM(data, tag, type, size) \
( (tag << 4) | (type << 2) | size), HID_REPORT_DATA_##size(data)
#define RI_TYPE_MAIN 0
#define RI_TYPE_GLOBAL 1
#define RI_TYPE_LOCAL 2
//------------- MAIN ITEMS 6.2.2.4 -------------//
#define HID_INPUT(x) HID_REPORT_ITEM(x, 8, RI_TYPE_MAIN, 1)
#define HID_OUTPUT(x) HID_REPORT_ITEM(x, 9, RI_TYPE_MAIN, 1)
#define HID_COLLECTION(x) HID_REPORT_ITEM(x, 10, RI_TYPE_MAIN, 1)
#define HID_FEATURE(x) HID_REPORT_ITEM(x, 11, RI_TYPE_MAIN, 1)
#define HID_COLLECTION_END HID_REPORT_ITEM(x, 12, RI_TYPE_MAIN, 0)
//------------- INPUT, OUTPUT, FEATURE 6.2.2.5 -------------//
#define HID_DATA (0<<0)
#define HID_CONSTANT (1<<0)
#define HID_ARRAY (0<<1)
#define HID_VARIABLE (1<<1)
#define HID_ABSOLUTE (0<<2)
#define HID_RELATIVE (1<<2)
#define HID_WRAP_NO (0<<3)
#define HID_WRAP (1<<3)
#define HID_LINEAR (0<<4)
#define HID_NONLINEAR (1<<4)
#define HID_PREFERRED_STATE (0<<5)
#define HID_PREFERRED_NO (1<<5)
#define HID_NO_NULL_POSITION (0<<6)
#define HID_NULL_STATE (1<<6)
#define HID_NON_VOLATILE (0<<7)
#define HID_VOLATILE (1<<7)
#define HID_BITFIELD (0<<8)
#define HID_BUFFERED_BYTES (1<<8)
//------------- COLLECTION ITEM 6.2.2.6 -------------//
enum {
HID_COLLECTION_PHYSICAL = 0,
HID_COLLECTION_APPLICATION,
HID_COLLECTION_LOGICAL,
HID_COLLECTION_REPORT,
HID_COLLECTION_NAMED_ARRAY,
HID_COLLECTION_USAGE_SWITCH,
HID_COLLECTION_USAGE_MODIFIER
};
//------------- GLOBAL ITEMS 6.2.2.7 -------------//
#define HID_USAGE_PAGE(x) HID_REPORT_ITEM(x, 0, RI_TYPE_GLOBAL, 1)
#define HID_USAGE_PAGE_N(x, n) HID_REPORT_ITEM(x, 0, RI_TYPE_GLOBAL, n)
#define HID_LOGICAL_MIN(x) HID_REPORT_ITEM(x, 1, RI_TYPE_GLOBAL, 1)
#define HID_LOGICAL_MIN_N(x, n) HID_REPORT_ITEM(x, 1, RI_TYPE_GLOBAL, n)
#define HID_LOGICAL_MAX(x) HID_REPORT_ITEM(x, 2, RI_TYPE_GLOBAL, 1)
#define HID_LOGICAL_MAX_N(x, n) HID_REPORT_ITEM(x, 2, RI_TYPE_GLOBAL, n)
#define HID_PHYSICAL_MIN(x) HID_REPORT_ITEM(x, 3, RI_TYPE_GLOBAL, 1)
#define HID_PHYSICAL_MIN_N(x, n) HID_REPORT_ITEM(x, 3, RI_TYPE_GLOBAL, n)
#define HID_PHYSICAL_MAX(x) HID_REPORT_ITEM(x, 4, RI_TYPE_GLOBAL, 1)
#define HID_PHYSICAL_MAX_N(x, n) HID_REPORT_ITEM(x, 4, RI_TYPE_GLOBAL, n)
#define HID_UNIT_EXPONENT(x) HID_REPORT_ITEM(x, 5, RI_TYPE_GLOBAL, 1)
#define HID_UNIT_EXPONENT_N(x, n) HID_REPORT_ITEM(x, 5, RI_TYPE_GLOBAL, n)
#define HID_UNIT(x) HID_REPORT_ITEM(x, 6, RI_TYPE_GLOBAL, 1)
#define HID_UNIT_N(x, n) HID_REPORT_ITEM(x, 6, RI_TYPE_GLOBAL, n)
#define HID_REPORT_SIZE(x) HID_REPORT_ITEM(x, 7, RI_TYPE_GLOBAL, 1)
#define HID_REPORT_SIZE_N(x, n) HID_REPORT_ITEM(x, 7, RI_TYPE_GLOBAL, n)
#define HID_REPORT_ID(x) HID_REPORT_ITEM(x, 8, RI_TYPE_GLOBAL, 1)
#define HID_REPORT_ID_N(x) HID_REPORT_ITEM(x, 8, RI_TYPE_GLOBAL, n)
#define HID_REPORT_COUNT(x) HID_REPORT_ITEM(x, 9, RI_TYPE_GLOBAL, 1)
#define HID_REPORT_COUNT_N(x, n) HID_REPORT_ITEM(x, 9, RI_TYPE_GLOBAL, n)
#define HID_PUSH HID_REPORT_ITEM(x, 10, RI_TYPE_GLOBAL, 0)
#define HID_POP HID_REPORT_ITEM(x, 11, RI_TYPE_GLOBAL, 0)
//------------- LOCAL ITEMS 6.2.2.8 -------------//
#define HID_USAGE(x) HID_REPORT_ITEM(x, 0, RI_TYPE_LOCAL, 1)
#define HID_USAGE_N(x, n) HID_REPORT_ITEM(x, 0, RI_TYPE_LOCAL, n)
#define HID_USAGE_MIN(x) HID_REPORT_ITEM(x, 1, RI_TYPE_LOCAL, 1)
#define HID_USAGE_MIN_N(x, n) HID_REPORT_ITEM(x, 1, RI_TYPE_LOCAL, n)
#define HID_USAGE_MAX(x) HID_REPORT_ITEM(x, 2, RI_TYPE_LOCAL, 1)
#define HID_USAGE_MAX_N(x, n) HID_REPORT_ITEM(x, 2, RI_TYPE_LOCAL, n)
//--------------------------------------------------------------------+
// Usage Table
//--------------------------------------------------------------------+
/// HID Usage Table - Table 1: Usage Page Summary
enum {
HID_USAGE_PAGE_DESKTOP = 0x01,
HID_USAGE_PAGE_SIMULATE = 0x02,
HID_USAGE_PAGE_VIRTUAL_REALITY = 0x03,
HID_USAGE_PAGE_SPORT = 0x04,
HID_USAGE_PAGE_GAME = 0x05,
HID_USAGE_PAGE_GENERIC_DEVICE = 0x06,
HID_USAGE_PAGE_KEYBOARD = 0x07,
HID_USAGE_PAGE_LED = 0x08,
HID_USAGE_PAGE_BUTTON = 0x09,
HID_USAGE_PAGE_ORDINAL = 0x0a,
HID_USAGE_PAGE_TELEPHONY = 0x0b,
HID_USAGE_PAGE_CONSUMER = 0x0c,
HID_USAGE_PAGE_DIGITIZER = 0x0d,
HID_USAGE_PAGE_PID = 0x0f,
HID_USAGE_PAGE_UNICODE = 0x10,
HID_USAGE_PAGE_ALPHA_DISPLAY = 0x14,
HID_USAGE_PAGE_MEDICAL = 0x40,
HID_USAGE_PAGE_MONITOR = 0x80, //0x80 - 0x83
HID_USAGE_PAGE_POWER = 0x84, // 0x084 - 0x87
HID_USAGE_PAGE_BARCODE_SCANNER = 0x8c,
HID_USAGE_PAGE_SCALE = 0x8d,
HID_USAGE_PAGE_MSR = 0x8e,
HID_USAGE_PAGE_CAMERA = 0x90,
HID_USAGE_PAGE_ARCADE = 0x91,
HID_USAGE_PAGE_VENDOR = 0xFFFF // 0xFF00 - 0xFFFF
};
/// HID Usage Table - Table 6: Generic Desktop Page
enum {
HID_USAGE_DESKTOP_POINTER = 0x01,
HID_USAGE_DESKTOP_MOUSE = 0x02,
HID_USAGE_DESKTOP_JOYSTICK = 0x04,
HID_USAGE_DESKTOP_GAMEPAD = 0x05,
HID_USAGE_DESKTOP_KEYBOARD = 0x06,
HID_USAGE_DESKTOP_KEYPAD = 0x07,
HID_USAGE_DESKTOP_MULTI_AXIS_CONTROLLER = 0x08,
HID_USAGE_DESKTOP_TABLET_PC_SYSTEM = 0x09,
HID_USAGE_DESKTOP_X = 0x30,
HID_USAGE_DESKTOP_Y = 0x31,
HID_USAGE_DESKTOP_Z = 0x32,
HID_USAGE_DESKTOP_RX = 0x33,
HID_USAGE_DESKTOP_RY = 0x34,
HID_USAGE_DESKTOP_RZ = 0x35,
HID_USAGE_DESKTOP_SLIDER = 0x36,
HID_USAGE_DESKTOP_DIAL = 0x37,
HID_USAGE_DESKTOP_WHEEL = 0x38,
HID_USAGE_DESKTOP_HAT_SWITCH = 0x39,
HID_USAGE_DESKTOP_COUNTED_BUFFER = 0x3a,
HID_USAGE_DESKTOP_BYTE_COUNT = 0x3b,
HID_USAGE_DESKTOP_MOTION_WAKEUP = 0x3c,
HID_USAGE_DESKTOP_START = 0x3d,
HID_USAGE_DESKTOP_SELECT = 0x3e,
HID_USAGE_DESKTOP_VX = 0x40,
HID_USAGE_DESKTOP_VY = 0x41,
HID_USAGE_DESKTOP_VZ = 0x42,
HID_USAGE_DESKTOP_VBRX = 0x43,
HID_USAGE_DESKTOP_VBRY = 0x44,
HID_USAGE_DESKTOP_VBRZ = 0x45,
HID_USAGE_DESKTOP_VNO = 0x46,
HID_USAGE_DESKTOP_FEATURE_NOTIFICATION = 0x47,
HID_USAGE_DESKTOP_RESOLUTION_MULTIPLIER = 0x48,
HID_USAGE_DESKTOP_SYSTEM_CONTROL = 0x80,
HID_USAGE_DESKTOP_SYSTEM_POWER_DOWN = 0x81,
HID_USAGE_DESKTOP_SYSTEM_SLEEP = 0x82,
HID_USAGE_DESKTOP_SYSTEM_WAKE_UP = 0x83,
HID_USAGE_DESKTOP_SYSTEM_CONTEXT_MENU = 0x84,
HID_USAGE_DESKTOP_SYSTEM_MAIN_MENU = 0x85,
HID_USAGE_DESKTOP_SYSTEM_APP_MENU = 0x86,
HID_USAGE_DESKTOP_SYSTEM_MENU_HELP = 0x87,
HID_USAGE_DESKTOP_SYSTEM_MENU_EXIT = 0x88,
HID_USAGE_DESKTOP_SYSTEM_MENU_SELECT = 0x89,
HID_USAGE_DESKTOP_SYSTEM_MENU_RIGHT = 0x8A,
HID_USAGE_DESKTOP_SYSTEM_MENU_LEFT = 0x8B,
HID_USAGE_DESKTOP_SYSTEM_MENU_UP = 0x8C,
HID_USAGE_DESKTOP_SYSTEM_MENU_DOWN = 0x8D,
HID_USAGE_DESKTOP_SYSTEM_COLD_RESTART = 0x8E,
HID_USAGE_DESKTOP_SYSTEM_WARM_RESTART = 0x8F,
HID_USAGE_DESKTOP_DPAD_UP = 0x90,
HID_USAGE_DESKTOP_DPAD_DOWN = 0x91,
HID_USAGE_DESKTOP_DPAD_RIGHT = 0x92,
HID_USAGE_DESKTOP_DPAD_LEFT = 0x93,
HID_USAGE_DESKTOP_SYSTEM_DOCK = 0xA0,
HID_USAGE_DESKTOP_SYSTEM_UNDOCK = 0xA1,
HID_USAGE_DESKTOP_SYSTEM_SETUP = 0xA2,
HID_USAGE_DESKTOP_SYSTEM_BREAK = 0xA3,
HID_USAGE_DESKTOP_SYSTEM_DEBUGGER_BREAK = 0xA4,
HID_USAGE_DESKTOP_APPLICATION_BREAK = 0xA5,
HID_USAGE_DESKTOP_APPLICATION_DEBUGGER_BREAK = 0xA6,
HID_USAGE_DESKTOP_SYSTEM_SPEAKER_MUTE = 0xA7,
HID_USAGE_DESKTOP_SYSTEM_HIBERNATE = 0xA8,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_INVERT = 0xB0,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_INTERNAL = 0xB1,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_EXTERNAL = 0xB2,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_BOTH = 0xB3,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_DUAL = 0xB4,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_TOGGLE_INT_EXT = 0xB5,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_SWAP_PRIMARY_SECONDARY = 0xB6,
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_LCD_AUTOSCALE = 0xB7
};
#ifdef __cplusplus
}
#endif

View File

@@ -86,6 +86,18 @@
#define STRING_(x) #x // stringify without expand
#define XSTRING_(x) STRING_(x) // expand then stringify
#define U16_HIGH_U8(u16) ((uint8_t) (((u16) > 8) & 0x00ff))
#define U16_LOW_U8(u16) ((uint8_t) ((u16) & 0x00ff))
#define U16_TO_U8S_BE(u16) U16_HIGH_U8(u16), U16_LOW_U8(u16)
#define U16_TO_U8S_LE(u16) U16_LOW_U8(u16), U16_HIGH_U8(u16)
#define U32_B1_U8(u32) ((uint8_t) (((u32) > 24) & 0x000000ff)) // MSB
#define U32_B2_U8(u32) ((uint8_t) (((u32) > 16) & 0x000000ff))
#define U32_B3_U8(u32) ((uint8_t) (((u32) > 8) & 0x000000ff))
#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB
#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32)
#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32)
/// form an uint32_t from 4 x uint8_t
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline uint32_t u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4)

View File

@@ -114,7 +114,14 @@ typedef ATTR_PREPACKED struct ATTR_PACKED {
uint8_t bDescriptorType ; ///< ENDPOINT Descriptor Type
uint8_t bEndpointAddress ; ///< The address of the endpoint on the USB device described by this descriptor. The address is encoded as follows: \n Bit 3...0: The endpoint number \n Bit 6...4: Reserved, reset to zero \n Bit 7: Direction, ignored for control endpoints 0 = OUT endpoint 1 = IN endpoint.
uint8_t bmAttributes ; ///< This field describes the endpoint's attributes when it is configured using the bConfigurationValue. \n Bits 1..0: Transfer Type \n- 00 = Control \n- 01 = Isochronous \n- 10 = Bulk \n- 11 = Interrupt \n If not an isochronous endpoint, bits 5..2 are reserved and must be set to zero. If isochronous, they are defined as follows: \n Bits 3..2: Synchronization Type \n- 00 = No Synchronization \n- 01 = Asynchronous \n- 10 = Adaptive \n- 11 = Synchronous \n Bits 5..4: Usage Type \n- 00 = Data endpoint \n- 01 = Feedback endpoint \n- 10 = Implicit feedback Data endpoint \n- 11 = Reserved \n Refer to Chapter 5 of USB 2.0 specification for more information. \n All other bits are reserved and must be reset to zero. Reserved bits must be ignored by the host.
ATTR_PREPACKED struct ATTR_PACKED {
uint8_t xfer : 2;
uint8_t sync : 2;
uint8_t usage : 2;
uint8_t : 2;
} bmAttributes ; ///< This field describes the endpoint's attributes when it is configured using the bConfigurationValue. \n Bits 1..0: Transfer Type \n- 00 = Control \n- 01 = Isochronous \n- 10 = Bulk \n- 11 = Interrupt \n If not an isochronous endpoint, bits 5..2 are reserved and must be set to zero. If isochronous, they are defined as follows: \n Bits 3..2: Synchronization Type \n- 00 = No Synchronization \n- 01 = Asynchronous \n- 10 = Adaptive \n- 11 = Synchronous \n Bits 5..4: Usage Type \n- 00 = Data endpoint \n- 01 = Feedback endpoint \n- 10 = Implicit feedback Data endpoint \n- 11 = Reserved \n Refer to Chapter 5 of USB 2.0 specification for more information. \n All other bits are reserved and must be reset to zero. Reserved bits must be ignored by the host.
uint16_t wMaxPacketSize ; ///< Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected. \n For isochronous endpoints, this value is used to reserve the bus time in the schedule, required for the per-(micro)frame data payloads. The pipe may, on an ongoing basis, actually use less bandwidth than that reserved. The device reports, if necessary, the actual bandwidth used via its normal, non-USB defined mechanisms. \n For all endpoints, bits 10..0 specify the maximum packet size (in bytes). \n For high-speed isochronous and interrupt endpoints: \n Bits 12..11 specify the number of additional transaction opportunities per microframe: \n- 00 = None (1 transaction per microframe) \n- 01 = 1 additional (2 per microframe) \n- 10 = 2 additional (3 per microframe) \n- 11 = Reserved \n Bits 15..13 are reserved and must be set to zero.
uint8_t bInterval ; ///< Interval for polling endpoint for data transfers. Expressed in frames or microframes depending on the device operating speed (i.e., either 1 millisecond or 125 us units). \n- For full-/high-speed isochronous endpoints, this value must be in the range from 1 to 16. The bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$). \n- For full-/low-speed interrupt endpoints, the value of this field may be from 1 to 255. \n- For high-speed interrupt endpoints, the bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$) . This value must be from 1 to 16. \n- For high-speed bulk/control OUT endpoints, the bInterval must specify the maximum NAK rate of the endpoint. A value of 0 indicates the endpoint never NAKs. Other values indicate at most 1 NAK each bInterval number of microframes. This value must be in the range from 0 to 255. \n Refer to Chapter 5 of USB 2.0 specification for more information.
} tusb_descriptor_endpoint_t;

View File

@@ -61,7 +61,7 @@
#include "common/binary.h"
typedef ATTR_PREPACKED struct ATTR_PACKED {
struct {
ATTR_PREPACKED struct ATTR_PACKED {
uint8_t recipient : 5; /**< Recipient type. */
uint8_t type : 2; /**< Request type. */
uint8_t direction : 1; /**< Direction type. */

View File

@@ -161,6 +161,7 @@ enum {
TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = BIT_(5)
};
#define TUSB_DESC_CONFIG_POWER_MA(x) ((x)/2)
#ifdef __cplusplus
}
#endif