X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b221e7d175e4b5ca463fdd6d05b8c3fc71bd7c40..4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc:/LUFA/Drivers/USB/HighLevel/StdDescriptors.h diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h index 0b56ab6d0..9b46c0936 100644 --- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h +++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h @@ -43,6 +43,7 @@ /* Includes: */ #include #include + #include #include "../../../Common/Common.h" #include "USBMode.h" @@ -72,7 +73,7 @@ * a unique serial number internally, and setting the device descriptors serial number string index to this value * will cause it to use the internal serial number. * - * On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseduo-serial + * On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseudo-serial * number for the device. */ #define USE_INTERNAL_SERIAL 0xDC @@ -81,12 +82,12 @@ #endif /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */ - #define USB_CONFIG_POWER_MA(mA) (mA >> 1) + #define USB_CONFIG_POWER_MA(mA) ((mA) >> 1) /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. * Should be used in string descriptor's headers for giving the string descriptor's byte length. */ - #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + (str << 1)) + #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1)) /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded * Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the @@ -544,17 +545,17 @@ { USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - int16_t UnicodeString[]; /**< String data, as unicode characters (alternatively, - * string language IDs). If normal ASCII characters are - * to be used, they must be added as an array of characters - * rather than a normal C string so that they are widened to - * Unicode size. - * - * Under GCC, strings prefixed with the "L" character (before - * the opening string quotation mark) are considered to be - * Unicode strings, and may be used instead of an explicit - * array of ASCII characters. - */ + wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively, + * string language IDs). If normal ASCII characters are + * to be used, they must be added as an array of characters + * rather than a normal C string so that they are widened to + * Unicode size. + * + * Under GCC, strings prefixed with the "L" character (before + * the opening string quotation mark) are considered to be + * Unicode strings, and may be used instead of an explicit + * array of ASCII characters. + */ } USB_Descriptor_String_t; /** Type define for a standard string descriptor. Unlike other standard descriptors, the length @@ -592,10 +593,10 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define VERSION_TENS(x) (int)(x / 10) - #define VERSION_ONES(x) (int)(x - (10 * VERSION_TENS(x))) - #define VERSION_TENTHS(x) (int)((x - (int)x) * 10) - #define VERSION_HUNDREDTHS(x) (int)(((x - (int)x) * 100) - (10 * VERSION_TENTHS(x))) + #define VERSION_TENS(x) (int)((x) / 10) + #define VERSION_ONES(x) (int)((x) - (10 * VERSION_TENS(x))) + #define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10) + #define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x))) #endif /* Disable C linkage for C++ Compilers: */