diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-05-05 15:25:27 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-05-05 15:25:27 +0000 |
commit | 46d511c021011d051c7f19ab4129a8591735327a (patch) | |
tree | ce86d55bcbad409a925df1ea1e9edf325f1e4834 /LUFA/Drivers/USB | |
parent | 04740d680eb5f5bb665e87155e8d88023ef74214 (diff) | |
download | lufa-46d511c021011d051c7f19ab4129a8591735327a.tar.gz lufa-46d511c021011d051c7f19ab4129a8591735327a.tar.bz2 lufa-46d511c021011d051c7f19ab4129a8591735327a.zip |
Fixed incorrect DFU version number reported to the host in the DFU bootloader descriptors. Fixed incorrect version hundredths value encoding in VERSION_BCD() macro (thanks to Georg Glock).
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Core/StdDescriptors.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index cee2d5ec0..c46129c48 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -94,8 +94,8 @@ * * \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number. */ - #define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \ - ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x))) + #define VERSION_BCD(x) CPU_TO_LE16((VERSION_TENS(x) << 12) | (VERSION_ONES(x) << 8) | \ + (VERSION_TENTHS(x) << 4) | (VERSION_HUNDREDTHS(x) << 0) ) /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors * to indicate that the English language is supported by the device in its string descriptors. @@ -722,10 +722,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)((int)(x) / 10) + #define VERSION_ONES(x) (int)((int)(x) % 10) + #define VERSION_TENTHS(x) (int)(((x * 1) - ((int)(x * 1))) * 10) + #define VERSION_HUNDREDTHS(x) (int)(((x * 10) - ((int)(x * 10))) * 10) #endif /* Disable C linkage for C++ Compilers: */ |