diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2013-05-20 16:40:26 +0200 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2013-05-20 16:40:26 +0200 |
commit | f8353236821c2194f3fffd38c26f77d056e66555 (patch) | |
tree | a17706597917aa8ea3f5b22ce93dc4b1afa3fced /Demos/Device/LowLevel/GenericHID | |
parent | b37bde56753fc19bcab04ab4e24d5922b65026a4 (diff) | |
parent | 10448970e5c4c5ad374f0887532fedc0daf97c42 (diff) | |
download | lufa-f8353236821c2194f3fffd38c26f77d056e66555.tar.gz lufa-f8353236821c2194f3fffd38c26f77d056e66555.tar.bz2 lufa-f8353236821c2194f3fffd38c26f77d056e66555.zip |
Merge branch 'XMEGA-Demo-Ports-ClockOnly'
Diffstat (limited to 'Demos/Device/LowLevel/GenericHID')
-rw-r--r-- | Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h | 33 | ||||
-rw-r--r-- | Demos/Device/LowLevel/GenericHID/GenericHID.c | 12 | ||||
-rw-r--r-- | Demos/Device/LowLevel/GenericHID/GenericHID.h | 3 | ||||
-rw-r--r-- | Demos/Device/LowLevel/GenericHID/GenericHID.txt | 5 | ||||
-rw-r--r-- | Demos/Device/LowLevel/GenericHID/asf.xml | 20 |
5 files changed, 67 insertions, 6 deletions
diff --git a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h b/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h index 3244d3bb7..a4ca3437f 100644 --- a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h @@ -85,6 +85,39 @@ // #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. diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index 10b344f7d..2c5519603 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -57,12 +57,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(); diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h index 806eda0df..3a3c86cd6 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.h +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h @@ -46,9 +46,10 @@ #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. */ diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.txt b/Demos/Device/LowLevel/GenericHID/GenericHID.txt index 3d72345f3..140274039 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.txt +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.txt @@ -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> diff --git a/Demos/Device/LowLevel/GenericHID/asf.xml b/Demos/Device/LowLevel/GenericHID/asf.xml index 27e09ca17..44fa5cf29 100644 --- a/Demos/Device/LowLevel/GenericHID/asf.xml +++ b/Demos/Device/LowLevel/GenericHID/asf.xml @@ -1,14 +1,26 @@ <asf xmlversion="1.0">
- <project caption="Generic HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example">
+ <project caption="Generic HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example.avr8">
<require idref="lufa.demos.device.lowlevel.generic_hid"/>
<require idref="lufa.boards.dummy.avr8"/>
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
- <config name="lufa.drivers.board.name" value="usbkey"/>
+ <config name="lufa.drivers.board.name" value="none"/>
- <build type="define" name="F_CPU" value="8000000UL"/>
- <build type="define" name="F_USB" value="8000000UL"/>
+ <build type="define" name="F_CPU" value="16000000UL"/>
+ <build type="define" name="F_USB" value="16000000UL"/>
+ </project>
+
+ <project caption="Generic HID Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.generic_hid.example.xmega">
+ <require idref="lufa.demos.device.lowlevel.generic_hid"/>
+ <require idref="lufa.boards.dummy.xmega"/>
+ <generator value="as5_8"/>
+
+ <device-support value="atxmega128a1u"/>
+ <config name="lufa.drivers.board.name" value="none"/>
+
+ <build type="define" name="F_CPU" value="32000000UL"/>
+ <build type="define" name="F_USB" value="48000000UL"/>
</project>
<module type="application" id="lufa.demos.device.lowlevel.generic_hid" caption="Generic HID Device Demo (Low Level APIs)">
|