Add XMEGA support to the class driver demos where possible.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 19 May 2013 19:49:13 +0000 (21:49 +0200)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 19 May 2013 19:49:13 +0000 (21:49 +0200)
76 files changed:
Demos/Device/ClassDriver/AudioInput/AudioInput.c
Demos/Device/ClassDriver/AudioInput/AudioInput.h
Demos/Device/ClassDriver/AudioInput/asf.xml
Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
Demos/Device/ClassDriver/AudioOutput/asf.xml
Demos/Device/ClassDriver/DualVirtualSerial/Config/LUFAConfig.h
Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c
Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt
Demos/Device/ClassDriver/DualVirtualSerial/asf.xml
Demos/Device/ClassDriver/GenericHID/Config/LUFAConfig.h
Demos/Device/ClassDriver/GenericHID/GenericHID.c
Demos/Device/ClassDriver/GenericHID/GenericHID.h
Demos/Device/ClassDriver/GenericHID/GenericHID.txt
Demos/Device/ClassDriver/GenericHID/asf.xml
Demos/Device/ClassDriver/Joystick/Config/LUFAConfig.h
Demos/Device/ClassDriver/Joystick/Joystick.c
Demos/Device/ClassDriver/Joystick/Joystick.h
Demos/Device/ClassDriver/Joystick/Joystick.txt
Demos/Device/ClassDriver/Joystick/asf.xml
Demos/Device/ClassDriver/Keyboard/Config/LUFAConfig.h
Demos/Device/ClassDriver/Keyboard/Keyboard.c
Demos/Device/ClassDriver/Keyboard/Keyboard.h
Demos/Device/ClassDriver/Keyboard/Keyboard.txt
Demos/Device/ClassDriver/Keyboard/asf.xml
Demos/Device/ClassDriver/KeyboardMouse/Config/LUFAConfig.h
Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt
Demos/Device/ClassDriver/KeyboardMouse/asf.xml
Demos/Device/ClassDriver/KeyboardMouseMultiReport/Config/LUFAConfig.h
Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c
Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h
Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.txt
Demos/Device/ClassDriver/KeyboardMouseMultiReport/asf.xml
Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h
Demos/Device/ClassDriver/MIDI/MIDI.c
Demos/Device/ClassDriver/MIDI/MIDI.h
Demos/Device/ClassDriver/MIDI/MIDI.txt
Demos/Device/ClassDriver/MIDI/asf.xml
Demos/Device/ClassDriver/MassStorage/Config/LUFAConfig.h
Demos/Device/ClassDriver/MassStorage/MassStorage.c
Demos/Device/ClassDriver/MassStorage/MassStorage.h
Demos/Device/ClassDriver/MassStorage/MassStorage.txt
Demos/Device/ClassDriver/MassStorage/asf.xml
Demos/Device/ClassDriver/MassStorageKeyboard/Config/LUFAConfig.h
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt
Demos/Device/ClassDriver/MassStorageKeyboard/asf.xml
Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h
Demos/Device/ClassDriver/Mouse/Mouse.c
Demos/Device/ClassDriver/Mouse/Mouse.h
Demos/Device/ClassDriver/Mouse/Mouse.txt
Demos/Device/ClassDriver/Mouse/asf.xml
Demos/Device/ClassDriver/RNDISEthernet/Config/LUFAConfig.h
Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c
Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt
Demos/Device/ClassDriver/RNDISEthernet/asf.xml
Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h
Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c
Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt
Demos/Device/ClassDriver/VirtualSerial/asf.xml
Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/LUFAConfig.h
Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c
Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h
Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt
Demos/Device/ClassDriver/VirtualSerialMassStorage/asf.xml
Demos/Device/ClassDriver/VirtualSerialMouse/Config/LUFAConfig.h
Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c
Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt
Demos/Device/ClassDriver/VirtualSerialMouse/asf.xml

index c5ba9bc..9eec39c 100644 (file)
@@ -79,12 +79,14 @@ 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);
+#endif
 
        /* Hardware Initialization */
        LEDs_Init();
@@ -265,7 +267,7 @@ bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t*
                                                    const uint8_t EntityAddress,
                                                    const uint16_t Parameter,
                                                    uint16_t* const DataLength,
