diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-10-24 12:25:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-10-24 12:25:34 +0000 |
commit | 8f3bee7d8661c92ce69fdf7cc131fbee1acaa4ae (patch) | |
tree | 897f178335c8b992d61b8335eb43bab0b8eb81f7 /LUFA | |
parent | 5517f96e86b9447780a3e27bb455697f9fc65eea (diff) | |
download | lufa-8f3bee7d8661c92ce69fdf7cc131fbee1acaa4ae.tar.gz lufa-8f3bee7d8661c92ce69fdf7cc131fbee1acaa4ae.tar.bz2 lufa-8f3bee7d8661c92ce69fdf7cc131fbee1acaa4ae.zip |
Better algorithm to extract and convert the internal device serial number into a string descriptor (if present).
Fix incorrect warning text when an unsuitable F_CLOCK value is given.
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/USBController.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c index 960e24367..8b8f0c0eb 100644 --- a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c @@ -211,8 +211,8 @@ static void USB_Device_GetConfiguration(void) #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) static char USB_Device_NibbleToASCII(uint8_t Nibble) { - Nibble = ((Nibble & 0x0F) + '0'); - return (Nibble > '9') ? (Nibble + ('A' - '9' - 1)) : Nibble; + Nibble &= 0x0F; + return (Nibble >= 10) ? (('A' - 10) + Nibble) : ('0' + Nibble); } static void USB_Device_GetInternalSerialDescriptor(void) @@ -220,16 +220,16 @@ static void USB_Device_GetInternalSerialDescriptor(void) struct { USB_Descriptor_Header_t Header; - int16_t UnicodeString[20]; + wchar_t UnicodeString[20]; } SignatureDescriptor; SignatureDescriptor.Header.Type = DTYPE_String; SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor); - uint8_t SigReadAddress = 0x0E; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { + uint8_t SigReadAddress = 0x0E; + for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++) { uint8_t SerialByte = boot_signature_byte_get(SigReadAddress); diff --git a/LUFA/Drivers/USB/LowLevel/USBController.h b/LUFA/Drivers/USB/LowLevel/USBController.h index fb71eb504..950a42ba9 100644 --- a/LUFA/Drivers/USB/LowLevel/USBController.h +++ b/LUFA/Drivers/USB/LowLevel/USBController.h @@ -118,7 +118,7 @@ #endif #if !defined(USB_PLL_PSC) - #error No PLL prescale value available for chosen F_CPU value and AVR model. + #error No PLL prescale value available for chosen F_CLOCK value and AVR model. #endif /* Public Interface - May be used in end-application: */ |