![]() |
LUFA Library
120219
|
Module Clock Driver for the AVR USB XMEGA microcontrollers. More...
The following files must be built with any user project that uses this module:
Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration of the various clocks within the device to clock the various peripherals.
Usage Example:
#include <LUFA/Platform/XMEGA/ClockManagement.h> void main(void) { // 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, 32000000); XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL, F_CPU); // 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, 48000000); }
Enum for the possible external oscillator frequency ranges.
Enum for the possible external oscillator statup times.
Enum for the possible module clock sources.
Enum for the possible DFLL clock reference sources.
static bool XMEGACLK_SetCPUClockSource | ( | const uint8_t | Source | ) | [inline, static] |
Sets the clock source for the main microcontroller core. The given clock source should be configured and ready for use before this function is called.
[in] | Source | Clock source for the CPU core, a value from XMEGA_System_ClockSource_t. |
true
if the CPU core clock was sucessfully altered, false
if invalid parameters specified. static bool XMEGACLK_StartDFLL | ( | const uint8_t | Source, |
const uint8_t | Reference, | ||
const uint32_t | Frequency | ||
) | [inline, static] |
Starts the DFLL of the XMEGA microcontroller, with the given options.
[in] | Source | RC Clock source for the DFLL, a value from XMEGA_System_ClockSource_t. |
[in] | Reference | Reference clock source for the DFLL, an value from XMEGA_System_DFLLReference_t |
[in] | Frequency | Target frequency of the DFLL's output. |
true
if the DFLL was successfully started, false
if invalid parameters specified. static bool XMEGACLK_StartExternalOscillator | ( | const uint8_t | FreqRange, |
const uint8_t | Startup | ||
) | [inline, static] |
Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until the oscillator is ready for use.
[in] | FreqRange | Frequency range of the external oscillator, a value from XMEGA_Extern_OSC_ClockFrequency_t. |
[in] | Startup | Statup time of the external oscillator, a value from XMEGA_Extern_OSC_ClockStartup_t. |
true
if the external oscillator was successfully started, false
if invalid parameters specified. static uint8_t XMEGACLK_StartInternalOscillator | ( | const uint8_t | Source | ) | [inline, static] |
Starts the given internal oscillator of the XMEGA microcontroller, with the given options. This routine blocks until the oscillator is ready for use.
[in] | Source | Internal oscillator to start, a value from XMEGA_System_ClockSource_t. |
true
if the internal oscillator was successfully started, false
if invalid parameters specified. static bool XMEGACLK_StartPLL | ( | const uint8_t | Source, |
const uint32_t | SourceFreq, | ||
const uint32_t | Frequency | ||
) | [inline, static] |
Starts the PLL of the XMEGA microcontroller, with the given options. This routine blocks until the PLL is ready for use.
[in] | Source | Clock source for the PLL, a value from XMEGA_System_ClockSource_t. |
[in] | SourceFreq | Frequency of the PLL's clock source, in Hz. |
[in] | Frequency | Target frequency of the PLL's output. |
true
if the PLL was successfully started, false
if invalid parameters specified. static bool XMEGACLK_StopDFLL | ( | const uint8_t | Source | ) | [inline, static] |
Stops the given DFLL of the XMEGA microcontroller.
[in] | Source | RC Clock source for the DFLL to be stopped, a value from XMEGA_System_ClockSource_t. |
true
if the DFLL was successfully stopped, false
if invalid parameters specified. static void XMEGACLK_StopExternalOscillator | ( | void | ) | [inline, static] |
Stops the external oscillator of the XMEGA microcontroller.
static bool XMEGACLK_StopInternalOscillator | ( | const uint8_t | Source | ) | [inline, static] |
Stops the given internal oscillator of the XMEGA microcontroller.
[in] | Source | Internal oscillator to stop, a value from XMEGA_System_ClockSource_t. |
true
if the internal oscillator was successfully stopped, false
if invalid parameters specified. static void XMEGACLK_StopPLL | ( | void | ) | [inline, static] |
Stops the PLL of the XMEGA microcontroller.