aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/HighLevel
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-12-09 00:50:55 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-12-09 00:50:55 +0000
commit7ace314cc12f24c1c3108311bdfb3a2ed484ab37 (patch)
tree5ff719df1d93ea5cfc6393999e42468e0b727d1d /LUFA/Drivers/USB/HighLevel
parent2281750b5fdf046ed606e567eb60cf4e647015dd (diff)
downloadlufa-7ace314cc12f24c1c3108311bdfb3a2ed484ab37.tar.gz
lufa-7ace314cc12f24c1c3108311bdfb3a2ed484ab37.tar.bz2
lufa-7ace314cc12f24c1c3108311bdfb3a2ed484ab37.zip
Increase timeout of Mass Storage and Still Image host commands to 10 seconds (up from 5) to account for slow-processing devices.
Added brace guards to macros with parameters to prevent unintended changed evaluation of the macro expression. Minor code cleanups (remove redundant comments, fix spacing, etc.).
Diffstat (limited to 'LUFA/Drivers/USB/HighLevel')
-rw-r--r--LUFA/Drivers/USB/HighLevel/StdDescriptors.h12
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.h4
2 files changed, 9 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
index 286294424..9b46c0936 100644
--- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
+++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
@@ -82,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
@@ -593,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: */
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h
index cc0601548..4c9b717a4 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.h
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.h
@@ -175,7 +175,9 @@
#endif
/* Macros: */
- #define HOST_TASK_NONBLOCK_WAIT(duration, nextstate) MACROS{USB_HostState = HOST_STATE_WaitForDevice; WaitMSRemaining = duration; PostWaitState = nextstate; }MACROE
+ #define HOST_TASK_NONBLOCK_WAIT(duration, nextstate) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \
+ WaitMSRemaining = (duration); \
+ PostWaitState = (nextstate); }MACROE
#endif
/* Disable C linkage for C++ Compilers: */