-                                                   uint8_t* Data) 
+                                                   uint8_t* Data)
 {
        /* No audio interface entities in the device descriptor, thus no properties to get or set. */
        return false;
index 093f3ee..14bbd2e 100644 (file)
@@ -46,6 +46,7 @@
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/Peripheral/ADC.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
                #include "Descriptors.h"
                #include "Config/AppConfig.h"
@@ -76,7 +77,7 @@
                void EVENT_USB_Device_Disconnect(void);
                void EVENT_USB_Device_ConfigurationChanged(void);
                void EVENT_USB_Device_ControlRequest(void);
-               
+
                bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
                                                                  const uint8_t EndpointProperty,
                                                                  const uint8_t EndpointAddress,
index b61714e..2a60a1e 100644 (file)
@@ -1,14 +1,14 @@
 <asf xmlversion="1.0">\r
-       <project caption="Audio Input Device Demo (Class Driver APIs)" id="lufa.demos.device.class.audio_input.example">\r
+       <project caption="Audio Input Device Demo (Class Driver APIs)" id="lufa.demos.device.class.audio_input.example.avr8">\r
                <require idref="lufa.demos.device.class.audio_input"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.audio_input" caption="Audio Input Device Demo (Class Driver APIs)">\r
index 22d19a4..81fd95b 100644 (file)
@@ -79,12 +79,14 @@ 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);
+#endif
 
        /* Hardware Initialization */
        LEDs_Init();
@@ -302,7 +304,7 @@ bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t*
                                                    const uint8_t EntityAddress,
                                                    const uint16_t Parameter,
                                                    uint16_t* const DataLength,
-                                                   uint8_t* Data) 
+                                                   uint8_t* Data)
 {
        /* No audio interface entities in the device descriptor, thus no properties to get or set. */
        return false;
index 802bec9..bf2d3c8 100644 (file)
@@ -48,6 +48,7 @@
 
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
@@ -81,6 +82,6 @@
                                                                   const uint8_t EntityAddress,
                                                                   const uint16_t Parameter,
                                                                   uint16_t* const DataLength,
-                                                                  uint8_t* Data);              
+                                                                  uint8_t* Data);
 #endif
 
index dacdbd5..5d0081b 100644 (file)
@@ -1,14 +1,14 @@
 <asf xmlversion="1.0">\r
-       <project caption="Audio Output Device Demo (Class Driver APIs)" id="lufa.demos.device.class.audio_output.example">\r
+       <project caption="Audio Output Device Demo (Class Driver APIs)" id="lufa.demos.device.class.audio_output.example.avr8">\r
                <require idref="lufa.demos.device.class.audio_output"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.audio_output" caption="Audio Output Device Demo (Class Driver APIs)">\r
index 3b33e2d..d2f780a 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               6
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index b7d0455..eaba618 100644 (file)
@@ -131,12 +131,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 */
        Joystick_Init();
index 0f4ae58..c0447af 100644 (file)
@@ -48,6 +48,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Joystick.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 70e95ad..1e8d3c5 100644 (file)
@@ -13,6 +13,9 @@
  *  \li Series 7 USB AVRs (AT90USBxxx7)
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 11a23eb..78ca488 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Dual Virtual Serial Device Demo (Class Driver APIs)" id="lufa.demos.device.class.dual_cdc.example">\r
+       <project caption="Dual Virtual Serial Device Demo (Class Driver APIs)" id="lufa.demos.device.class.dual_cdc.example.avr8">\r
                <require idref="lufa.demos.device.class.dual_cdc"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Dual Virtual Serial Device Demo (Class Driver APIs)" id="lufa.demos.device.class.dual_cdc.example.xmega">\r
+               <require idref="lufa.demos.device.class.dual_cdc"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.dual_cdc" caption="Dual Virtual Serial Device Demo (Class Driver APIs)">\r
index 3244d3b..3871759 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               1
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 95dd44d..aae3ea7 100644 (file)
@@ -80,12 +80,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();
index bb0a6cc..7b7ac9c 100644 (file)
 
                #include "Descriptors.h"
                #include "Config/AppConfig.h"
-               
+
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 3d72345..1402740 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
@@ -68,7 +71,7 @@
  *   <tr>
  *    <td>GENERIC_REPORT_SIZE</td>
  *    <td>AppConfig.h</td>
- *    <td>This token defines the size of the device reports, both sent and received (including report ID byte). The value 
+ *    <td>This token defines the size of the device reports, both sent and received (including report ID byte). The value
  *        must be an integer ranging from 1 to 255.</td>
  *   </tr>
  *  </table>
index 2b1ee5f..f64c7da 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Generic HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.generic_hid.example">\r
+       <project caption="Generic HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.generic_hid.example.avr8">\r
                <require idref="lufa.demos.device.class.generic_hid"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Generic HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.generic_hid.example.xmega">\r
