Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ADC - Analog to Digital Converter

Analog to Digital Converter is able to capture analog signals and transform them into digital format with 10-bit resolution.

Modules

 

Macros

#define ADC_MAX_VALUE   0x3FF
 Max value for ADC resolution. More...
 

Functions

bool adc_check_eoc (volatile avr32_adc_t *adc, uint16_t channel)
 Check channel conversion status. More...
 
bool adc_check_ovr (volatile avr32_adc_t *adc, uint16_t channel)
 Check channel conversion overrun error. More...
 
void adc_configure (volatile avr32_adc_t *adc)
 Configure ADC. More...
 
void adc_disable (volatile avr32_adc_t *adc, uint16_t channel)
 Disable channel. More...
 
void adc_enable (volatile avr32_adc_t *adc, uint16_t channel)
 Enable channel. More...
 
uint32_t adc_get_latest_value (volatile avr32_adc_t *adc)
 Wait for the next converted data and return its value. More...
 
bool adc_get_status (volatile avr32_adc_t *adc, uint16_t channel)
 Get channel 0 to 7 status. More...
 
uint32_t adc_get_value (volatile avr32_adc_t *adc, uint16_t channel)
 Get channel value. More...
 
void adc_start (volatile avr32_adc_t *adc)
 Start analog to digital conversion. More...
 

#define ADC_MAX_VALUE   0x3FF

Max value for ADC resolution.

Referenced by b_light_get_value(), and b_potentiometer_get_value().

bool adc_check_eoc ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Check channel conversion status.

Parameters
*adcBase address of the ADC
channelchannel to check (0 to 7)
Returns
bool true if conversion not running false if conversion running

References Assert, and NULL.

Referenced by adc_get_value().

bool adc_check_ovr ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Check channel conversion overrun error.

Parameters
*adcBase address of the ADC
channelchannel to check (0 to 7)
Returns
bool FAIL if an error occurred PASS if no error occurred

References Assert, FAIL, NULL, and PASS.

void adc_configure ( volatile avr32_adc_t *  adc)

Configure ADC.

Mandatory to call. If not called, ADC channels will have side effects

Parameters
*adcBase address of the ADC

References Assert, and NULL.

Referenced by acc_init(), adc_init(), bsensor_start(), init_adc(), main(), and rtouch_prepare_adc().

void adc_disable ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Disable channel.

Parameters
*adcBase address of the ADC
channelchannel to disable (0 to 7)

References adc_get_status(), Assert, and NULL.

Referenced by acc_get_value(), b_light_get_value(), b_potentiometer_get_value(), and b_temperature_get_value().

void adc_enable ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Enable channel.

Parameters
*adcBase address of the ADC
channelchannel to enable (0 to 7)

References Assert, and NULL.

Referenced by acc_get_value(), adc_init(), b_light_get_value(), b_potentiometer_get_value(), b_temperature_get_value(), init_adc(), and main().

uint32_t adc_get_latest_value ( volatile avr32_adc_t *  adc)

Wait for the next converted data and return its value.

Parameters
*adcBase address of the ADC
Returns
The latest converted value (unsigned long)

References Assert, and NULL.

bool adc_get_status ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Get channel 0 to 7 status.

Parameters
*adcBase address of the ADC
channelchannel to handle (0 to 7)
Returns
bool true if channel is enabled false if channel is disabled

References Assert, and NULL.

Referenced by adc_disable().

uint32_t adc_get_value ( volatile avr32_adc_t *  adc,
uint16_t  channel 
)

Get channel value.

Parameters
*adcBase address of the ADC
channelchannel to handle (0 to 7)
Returns
The value acquired (unsigned long)

References adc_check_eoc(), Assert, and NULL.

Referenced by acc_get_value(), b_light_get_value(), b_potentiometer_get_value(), b_temperature_get_value(), get_adc(), and main().

void adc_start ( volatile avr32_adc_t *  adc)

Start analog to digital conversion.

Parameters
*adcBase address of the ADC

References Assert, and NULL.

Referenced by acc_get_value(), b_light_get_value(), b_potentiometer_get_value(), b_temperature_get_value(), get_adc(), main(), and rtouch_start_read().