/** Prevents the compiler from considering a specified function for inlining. When applied, the given\r
* function will not be inlined under any circumstances.\r
*/\r
- #define ATTR_NOINLINE __attribute__ ((noinline))\r
+ #define ATTR_NO_INLINE __attribute__ ((noinline))\r
\r
/** Forces the compiler to inline the specified function. When applied, the given function will be\r
* inlined under all circumstances.\r
}\r
\r
#if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))\r
+static char USB_Device_NibbleToASCII(uint8_t Nibble)\r
+{\r
+ Nibble = ((Nibble & 0x0F) + '0');\r
+ return (Nibble > '9') ? (Nibble + ('A' - '9' - 1)) : Nibble;\r
+}\r
+\r
static void USB_Device_GetInternalSerialDescriptor(void)\r
{\r
struct\r
USB_Descriptor_Header_t Header;\r
int16_t UnicodeString[20];\r
} SignatureDescriptor;\r
- \r
- uint8_t SigReadAddress = 0x0E;\r
- bool OddNibbleRead = false;\r
\r
#if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES)\r
SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);\r
SignatureDescriptor.Header.bDescriptorType = DTYPE_String;\r
#endif\r
\r
+ uint8_t SigReadAddress = 0x0E;\r
+\r
for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)\r
{\r
uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);\r
\r
- if (OddNibbleRead)\r
+ if (SerialCharNum & 0x01)\r
{\r
SerialByte >>= 4;\r
SigReadAddress++;\r
}\r
- else\r
- {\r
- SerialByte &= 0x0F;\r
- }\r
\r
- OddNibbleRead = !(OddNibbleRead);\r
-\r
- if (SerialByte < 0x0A)\r
- SerialByte += '0';\r
- else\r
- SerialByte += ('A' - 0x0A);\r
-\r
- SignatureDescriptor.UnicodeString[SerialCharNum] = SerialByte;\r
+ SignatureDescriptor.UnicodeString[SerialCharNum] = USB_Device_NibbleToASCII(SerialByte);\r
}\r
\r
Endpoint_ClearSETUP();\r
static void USB_Device_ClearSetFeature(void);\r
\r
#if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))\r
+ static char USB_Device_NibbleToASCII(uint8_t Nibble) ATTR_ALWAYS_INLINE;\r
static void USB_Device_GetInternalSerialDescriptor(void);\r
#endif \r
#endif\r