+               <require idref="lufa.demos.device.class.generic_hid"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.generic_hid" caption="Generic HID Device Demo (Class Driver APIs)">\r
index 3244d3b..3871759 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               1
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index c4576ba..809c410 100644 (file)
@@ -80,12 +80,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 */
        Joystick_Init();
index 5eafa61..037e03d 100644 (file)
@@ -49,6 +49,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Type Defines: */
                /** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.
index 55be2c3..e3aec3d 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 2cae1e5..8810726 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Joystick HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.joystick.example">\r
+       <project caption="Joystick HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.joystick.example.avr8">\r
                <require idref="lufa.demos.device.class.joystick"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Joystick HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.joystick.example.xmega">\r
+               <require idref="lufa.demos.device.class.joystick"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.joystick" caption="Joystick HID Device Demo (Class Driver APIs)">\r
index 3244d3b..3871759 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               1
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 5c7a6f1..b3cc67e 100644 (file)
@@ -80,12 +80,24 @@ int main(void)
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware()
 {
+#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 */
        Joystick_Init();
index 853430a..38f50d1 100644 (file)
@@ -50,6 +50,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 3e7ff88..9b4375b 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index f298910..5defbee 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Keyboard HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard.example">\r
+       <project caption="Keyboard HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard.example.avr8">\r
                <require idref="lufa.demos.device.class.keyboard"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Keyboard HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard.example.xmega">\r
