diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2014-01-08 10:41:16 +1100 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2014-01-08 10:41:16 +1100 |
commit | 832817548235e93e0be54bbe6986135aca170944 (patch) | |
tree | 4ed7546edeb3eb55c37301bb2380a0edd3e0ef33 /LUFA/Drivers/USB/Core | |
parent | deb1675f84aa96395845012a39513b69bc2ccb36 (diff) | |
download | lufa-832817548235e93e0be54bbe6986135aca170944.tar.gz lufa-832817548235e93e0be54bbe6986135aca170944.tar.bz2 lufa-832817548235e93e0be54bbe6986135aca170944.zip |
Add USB_STRING_DESCRIPTOR_ARRAY() macro, update demos where required.
Diffstat (limited to 'LUFA/Drivers/USB/Core')
-rw-r--r-- | LUFA/Drivers/USB/Core/StdDescriptors.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index cfd42c4d9..624f3dea3 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -85,6 +85,20 @@ */ #define USB_STRING_LEN(UnicodeChars) (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 1)) + /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from a wide character string. + * + * \note This macro is for little-endian systems only. + * + * \param[in] String String to initialize a USB String Descriptor structure with. + */ + #define USB_STRING_DESCRIPTOR(String) { .Header = {.Size = sizeof(String), .Type = DTYPE_String}, .UnicodeString = String } + + /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from an array of characters. + * + * \param[in] ... Characters to initialize a USB String Descriptor structure with. + */ + #define USB_STRING_DESCRIPTOR_ARRAY(...) { .Header = {.Size = sizeof((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} } + /** Macro to encode a given major/minor/revision version number into Binary Coded Decimal format for descriptor * fields requiring BCD encoding, such as the USB version number in the standard device descriptor. * @@ -706,9 +720,6 @@ #endif } ATTR_PACKED USB_Descriptor_String_t; - /** Convenience macro to easily create \ref USB_Descriptor_String_t instances without having to count characters. */ - #define USB_STRING_DESCRIPTOR(string) {.Header = {.Size = sizeof(string), .Type = DTYPE_String}, .UnicodeString = string} - /** \brief Standard USB String Descriptor (USB-IF naming conventions). * * Type define for a standard string descriptor. Unlike other standard descriptors, the length |