/** 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();
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** Maximum audio sample value for the microphone input. */
<asf xmlversion="1.0">\r
- <project caption="Audio Input Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.audio_input.example">\r
+ <project caption="Audio Input Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.audio_input.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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.lowlevel.audio_input" caption="Audio Input Device Demo (Low Level APIs)">\r
/** 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();
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
<asf xmlversion="1.0">\r
- <project caption="Audio Output Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.audio_output.example">\r
+ <project caption="Audio Output Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.audio_output.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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.lowlevel.audio_output" caption="Audio Output Device Demo (Low Level APIs)">\r
// #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.
#define CDC2_RX_EPADDR (ENDPOINT_DIR_OUT | 5)
/** Endpoint address of the second CDC interface's device-to-host notification IN endpoint. */
- #define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
+ #define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8
/** 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();
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Dual Virtual Serial Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example">\r
+ <project caption="Dual Virtual Serial Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.dual_cdc" caption="Dual Virtual Serial Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include "Descriptors.h"
#include "Config/AppConfig.h"
-
+
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
* <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>
<asf xmlversion="1.0">\r
- <project caption="Generic HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example">\r
+ <project caption="Generic HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.generic_hid" caption="Generic HID Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Joystick HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.joystick.example">\r
+ <project caption="Joystick HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.joystick.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.joystick.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.joystick" caption="Joystick HID Device Demo (Low Level APIs)">\r
// #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.
/** 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();
else
{
/* Check to see if the report data has changed - if so a report MUST be sent */
- SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
+ SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
}
/* Select the Keyboard Report Endpoint */
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Keyboard HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard.example">\r
+ <project caption="Keyboard HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.keyboard" caption="Keyboard HID Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Keyboard and Mouse HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard_mouse.example">\r
+ <project caption="Keyboard and Mouse HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard_mouse.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.keyboard_mouse.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.keyboard_mouse" caption="Keyboard and Mouse HID Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="MIDI Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.midi.example">\r
+ <project caption="MIDI Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.midi.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.midi.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.midi" caption="MIDI Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Dataflash.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Mass Storage Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.mass_storage.example">\r
+ <project caption="Mass Storage Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.mass_storage.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.mass_storage.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.mass_storage" caption="Mass Storage Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <string.h>
#include "Descriptors.h"
-
+
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Mouse HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.mouse.example">\r
+ <project caption="Mouse HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.mouse.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.mouse.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.mouse" caption="Mouse HID Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include "Lib/ARP.h"
#include "Lib/Webserver.h"
#include "Config/AppConfig.h"
-
+
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** Notification value to indicate that a frame is ready to be read by the host. */
*
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="RNDIS Ethernet Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.rndis.example">\r
+ <project caption="RNDIS Ethernet Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.rndis.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.rndis.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.rndis" caption="RNDIS Ethernet Device Demo (Low Level APIs)">\r
// #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.
/** 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();
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
* \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:
*
<asf xmlversion="1.0">\r
- <project caption="Virtual Serial CDC Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.cdc.example">\r
+ <project caption="Virtual Serial CDC Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.cdc.example.avr8">\r
<require idref="lufa.demos.device.lowlevel.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 (Low Level APIs)" id="lufa.demos.device.lowlevel.cdc.example.xmega">\r
+ <require idref="lufa.demos.device.lowlevel.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.lowlevel.cdc" caption="Virtual Serial CDC Device Demo (Low Level APIs)">\r