+               <require idref="lufa.demos.device.class.keyboard"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.keyboard" caption="Keyboard HID Device Demo (Class Driver APIs)">\r
index 3244d3b..4873f80 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               3
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 6b2e9bb..f663f16 100644 (file)
@@ -106,12 +106,24 @@ int main(void)
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware()
 {
+#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 */
        Joystick_Init();
index 7019849..2f1d01b 100644 (file)
@@ -45,6 +45,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index b994422..20c89cc 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index a530eed..9e3bd49 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Keyboard and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse.example">\r
+       <project caption="Keyboard and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse.example.avr8">\r
                <require idref="lufa.demos.device.class.keyboard_mouse"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Keyboard and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse.example.xmega">\r
+               <require idref="lufa.demos.device.class.keyboard_mouse"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.keyboard_mouse" caption="Keyboard and Mouse HID Device Demo (Class Driver APIs)">\r
index 3244d3b..3871759 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               1
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index b371041..f15d134 100644 (file)
@@ -80,12 +80,24 @@ int main(void)
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware()
 {
+#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 */
        Joystick_Init();
index 7019849..2f1d01b 100644 (file)
@@ -45,6 +45,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index e99a7dc..6ff910e 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 7c6d76d..65858aa 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Keyboard and Mouse HID (Multi Report) Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse_mr.example">\r
+       <project caption="Keyboard and Mouse HID (Multi Report) Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse_mr.example.avr8">\r
                <require idref="lufa.demos.device.class.keyboard_mouse_mr"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Keyboard and Mouse HID (Multi Report) Device Demo (Class Driver APIs)" id="lufa.demos.device.class.keyboard_mouse_mr.example.xmega">\r
+               <require idref="lufa.demos.device.class.keyboard_mouse_mr"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.keyboard_mouse_mr" caption="Keyboard and Mouse HID (Multi Report) Device Demo (Class Driver APIs)">\r
index 3244d3b..a4ca343 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               2
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 139c65e..bec4428 100644 (file)
@@ -92,12 +92,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 */
        Joystick_Init();
index 54dbef2..ca4fa3b 100644 (file)
@@ -50,6 +50,7 @@
                #include <LUFA/Drivers/Board/Joystick.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 362250c..9ac3d9e 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 6212b48..8a7479d 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="MIDI Device Demo (Class Driver APIs)" id="lufa.demos.device.class.midi.example">\r
+       <project caption="MIDI Device Demo (Class Driver APIs)" id="lufa.demos.device.class.midi.example.avr8">\r
                <require idref="lufa.demos.device.class.midi"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="MIDI Device Demo (Class Driver APIs)" id="lufa.demos.device.class.midi.example.xmega">\r
+               <require idref="lufa.demos.device.class.midi"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.midi" caption="MIDI Device Demo (Class Driver APIs)">\r
index 3b33e2d..da728ec 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               4
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 598698a..a0fa7a2 100644 (file)
@@ -82,12 +82,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();
index cfeea80..55e1796 100644 (file)
@@ -51,6 +51,7 @@
 
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 5bf7c55..dd71e3b 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 4d10f3c..2615273 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage.example">\r
+       <project caption="Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage.example.avr8">\r
                <require idref="lufa.demos.device.class.mass_storage"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage.example.xmega">\r
+               <require idref="lufa.demos.device.class.mass_storage"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.mass_storage" caption="Mass Storage Device Demo (Class Driver APIs)">\r
index 3b33e2d..9d358ed 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               5
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 0076178..05fdfbe 100644 (file)
@@ -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();
index 2e213c9..05b5a84 100644 (file)
@@ -56,6 +56,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 7cdb472..d9affad 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 3b53aec..cd0a101 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Mass Storage and HID Keyboard Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage_keyboard.example">\r
+       <project caption="Mass Storage and HID Keyboard Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage_keyboard.example.avr8">\r
                <require idref="lufa.demos.device.class.mass_storage_keyboard"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Mass Storage and HID Keyboard Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mass_storage_keyboard.example.xmega">\r
+               <require idref="lufa.demos.device.class.mass_storage_keyboard"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.mass_storage_keyboard" caption="Mass Storage and HID Keyboard Device Demo (Class Driver APIs)">\r
index 3244d3b..3871759 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               1
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index c9caa1c..8432b65 100644 (file)
@@ -80,12 +80,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 */
        Joystick_Init();
index 371ef6c..e63c935 100644 (file)
@@ -51,6 +51,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index d1277a2..e4673ae 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index f501963..7ad6b94 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mouse.example">\r
+       <project caption="Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mouse.example.avr8">\r
                <require idref="lufa.demos.device.class.mouse"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.mouse.example.xmega">\r
+               <require idref="lufa.demos.device.class.mouse"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.mouse" caption="Mouse HID Device Demo (Class Driver APIs)">\r
index 3244d3b..4873f80 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               3
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index ef643a8..54d5511 100644 (file)
@@ -115,12 +115,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();
index 57fdc4e..839a53b 100644 (file)
                #include "Lib/ARP.h"
                #include "Lib/Webserver.h"
                #include "Config/AppConfig.h"
-               
+
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Peripheral/Serial.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index ac72d4a..aafa3cc 100644 (file)
@@ -12,6 +12,9 @@
  *
  *  \li Series 7 USB AVRs (AT90USBxxx7)
  *  \li Series 6 USB AVRs (AT90USBxxx6)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 9aef273..3084f41 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="RNDIS Ethernet Device Demo (Class Driver APIs)" id="lufa.demos.device.class.rndis.example">\r
+       <project caption="RNDIS Ethernet Device Demo (Class Driver APIs)" id="lufa.demos.device.class.rndis.example.avr8">\r
                <require idref="lufa.demos.device.class.rndis"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="RNDIS Ethernet Device Demo (Class Driver APIs)" id="lufa.demos.device.class.rndis.example.xmega">\r
+               <require idref="lufa.demos.device.class.rndis"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.rndis" caption="RNDIS Ethernet Device Demo (Class Driver APIs)">\r
index 3b33e2d..da728ec 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               4
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 07bb842..0079acb 100644 (file)
@@ -100,12 +100,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 */
        Joystick_Init();
index 3353996..2e10366 100644 (file)
@@ -49,6 +49,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Joystick.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index e0a3291..61b6656 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index c719468..64ce25f 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Virtual Serial CDC Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc.example">\r
+       <project caption="Virtual Serial CDC Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc.example.avr8">\r
                <require idref="lufa.demos.device.class.cdc"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Virtual Serial CDC Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc.example.xmega">\r
+               <require idref="lufa.demos.device.class.cdc"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.cdc" caption="Virtual Serial CDC Device Demo (Class Driver APIs)">\r
index 3b33e2d..9d358ed 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               5
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index cc146a9..f1dc049 100644 (file)
@@ -126,12 +126,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();
index 413164d..c191f09 100644 (file)
@@ -52,6 +52,7 @@
                #include <LUFA/Drivers/Board/LEDs.h>
                #include <LUFA/Drivers/Board/Joystick.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index 0422441..62a7c3d 100644 (file)
@@ -13,6 +13,9 @@
  *  \li Series 7 USB AVRs (AT90USBxxx7)
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index beae956..6a21768 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Virtual Serial CDC and Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_ms.example">\r
+       <project caption="Virtual Serial CDC and Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_ms.example.avr8">\r
                <require idref="lufa.demos.device.class.cdc_ms"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Virtual Serial CDC and Mass Storage Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_ms.example.xmega">\r
+               <require idref="lufa.demos.device.class.cdc_ms"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.cdc_ms" caption="Virtual Serial CDC and Mass Storage Device Demo (Class Driver APIs)">\r
index 3b33e2d..da728ec 100644 (file)
 //             #define NO_AUTO_VBUS_MANAGEMENT
 //             #define INVERTED_VBUS_ENABLE_LINE
 
+       #elif (ARCH == ARCH_XMEGA)
+
+               /* Non-USB Related Configuration Tokens: */
+//             #define DISABLE_TERMINAL_CODES
+
+               /* USB Class Driver Related Tokens: */
+//             #define HID_HOST_BOOT_PROTOCOL_ONLY
+//             #define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
+//             #define HID_USAGE_STACK_DEPTH            {Insert Value Here}
+//             #define HID_MAX_COLLECTIONS              {Insert Value Here}
+//             #define HID_MAX_REPORTITEMS              {Insert Value Here}
+//             #define HID_MAX_REPORT_IDS               {Insert Value Here}
+//             #define NO_CLASS_DRIVER_AUTOFLUSH
+
+               /* General USB Driver Related Tokens: */
+               #define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+//             #define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
+//             #define NO_LIMITED_CONTROLLER_CONNECT
+//             #define NO_SOF_EVENTS
+
+               /* USB Device Mode Driver Related Tokens: */
+//             #define USE_RAM_DESCRIPTORS
+               #define USE_FLASH_DESCRIPTORS
+//             #define USE_EEPROM_DESCRIPTORS
+//             #define NO_INTERNAL_SERIAL
+               #define FIXED_CONTROL_ENDPOINT_SIZE      8
+//             #define DEVICE_STATE_AS_GPIOR            {Insert Value Here}
+               #define FIXED_NUM_CONFIGURATIONS         1
+//             #define CONTROL_ONLY_DEVICE
+               #define MAX_ENDPOINT_INDEX               4
+//             #define NO_DEVICE_REMOTE_WAKEUP
+//             #define NO_DEVICE_SELF_POWER
+
        #else
 
                #error Unsupported architecture for this LUFA configuration file.
index 54b8534..73f9e38 100644 (file)
@@ -116,12 +116,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 */
        Joystick_Init();
index b4db433..0e9a721 100644 (file)
@@ -49,6 +49,7 @@
                #include <LUFA/Drivers/Board/Joystick.h>
                #include <LUFA/Drivers/Board/Buttons.h>
                #include <LUFA/Drivers/USB/USB.h>
+               #include <LUFA/Platform/Platform.h>
 
        /* Macros: */
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
index fe6328b..96b3178 100644 (file)
@@ -14,6 +14,9 @@
  *  \li Series 6 USB AVRs (AT90USBxxx6)
  *  \li Series 4 USB AVRs (ATMEGAxxU4)
  *  \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
+ *  \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ *  \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ *  \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
  *
  *  \section Sec_Info USB Information:
  *
index 61bb17f..e555710 100644 (file)
@@ -1,14 +1,26 @@
 <asf xmlversion="1.0">\r
-       <project caption="Virtual Serial CDC and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_mouse.example">\r
+       <project caption="Virtual Serial CDC and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_mouse.example.avr8">\r
                <require idref="lufa.demos.device.class.cdc_mouse"/>\r
                <require idref="lufa.boards.dummy.avr8"/>\r
                <generator value="as5_8"/>\r
 \r
                <device-support value="at90usb1287"/>\r
-               <config name="lufa.drivers.board.name" value="usbkey"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
 \r
-               <build type="define" name="F_CPU" value="8000000UL"/>\r
-               <build type="define" name="F_USB" value="8000000UL"/>\r
+               <build type="define" name="F_CPU" value="16000000UL"/>\r
+               <build type="define" name="F_USB" value="16000000UL"/>\r
+       </project>\r
+\r
+       <project caption="Virtual Serial CDC and Mouse HID Device Demo (Class Driver APIs)" id="lufa.demos.device.class.cdc_mouse.example.xmega">\r
+               <require idref="lufa.demos.device.class.cdc_mouse"/>\r
+               <require idref="lufa.boards.dummy.xmega"/>\r
+               <generator value="as5_8"/>\r
+\r
+               <device-support value="atxmega128a1u"/>\r
+               <config name="lufa.drivers.board.name" value="none"/>\r
+\r
+               <build type="define" name="F_CPU" value="32000000UL"/>\r
+               <build type="define" name="F_USB" value="48000000UL"/>\r
        </project>\r
 \r
        <module type="application" id="lufa.demos.device.class.cdc_mouse" caption="Virtual Serial CDC and Mouse HID Device Demo (Class Driver APIs)">\r