Microchip® Advanced Software Framework

adc.h File Reference

Analog-to-Digital Converter (ADC/ADC12B) driver for SAM.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"

Macros

#define ADC_FREQ_MAX   20000000
 
#define ADC_FREQ_MIN   1000000
 
#define ADC_STARTUP_FAST   12
 
#define ADC_STARTUP_NORM   40
 

Enumerations

enum  adc_gainvalue_t {
  ADC_GAINVALUE_0 = 0,
  ADC_GAINVALUE_1 = 1,
  ADC_GAINVALUE_2 = 2,
  ADC_GAINVALUE_3 = 3
}
 
enum  adc_trigger_t {
  ADC_TRIG_SW = ADC_MR_TRGEN_DIS,
  ADC_TRIG_EXT = ADC_MR_TRGSEL_ADC_TRIG0 | ADC_MR_TRGEN,
  ADC_TRIG_TIO_CH_0 = ADC_MR_TRGSEL_ADC_TRIG1 | ADC_MR_TRGEN,
  ADC_TRIG_TIO_CH_1 = ADC_MR_TRGSEL_ADC_TRIG2 | ADC_MR_TRGEN,
  ADC_TRIG_TIO_CH_2 = ADC_MR_TRGSEL_ADC_TRIG3 | ADC_MR_TRGEN
}
 

Functions

void adc_disable_all_channel (Adc *p_adc)
 Disable all ADC channel. More...
 
void adc_disable_channel (Adc *p_adc, const enum adc_channel_num_t adc_ch)
 Disable the specified ADC channel. More...
 
void adc_disable_interrupt (Adc *p_adc, const uint32_t ul_source)
 Disable ADC interrupts. More...
 
void adc_enable_all_channel (Adc *p_adc)
 Enable all ADC channels. More...
 
void adc_enable_channel (Adc *p_adc, const enum adc_channel_num_t adc_ch)
 Enable the specified ADC channel. More...
 
void adc_enable_interrupt (Adc *p_adc, const uint32_t ul_source)
 Enable ADC interrupts. More...
 
uint32_t adc_get_actual_adc_clock (const Adc *p_adc, const uint32_t ul_mck)
 Return the actual ADC clock. More...
 
uint32_t adc_get_channel_status (const Adc *p_adc, const enum adc_channel_num_t adc_ch)
 Read the ADC channel status. More...
 
uint32_t adc_get_channel_value (const Adc *p_adc, const enum adc_channel_num_t adc_ch)
 Read the ADC result data of the specified channel. More...
 
uint32_t adc_get_interrupt_mask (const Adc *p_adc)
 Read ADC interrupt mask. More...
 
uint32_t adc_get_latest_value (const Adc *p_adc)
 Read the last ADC result data. More...
 
Pdc * adc_get_pdc_base (const Adc *p_adc)
 Get PDC registers base address. More...
 
uint32_t adc_get_status (const Adc *p_adc)
 
void adc_reset (Adc *p_adc)
 Reset ADC. More...
 
void adc_set_resolution (Adc *p_adc, const enum adc_resolution_t resolution)
 Configure the conversion resolution. More...
 
void adc_start (Adc *p_adc)
 Start analog-to-digital conversion. More...
 

#define ADC_FREQ_MAX   20000000
#define ADC_FREQ_MIN   1000000
#define ADC_STARTUP_FAST   12
#define ADC_STARTUP_NORM   40

Enumerator
ADC_GAINVALUE_0 
ADC_GAINVALUE_1 
ADC_GAINVALUE_2 
ADC_GAINVALUE_3 
Enumerator
ADC_TRIG_SW 
ADC_TRIG_EXT 
ADC_TRIG_TIO_CH_0 
ADC_TRIG_TIO_CH_1 
ADC_TRIG_TIO_CH_2 

uint32_t adc_get_status ( const Adc *  p_adc)