Fix incorrect descriptor length when using USB_STRING_DESCRIPTOR macros.
This commit is contained in:
		
							parent
							
								
									c5282637ed
								
							
						
					
					
						commit
						b095177e20
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -91,13 +91,13 @@
 | 
			
		|||
			 *
 | 
			
		||||
			 *  \param[in] String  String to initialize a USB String Descriptor structure with.
 | 
			
		||||
			 */
 | 
			
		||||
			#define USB_STRING_DESCRIPTOR(String)     { .Header = {.Size = (sizeof(String) - 2), .Type = DTYPE_String}, .UnicodeString = String }
 | 
			
		||||
			#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((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} }
 | 
			
		||||
			#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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue