XgAt91Adc


Defines

#define AT91_ADC_INITIAL_MODE   SINGLE_CONVERSION
#define AT91_ADC_INITIAL_PRESCALE   55
#define AT91_ADC_BUF_SIZE   16
#define _adc_buf_head   AT91_ADC_BUF_SIZE
#define _adc_buf_tail   AT91_ADC_BUF_SIZE+1

Functions

int ADCBufRead (uint16_t channel, uint16_t *read)
 Reads data from the adc buffer.
void ADCSetMode (TADCMode mode)
 Sets the data aquisition mode for the adc.
void ADCEnableChannel (TADCChannel channel)
 Enable a channel used to sample when conversion started.
void ADCDisableChannel (TADCChannel channel)
 Disable a channel.
void ADCSetPrescale (u_int prescale)
 Set the prescaler for the adc.
void ADCStartConversion (void)
 Start conversion.
void ADCInit (void)
 Initialize the adc to the configured default values and enable interrupt.

Variables

uint16_t ** ADC_Buffer = NULL


Define Documentation

#define AT91_ADC_INITIAL_MODE   SINGLE_CONVERSION

Definition at line 62 of file at91_adc.c.

Referenced by ADCInit().

#define AT91_ADC_INITIAL_PRESCALE   55

Definition at line 66 of file at91_adc.c.

Referenced by ADCInit().

#define AT91_ADC_BUF_SIZE   16

Definition at line 69 of file at91_adc.c.

Referenced by ADCBufRead(), and ADCInit().

#define _adc_buf_head   AT91_ADC_BUF_SIZE

Definition at line 71 of file at91_adc.c.

#define _adc_buf_tail   AT91_ADC_BUF_SIZE+1

Definition at line 72 of file at91_adc.c.


Function Documentation

int ADCBufRead ( uint16_t  channel,
uint16_t read 
)

Reads data from the adc buffer.

Parameters:
channel Specifies the channel to read data from
read Variable to store the data in
Returns:
0: data read succesfully, 1: no data available

Definition at line 84 of file at91_adc.c.

References _adc_buf_head, _adc_buf_tail, ADC_Buffer, and AT91_ADC_BUF_SIZE.

void ADCSetMode ( TADCMode  mode  ) 

Sets the data aquisition mode for the adc.

Parameters:
mode Mode to set

Definition at line 118 of file at91_adc.c.

References ADC_MR, ADC_OFF, ADC_SLEEP, ADC_TRGEN, ADC_TRGSEL, ADC_TRGSEL_EXT, ADC_TRGSEL_TIOA0, ADC_TRGSEL_TIOA1, ADC_TRGSEL_TIOA2, FREE_RUNNING_EXT, FREE_RUNNING_T0, FREE_RUNNING_T1, FREE_RUNNING_T2, inr, outr, and SINGLE_CONVERSION.

void ADCEnableChannel ( TADCChannel  channel  ) 

Enable a channel used to sample when conversion started.

Parameters:
channel Specifies the channel to enable

Definition at line 158 of file at91_adc.c.

References _BV, ADC_CHER, ADC_IER, and outr.

void ADCDisableChannel ( TADCChannel  channel  ) 

Disable a channel.

Parameters:
channel Specifies the channel to disable

Definition at line 170 of file at91_adc.c.

References _BV, ADC_CHER, ADC_IDR, and outr.

void ADCSetPrescale ( u_int  prescale  ) 

Set the prescaler for the adc.

Parameters:
prescale Prescaler value 0-128

Definition at line 182 of file at91_adc.c.

References ADC_MR, ADC_PRESCAL, ADC_PRESCAL_LSB, ADC_SHTIM, ADC_STARTUP, inr, and outr.

void ADCStartConversion ( void   ) 

Start conversion.

Definition at line 196 of file at91_adc.c.

References ADC_CR, ADC_START, and outr.

void ADCInit ( void   ) 

Initialize the adc to the configured default values and enable interrupt.

Definition at line 225 of file at91_adc.c.

References _adc_buf_head, _adc_buf_tail, _BV, ADC_Buffer, ADC_CH0, ADC_CH1, ADC_CH2, ADC_CH3, ADC_CH4, ADC_CH5, ADC_CH6, ADC_CH7, ADC_CHDR, ADC_CR, ADC_ID, ADC_SWRST, ADCSetMode(), ADCSetPrescale(), AT91_ADC_BUF_SIZE, AT91_ADC_INITIAL_MODE, AT91_ADC_INITIAL_PRESCALE, NutHeapAlloc(), NutIrqEnable(), NutRegisterIrqHandler(), outr, PMC_PCER, and sig_ADC.


Variable Documentation

uint16_t** ADC_Buffer = NULL

Definition at line 74 of file at91_adc.c.

Referenced by ADCBufRead(), and ADCInit().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/