Add short delays before detaching from the USB bus in the bootloaders (thanks to...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / StdDescriptors.h
index d77acf4..20cc44f 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2013.
+     Copyright (C) Dean Camera, 2018.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2018  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
                         */
                        #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(USB_Descriptor_Header_t) + (sizeof(String) - 2), .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(USB_Descriptor_Header_t) + 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.
                         *
 
                        /** \name USB Configuration Descriptor Attribute Masks */
                        //@{
-                       /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all
-                        *  devices for historical purposes.
+                       /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be always
+                        *  set on all USB devices for historical purposes.
                         */
                        #define USB_CONFIG_ATTR_RESERVED          0x80
 
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
                         *  descriptor's \c ConfigAttributes value to indicate that the specified configuration can draw its power
-                        *  from the device's own power source.
+                        *  from the device's own power source, instead of drawing it from the USB host.
+                        *
+                        *  Note that the host will probe this dynamically - the device should report its current power state via the
+                        *  \ref USB_Device_CurrentlySelfPowered global variable.
                         */
                        #define USB_CONFIG_ATTR_SELFPOWERED       0x40
 
                         *  descriptor's \c ConfigAttributes value to indicate that the specified configuration supports the
                         *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon
                         *  request.
+                        *
+                        *  If set, the host will dynamically enable and disable remote wakeup support, indicated via the
+                        *  \ref USB_Device_RemoteWakeupEnabled global variable. To initiate a remote wakeup of the host (when allowed)
+                        *  see \ref USB_Device_RemoteWakeupEnabled().
                         */
                        #define USB_CONFIG_ATTR_REMOTEWAKEUP      0x20
                        //@}