aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2014-07-22 19:25:41 +1000
committerDean Camera <dean@fourwalledcubicle.com>2014-07-22 19:25:41 +1000
commit4c06a9c88fe6c9a294d5f7bda94528630da3ee3f (patch)
tree999752bdf3d9b7f25bd41cdb1c1b9c1f5943a03a
parent89df1efcf3ecb625c172a47def21e18912fc46f3 (diff)
downloadlufa-4c06a9c88fe6c9a294d5f7bda94528630da3ee3f.tar.gz
lufa-4c06a9c88fe6c9a294d5f7bda94528630da3ee3f.tar.bz2
lufa-4c06a9c88fe6c9a294d5f7bda94528630da3ee3f.zip
Minor code style fixes, documentation improvements.
-rw-r--r--LUFA/DoxygenPages/ChangeLog.txt1
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c9
2 files changed, 6 insertions, 4 deletions
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index e16fcbec1..d8f1d73fe 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -20,6 +20,7 @@
* - Fixed incorrect XMEGA DFLL reference frequency (thanks to Martin Aakerberg)
* - Fixed possible infinite loop in the control endpoint stream write function (thanks to Clayton Knight)
* - Fixed missing HID report ID prefix on HID class driver GetReport request responses (thanks to Bert van Hall)
+ * - Fixed incorrect XMEGA USB controller clock division factory for non-Full Speed operation (thanks to Bert van Hall)
* - Library Applications:
* - Fixed spurious 0xFE USART byte sent in the USBtoSerial project when the baud rate is changed (thanks to Carl Kjeldsen)
* - Fixed blocking USART reads causing low throughput on slow baud rates in the USBtoSerial project (thanks to Nevada Smith)
diff --git a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index b5de862f1..99589809e 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@ -110,7 +110,6 @@ void USB_Disable(void)
void USB_ResetInterface(void)
{
uint8_t PrescalerNeeded;
- uint8_t nbit = 0;
#if defined(USB_DEVICE_OPT_FULLSPEED)
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
@@ -121,12 +120,14 @@ void USB_ResetInterface(void)
PrescalerNeeded = F_USB / 6000000;
#endif
- while (PrescalerNeeded && nbit < 7) {
+ uint8_t DividerIndex = 0;
+ while (PrescalerNeeded > 0)
+ {
+ DividerIndex++;
PrescalerNeeded >>= 1;
- nbit++;
}
- CLK.USBCTRL = (nbit - 1) << CLK_USBPSDIV_gp;
+ CLK.USBCTRL = (DividerIndex - 1) << CLK_USBPSDIV_gp;
if (USB_Options & USB_OPT_PLLCLKSRC)
CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm);