Add in a new common Delay_MS() function, which provides a blocking delay for all...
[pub/lufa.git] / LUFA / Drivers / USB / Core / UC3 / Device_UC3.h
index 8389d62..150b188 100644 (file)
 \r
                        static inline void USB_Device_GetSerialString(uint16_t* UnicodeString)\r
                        {\r
-                               ATOMIC_BLOCK(ATOMIC_RESTORESTATE)\r
+                               uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();\r
+                               USB_INT_GlobalDisable();\r
+                               \r
+                               uint8_t* SigReadAddress = (uint8_t*)0x80800204;\r
+\r
+                               for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)\r
                                {\r
-                                       uint8_t* SigReadAddress = (uint8_t*)0x80800204;\r
+                                       uint8_t SerialByte = *SigReadAddress;\r
 \r
-                                       for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)\r
+                                       if (SerialCharNum & 0x01)\r
                                        {\r
-                                               uint8_t SerialByte = *SigReadAddress;\r
-\r
-                                               if (SerialCharNum & 0x01)\r
-                                               {\r
-                                                       SerialByte >>= 4;\r
-                                                       SigReadAddress++;\r
-                                               }\r
+                                               SerialByte >>= 4;\r
+                                               SigReadAddress++;\r
+                                       }\r
 \r
-                                               SerialByte &= 0x0F;\r
+                                       SerialByte &= 0x0F;\r
 \r
-                                               UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?\r
-                                                                                          (('A' - 10) + SerialByte) : ('0' + SerialByte));\r
-                                       }\r
+                                       UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?\r
+                                                                                                                          (('A' - 10) + SerialByte) : ('0' + SerialByte));\r
                                }\r
+                               \r
+                               USB_INT_SetGlobalEnableState(CurrentGlobalInt);\r
                        }\r
        #endif\r
 \r