Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Analog-to-digital Converter (ADC)

See Quickstart guide for SAM ADC driver.

Driver for the Analog-to-digital Converter. This driver provides access to the main features of the ADC controller.

Modules

 
 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the Analog-to-digital Converter (ADC).
 

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...
 
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...
 

void adc_disable_all_channel ( Adc *  p_adc)

Disable all ADC channel.

Parameters
p_adcPointer to an ADC instance.
void adc_disable_channel ( Adc *  p_adc,
const enum adc_channel_num_t  adc_ch 
)

Disable the specified ADC channel.

Parameters
p_adcPointer to an ADC instance.
adc_chADC channel number.
void adc_disable_interrupt ( Adc *  p_adc,
const uint32_t  ul_source 
)

Disable ADC interrupts.

Parameters
p_adcPointer to an ADC instance.
ul_sourceInterrupts to be disabled.

Referenced by ADC_Handler(), demo_start_adc(), and main().

void adc_enable_all_channel ( Adc *  p_adc)

Enable all ADC channels.

Parameters
p_adcPointer to an ADC instance.
void adc_enable_channel ( Adc *  p_adc,
const enum adc_channel_num_t  adc_ch 
)

Enable the specified ADC channel.

Parameters
p_adcPointer to an ADC instance.
adc_chADC channel number.

Referenced by adc_input_init(), adp_example_adc_init(), configure_adc(), demo_config_adc(), main(), and start_adc().

void adc_enable_interrupt ( Adc *  p_adc,
const uint32_t  ul_source 
)

Enable ADC interrupts.

Parameters
p_adcPointer to an ADC instance.
ul_sourceInterrupts to be enabled.

Referenced by ADC_Handler(), adc_input_init(), demo_start_adc(), enter_asleep(), main(), and start_adc().

uint32_t adc_get_actual_adc_clock ( const Adc *  p_adc,
const uint32_t  ul_mck 
)

Return the actual ADC clock.

Parameters
p_adcPointer to an ADC instance.
ul_mckMain clock of the device (in Hz).
Returns
The actual ADC clock (in Hz).
uint32_t adc_get_channel_status ( const Adc *  p_adc,
const enum adc_channel_num_t  adc_ch 
)

Read the ADC channel status.

Parameters
p_adcPointer to an ADC instance.
adc_chADC channel number.
Return values
1if channel is enabled.
0if channel is disabled.
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.

Parameters
p_adcPointer to an ADC instance.
adc_chADC channel number.
Returns
ADC value of the specified channel.

Referenced by ADC_Handler(), demo_start_adc(), display_info(), and main().

uint32_t adc_get_interrupt_mask ( const Adc *  p_adc)

Read ADC interrupt mask.

Parameters
p_adcPointer to an ADC instance.
Returns
The interrupt mask value.
uint32_t adc_get_latest_value ( const Adc *  p_adc)

Read the last ADC result data.

Parameters
p_adcPointer to an ADC instance.
Returns
ADC latest value.

Referenced by adp_example_adc_get_value().

Pdc* adc_get_pdc_base ( const Adc *  p_adc)

Get PDC registers base address.

Parameters
p_adcPointer to an ADC instance.
Returns
ADC PDC register base address.

References UNUSED.

Referenced by adc_input_init().

void adc_reset ( Adc *  p_adc)

Reset ADC.

Parameters
p_adcPointer to an ADC instance.
void adc_set_resolution ( Adc *  p_adc,
const enum adc_resolution_t  resolution 
)

Configure the conversion resolution.

Parameters
p_adcPointer to an ADC instance.
resolutionADC resolution.

References resolution.

Referenced by adp_example_adc_init().

void adc_start ( Adc *  p_adc)

Start analog-to-digital conversion.

Note
If one of the hardware event is selected as ADC trigger, this function can NOT start analog to digital conversion.
Parameters
p_adcPointer to an ADC instance.

Referenced by adp_example_adc_get_value(), main(), and SysTick_Handler().