diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_common.h | 5 | ||||
| -rw-r--r-- | src/common/tusb_types.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index 0b5a37922..e687b8983 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -142,6 +142,11 @@ static inline uint32_t tu_u32_from_u8(uint8_t b1, uint8_t b2, uint8_t b3, uint8_ return ( ((uint32_t) b1) << 24) + ( ((uint32_t) b2) << 16) + ( ((uint32_t) b3) << 8) + b4;
}
+static inline uint16_t tu_u16_from_u8(uint8_t high, uint8_t low)
+{
+ return (((uint16_t) high) << 8) + low;
+}
+
static inline uint8_t tu_u16_high(uint16_t u16)
{
return (uint8_t) ( ((uint16_t) (u16 >> 8)) & 0x00ff);
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h index 909deffa8..82b5a65c1 100644 --- a/src/common/tusb_types.h +++ b/src/common/tusb_types.h @@ -403,10 +403,10 @@ static inline uint8_t tu_desc_len(void const* desc) }
// Length of the string descriptors in bytes with slen characters
-#define TUD_DESC_STRLEN(_slen) (2*(_slen) + 2)
+#define TUD_DESC_STRLEN(_chr_count) (2*(_chr_count) + 2)
// Header of string descriptors with len + string type
-#define TUD_DESC_STR_HEADER(_slen) ( (uint16_t) ( (TUSB_DESC_STRING << 8 ) | TUD_DESC_STRLEN(_slen)) )
+#define TUD_DESC_STR_HEADER(_chr_count) ( (uint16_t) ( (TUSB_DESC_STRING << 8 ) | TUD_DESC_STRLEN(_chr_count)) )
// Convert comma-separated string to descriptor unicode format
#define TUD_DESC_STRCONV( ... ) (const uint16_t[]) { TUD_DESC_STR_HEADER(VA_ARGS_NUM_(__VA_ARGS__)), __VA_ARGS__ }
|
