aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-05-19 21:49:13 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-05-19 21:49:13 +0200
commit654baf7d609963cf25da328f2b3fc8ced0eaf68a (patch)
tree38dad4b3d6e7054a6538a3447a1db945417e914f /Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
parent847426272826c19eb7ab226465a7687ab47266ce (diff)
downloadlufa-654baf7d609963cf25da328f2b3fc8ced0eaf68a.tar.gz
lufa-654baf7d609963cf25da328f2b3fc8ced0eaf68a.tar.bz2
lufa-654baf7d609963cf25da328f2b3fc8ced0eaf68a.zip
Add XMEGA support to the class driver demos where possible.
Diffstat (limited to 'Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c')
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
index 00761785c..05fdfbe0c 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
@@ -106,12 +106,24 @@ int main(void)
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
+#if (ARCH == ARCH_AVR8)
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
+#elif (ARCH == ARCH_XMEGA)
+ /* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
+ XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
+ XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
+
+ /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
+ XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
+ XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
+
+ PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
+#endif
/* Hardware Initialization */
LEDs_Init();