Xmega Application Note | |||||
AVR XMEGA Analog to Digital Converter driver. More...
#include <compiler.h>
#include <adc.h>
Go to the source code of this file.
Functions | |
void | adc_disable (ADC_t *adc) |
Disable ADC. | |
static void | adc_disable_clock (ADC_t *adc) |
Disable peripheral clock for ADC. | |
void | adc_enable (ADC_t *adc) |
Enable ADC. | |
static void | adc_enable_clock (ADC_t *adc) |
Enable peripheral clock for ADC. | |
bool | adc_is_enabled (ADC_t *adc) |
Check if the ADC is enabled. | |
void | adc_read_configuration (ADC_t *adc, struct adc_config *conf) |
Read configuration from ADC module. | |
void | adc_write_configuration (ADC_t *adc, const struct adc_config *conf) |
Write configuration to ADC module. | |
void | adcch_read_configuration (ADC_t *adc, uint8_t ch, struct adc_channel_config *ch_conf) |
Read configuration from ADC channel. | |
void | adcch_write_configuration (ADC_t *adc, uint8_t ch, const struct adc_channel_config *ch_conf) |
Write configuration to ADC channel. |
AVR XMEGA Analog to Digital Converter driver.
Copyright (C) 2010 Atmel Corporation. All rights reserved.
Definition in file adc.c.
static void adc_disable_clock | ( | ADC_t * | adc | ) | [static] |
Disable peripheral clock for ADC.
For internal use only.
Decrements the enable count for the ADC, then disables its peripheral clock if the count hit zero. If the count did not hit zero, it indicates the ADC is enabled.
adc | Pointer to ADC module |
Definition at line 244 of file adc.c.
References Assert, SYSCLK_ADC, sysclk_disable_module(), SYSCLK_PORT_A, and SYSCLK_PORT_B.
Referenced by adc_disable(), adc_read_configuration(), adc_write_configuration(), adcch_read_configuration(), and adcch_write_configuration().
00245 { 00246 #ifdef ADCA 00247 if ((uintptr_t)adc == (uintptr_t)(&ADCA)) { 00248 Assert(adca_enable_count); 00249 if (!--adca_enable_count) { 00250 sysclk_disable_module(SYSCLK_PORT_A, SYSCLK_ADC); 00251 } 00252 } else 00253 #endif 00254 00255 #ifdef ADCB 00256 if ((uintptr_t)adc == (uintptr_t)(&ADCB)) { 00257 Assert(adcb_enable_count); 00258 if (!--adcb_enable_count) { 00259 sysclk_disable_module(SYSCLK_PORT_B, SYSCLK_ADC); 00260 } 00261 } else 00262 #endif 00263 00264 { 00265 Assert(0); 00266 } 00267 }
static void adc_enable_clock | ( | ADC_t * | adc | ) | [static] |
Enable peripheral clock for ADC.
For internal use only.
Checks if the enable count for the ADC is zero, then increments it. If the count was zero, the peripheral clock is enabled. Otherwise, it is already enabled.
adc | Pointer to ADC module. |
Definition at line 209 of file adc.c.
References Assert, SYSCLK_ADC, sysclk_enable_module(), SYSCLK_PORT_A, and SYSCLK_PORT_B.
Referenced by adc_enable(), adc_read_configuration(), adc_write_configuration(), adcch_read_configuration(), and adcch_write_configuration().
00210 { 00211 #ifdef ADCA 00212 if ((uintptr_t)adc == (uintptr_t)(&ADCA)) { 00213 Assert(adca_enable_count < 0xff); 00214 if (!adca_enable_count++) { 00215 sysclk_enable_module(SYSCLK_PORT_A, SYSCLK_ADC); 00216 } 00217 } else 00218 #endif 00219 00220 #ifdef ADCB 00221 if ((uintptr_t)adc == (uintptr_t)(&ADCB)) { 00222 Assert(adcb_enable_count < 0xff); 00223 if (!adcb_enable_count++) { 00224 sysclk_enable_module(SYSCLK_PORT_B, SYSCLK_ADC); 00225 } 00226 } else 00227 #endif 00228 00229 { 00230 Assert(0); 00231 } 00232 }
Generated on Fri Oct 22 12:15:25 2010 for AVR1300 Using the Xmega ADC by ![]() |