70 void CCPWrite(
volatile uint8_t * address, uint8_t value )
77 asm(
"ldi r16, 0xD8 \n" 81 #elif defined __GNUC__ 82 volatile uint8_t * tmpAddr = address;
92 :
"r" (tmpAddr),
"r" (value),
"M" (CCP_IOREG_gc),
"m" (CCP)
108 extern void CCPWrite(
volatile uint8_t __near * address, uint8_t value );
127 OSC_XOSCSEL_t xoscModeSelection )
129 OSC.XOSCCTRL = (uint8_t) freqRange |
130 ( lowPower32kHz ? OSC_X32KLPM_bm : 0 ) |
153 factor &= OSC_PLLFAC_gm;
154 OSC.PLLCTRL = (uint8_t) clockSource | ( factor << OSC_PLLFAC_gp );
174 uint8_t clkEnabled = OSC.CTRL & oscSel;
191 CLK_PSBCDIV_t PSBCfactor )
193 uint8_t PSconfig = (uint8_t) PSAfactor | PSBCfactor;
211 uint8_t clkCtrl = ( CLK.CTRL & ~CLK_SCLKSEL_gm ) | clockSource;
213 clkCtrl = ( CLK.CTRL & clockSource );
227 CLK.RTCCTRL = ( CLK.RTCCTRL & ~CLK_RTCSRC_gm ) |
246 OSC.DFLLCTRL = ( OSC.DFLLCTRL & ~clkSource ) |
247 ( extReference ? clkSource : 0 );
248 if (clkSource == OSC_RC2MCREF_bm) {
249 DFLLRC2M.CALA |= DFLL_ENABLE_bm;
250 }
else if (clkSource == OSC_RC2MCREF_bm) {
251 DFLLRC32M.CALA |= DFLL_ENABLE_bm;
266 CCPWrite( &OSC.XOSCFAIL, ( OSC_XOSCFDIF_bm | OSC_XOSCFDEN_bm ) );
void CLKSYS_Configuration_Lock(void)
This function lock the entire clock system configuration.
void CCPWrite(volatile uint8_t *address, uint8_t value)
void CLKSYS_Prescalers_Config(CLK_PSADIV_t PSAfactor, CLK_PSBCDIV_t PSBCfactor)
This function changes the prescaler configuration.
void CLKSYS_XOSC_Config(OSC_FRQRANGE_t freqRange, bool lowPower32kHz, OSC_XOSCSEL_t xoscModeSelection)
This function configures the external oscillator.
void CLKSYS_XOSC_FailureDetection_Enable(void)
This function enables the External Oscillator Failure Detection (XOSCFD) feature. ...
void CLKSYS_PLL_Config(OSC_PLLSRC_t clockSource, uint8_t factor)
This function configures the internal high-frequency PLL.
uint8_t CLKSYS_Main_ClockSource_Select(CLK_SCLKSEL_t clockSource)
This function selects the main system clock source.
void CLKSYS_AutoCalibration_Enable(uint8_t clkSource, bool extReference)
This function enables automatic calibration of the selected internal oscillator.
void CLKSYS_RTC_ClockSource_Enable(CLK_RTCSRC_t clockSource)
This function selects a Real-Time Counter clock source.
XMEGA Clock System driver header file.
uint8_t CLKSYS_Disable(uint8_t oscSel)
This function disables the selected oscillator.