diff options
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h | 8 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/StdDescriptors.h | 23 |
3 files changed, 19 insertions, 15 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c index 8faec1df0..dc96c0fe7 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c @@ -112,7 +112,8 @@ void USB_Disable(void) if (!(USB_Options & USB_OPT_MANUAL_PLL)) USB_PLL_Off(); - USB_REG_Off(); + if (!(USB_Options & USB_OPT_REG_KEEP_ENABLED)) + USB_REG_Off(); #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) USB_OTGPAD_Off(); diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h index 1b72bf13b..fedc04ec1 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h @@ -133,6 +133,14 @@ */ #define USB_OPT_REG_ENABLED (0 << 1) + /** Option mask for \ref USB_Init() to keep regulator enabled at all times. Indicates that \ref USB_Disable() + * should not disable the regulator as it would otherwise. Has no effect if regulator is disabled using + * \ref USB_OPT_REG_DISABLED. + * + * \note See USB AVR data sheet for more information on the internal pad regulator. + */ + #define USB_OPT_REG_KEEP_ENABLED (1 << 3) + /** Manual PLL control option mask for \ref USB_Init(). This indicates to the library that the user application * will take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock * that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations. diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index d7f0ca349..d77acf4e3 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -85,17 +85,20 @@ */ #define USB_STRING_LEN(UnicodeChars) (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 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 - * standard device descriptor. + /** 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. * * \note This value is automatically converted into Little Endian, suitable for direct use inside device * descriptors on all architectures without endianness conversion macros. * - * \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number. + * \param[in] Major Major version number to encode. + * \param[in] Minor Minor version number to encode. + * \param[in] Revision Revision version number to encode. */ - #define VERSION_BCD(x) CPU_TO_LE16((VERSION_TENS(x) << 12) | (VERSION_ONES(x) << 8) | \ - (VERSION_TENTHS(x) << 4) | (VERSION_HUNDREDTHS(x) << 0) ) + #define VERSION_BCD(Major, Minor, Revision) \ + CPU_TO_LE16( ((Major & 0xFF) << 8) | \ + ((Minor & 0x0F) << 4) | \ + (Revision & 0x0F) ) /** 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. @@ -736,14 +739,6 @@ */ } ATTR_PACKED USB_StdDescriptor_String_t; - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define VERSION_TENS(x) (int)((int)(x) / 10) - #define VERSION_ONES(x) (int)((int)(x) % 10) - #define VERSION_TENTHS(x) (int)((x - (int)x) * 10) - #define VERSION_HUNDREDTHS(x) (int)((x * 100) - ((int)(x * 10) * 10)) - #endif /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) |