Analog to Digital Converter is able to capture analog signals and transform them into digital format with 10-bit resolution.
#define ADC_MAX_VALUE 0x3FF |
Max value for ADC resolution.
bool adc_check_eoc |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Check channel conversion status.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to check (0 to 7) |
- Returns
- bool true if conversion not running false if conversion running
References Assert.
Referenced by adc_get_value().
bool adc_check_ovr |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Check channel conversion overrun error.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to check (0 to 7) |
- Returns
- bool FAIL if an error occurred PASS if no error occurred
References Assert, FAIL, 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
-
*adc | Base address of the ADC |
References Assert.
Referenced by main().
void adc_disable |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Disable channel.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to disable (0 to 7) |
References adc_get_status(), and Assert.
void adc_enable |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Enable channel.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to enable (0 to 7) |
References Assert.
Referenced by main().
uint32_t adc_get_latest_value |
( |
volatile avr32_adc_t * |
adc | ) |
|
Wait for the next converted data and return its value.
- Parameters
-
*adc | Base address of the ADC |
- Returns
- The latest converted value (unsigned long)
References Assert.
bool adc_get_status |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Get channel 0 to 7 status.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to handle (0 to 7) |
- Returns
- bool true if channel is enabled false if channel is disabled
References Assert.
Referenced by adc_disable().
uint32_t adc_get_value |
( |
volatile avr32_adc_t * |
adc, |
|
|
uint16_t |
channel |
|
) |
| |
Get channel value.
- Parameters
-
*adc | Base address of the ADC |
channel | channel to handle (0 to 7) |
- Returns
- The value acquired (unsigned long)
References adc_check_eoc(), and Assert.
Referenced by main().
void adc_start |
( |
volatile avr32_adc_t * |
adc | ) |
|
Start analog to digital conversion.
- Parameters
-
*adc | Base address of the ADC |
References Assert.
Referenced by main().