Management and configuration functions for the ADC module.
The API functions and definitions can be divided in three groups:
Data Structures | |
struct | adc_config |
ADC configuration. More... | |
Macros | |
#define | ADC_NR_OF_CHANNELS 4 |
Number of channels per ADC. More... | |
Enumerations | |
enum | adc_calibration_data { ADC_CAL_ADCA, ADC_CAL_ADCB, ADC_CAL_TEMPSENSE, ADC_CAL_HOTTEMP, ADC_CAL_TEMPSENSE2, ADC_CAL_ROOMTEMP } |
ADC calibration data. More... | |
enum | adc_reference { ADC_REF_BANDGAP = ADC_REFSEL_INT1V_gc, ADC_REF_VCC = ADC_REFSEL_INTVCC_gc, ADC_REF_AREFA = ADC_REFSEL_AREFA_gc, ADC_REF_AREFB = ADC_REFSEL_AREFB_gc, ADC_REF_VCCDIV2 = ADC_REFSEL_VCCDIV2_gc } |
ADC reference settings. More... | |
enum | adc_resolution { ADC_RES_8 = ADC_RESOLUTION_8BIT_gc, ADC_RES_12 = ADC_RESOLUTION_12BIT_gc, ADC_RES_12_LEFT = ADC_RESOLUTION_LEFT12BIT_gc } |
ADC resolution settings. More... | |
enum | adc_sign { ADC_SIGN_OFF, ADC_SIGN_ON = ADC_CONMODE_bm } |
ADC signedness settings. More... | |
enum | adc_trigger { ADC_TRIG_MANUAL, ADC_TRIG_FREERUN, ADC_TRIG_EVENT_SINGLE, ADC_TRIG_FREERUN_SWEEP, ADC_TRIG_EVENT_SWEEP, ADC_TRIG_EVENT_SYNCSWEEP } |
ADC conversion trigger settings. More... | |
Calibration data addresses | |
| |
#define | ADCACAL0 offsetof(NVM_PROD_SIGNATURES_t, ADCACAL0) |
ADC A, calibration byte 0. More... | |
#define | ADCACAL1 offsetof(NVM_PROD_SIGNATURES_t, ADCACAL1) |
ADC A, calibration byte 1. More... | |
#define | ADCBCAL0 offsetof(NVM_PROD_SIGNATURES_t, ADCBCAL0) |
ADC B, calibration byte 0. More... | |
#define | ADCBCAL1 offsetof(NVM_PROD_SIGNATURES_t, ADCBCAL1) |
ADC B, calibration byte 1. More... | |
#define | TEMPSENSE0 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE0) |
Temperature sensor calibration byte 0. More... | |
#define | TEMPSENSE1 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE1) |
Temperature sensor calibration byte 1. More... | |
#define | HOTTEMP offsetof(NVM_PROD_SIGNATURES_t, HOTTEMP) |
Temperature at which TEMPSENSE1/TEMPSENSE0 is measured. More... | |
#define | ROOMTEMP offsetof(NVM_PROD_SIGNATURES_t, ROOMTEMP) |
Temperature at which TEMPSENSE3/TEMPSENSE2 is measured. More... | |
#define | TEMPSENSE2 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE2) |
Temperature sensor calibration byte 2. More... | |
#define | TEMPSENSE3 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE3) |
Temperature sensor calibration byte 3. More... | |
ADC channel masks | |
#define | ADC_CH0 (1U << 0) |
ADC channel 0. More... | |
#define | ADC_CH1 (1U << 1) |
ADC channel 1. More... | |
#define | ADC_CH2 (1U << 2) |
ADC channel 2. More... | |
#define | ADC_CH3 (1U << 3) |
ADC channel 3. More... | |
Internal ADC input masks | |
#define | ADC_INT_TEMPSENSE ADC_TEMPREF_bm |
Temperature sensor. More... | |
#define | ADC_INT_BANDGAP ADC_BANDGAP_bm |
Bandgap reference. More... | |
Internal functions for driver | |
static __always_inline ADC_CH_t * | adc_get_channel (ADC_t *adc, uint8_t ch_mask) |
Get ADC channel pointer from channel mask. More... | |
ADC interrupt callback function | |
typedef CONFIG_ADC_CALLBACK_TYPE | adc_result_t |
Datatype of ADC conversion result parameter for callback. More... | |
typedef void(* | adc_callback_t )(ADC_t *adc, uint8_t ch_mask, adc_result_t res) |
ADC interrupt callback function pointer. More... | |
void | adc_set_callback (ADC_t *adc, adc_callback_t callback) |
Set ADC interrupt callback function. More... | |
#define | CONFIG_ADC_CALLBACK_ENABLE |
Configuration symbol to enable callback on ADC interrupts. More... | |
#define | CONFIG_ADC_CALLBACK_TYPE uint16_t |
Configuration symbol for datatype of result parameter for callback. More... | |
ADC module management | |
void | adc_enable (ADC_t *adc) |
Enable ADC. More... | |
void | adc_disable (ADC_t *adc) |
Disable ADC. More... | |
bool | adc_is_enabled (ADC_t *adc) |
Check if the ADC is enabled. More... | |
static void | adc_start_conversion (ADC_t *adc, uint8_t ch_mask) |
Start one-shot conversion on ADC channel(s) More... | |
static int16_t | adc_get_signed_result (ADC_t *adc, uint8_t ch_mask) |
Get signed result from ADC channel. More... | |
static uint16_t | adc_get_unsigned_result (ADC_t *adc, uint8_t ch_mask) |
Get unsigned result from ADC channel. More... | |
static uint8_t | adc_get_interrupt_flag (ADC_t *adc, uint8_t ch_mask) |
Get interrupt flag of ADC channel(s) More... | |
static void | adc_clear_interrupt_flag (ADC_t *adc, uint8_t ch_mask) |
Clear interrupt flag of ADC channel(s) More... | |
static void | adc_wait_for_interrupt_flag (ADC_t *adc, uint8_t ch_mask) |
Wait for interrupt flag of ADC channel(s) More... | |
static void | adc_flush (ADC_t *adc) |
Flush the ADC. More... | |
static int16_t | adc_get_signed_compare_value (ADC_t *adc) |
Get signed compare value directly from ADC. More... | |
static uint16_t | adc_get_unsigned_compare_value (ADC_t *adc) |
Get unsigned compare value directly from ADC. More... | |
static uint16_t | adc_get_calibration_data (enum adc_calibration_data cal) |
Get calibration data. More... | |
#define | adc_get_result(adc, ch_mask) (adc_get_channel(adc, ch_mask)->RES) |
Get result from ADC channel. More... | |
#define | adc_set_compare_value(adc, val) |
Set compare value directly to ADC. More... | |
#define | adc_get_compare_value(adc) ((adc)->CMP) |
Get compare value directly from ADC. More... | |
ADC module configuration | |
enum | adc_gainstage_impmode { ADC_GAIN_HIGHIMPEDANCE, ADC_GAIN_LOWIMPEDANCE } |
ADC gain stage impedance settings. More... | |
enum | adc_current_limit { ADC_CURRENT_LIMIT_NO, ADC_CURRENT_LIMIT_LOW, ADC_CURRENT_LIMIT_MED, ADC_CURRENT_LIMIT_HIGH } |
ADC current limit settings. More... | |
void | adc_write_configuration (ADC_t *adc, const struct adc_config *conf) |
Write configuration to ADC module. More... | |
void | adc_read_configuration (ADC_t *adc, struct adc_config *conf) |
Read configuration from ADC module. More... | |
static void | adc_set_clock_rate (struct adc_config *conf, uint32_t clk_adc) |
Set ADC prescaler to get desired clock rate. More... | |
static void | adc_set_conversion_parameters (struct adc_config *conf, enum adc_sign sign, enum adc_resolution res, enum adc_reference ref) |
Set ADC conversion parameters. More... | |
static void | adc_set_conversion_trigger (struct adc_config *conf, enum adc_trigger trig, uint8_t nr_of_ch, uint8_t base_ev_ch) |
Set ADC conversion trigger. More... | |
static void | adc_set_dma_request_group (struct adc_config *conf, uint8_t nr_of_ch) |
Set DMA request group. More... | |
static void | adc_enable_internal_input (struct adc_config *conf, uint8_t int_inp) |
Enable internal ADC input. More... | |
static void | adc_disable_internal_input (struct adc_config *conf, uint8_t int_inp) |
Disable internal ADC input. More... | |
static void | adc_set_gain_impedance_mode (struct adc_config *conf, enum adc_gainstage_impmode impmode) |
Set ADC gain stage impedance mode. More... | |
static void | adc_set_current_limit (struct adc_config *conf, enum adc_current_limit currlimit) |
Set ADC current limit. More... | |
#define | adc_set_config_compare_value(conf, val) |
Set ADC compare value in configuration. More... | |
#define | adc_get_config_compare_value(conf) (conf->cmp) |
Get ADC compare value from configuration. More... | |
#define ADC_CH0 (1U << 0) |
ADC channel 0.
Referenced by adcch_read_configuration(), adcch_write_configuration(), get_mean_sample_value(), ISR(), and main().
#define ADC_CH1 (1U << 1) |
ADC channel 1.
#define ADC_CH2 (1U << 2) |
ADC channel 2.
#define ADC_CH3 (1U << 3) |
ADC channel 3.
#define adc_get_compare_value | ( | adc | ) | ((adc)->CMP) |
Get compare value directly from ADC.
Gets the compare value directly from the ADC, for quick access while the ADC is enabled.
adc | Pointer to ADC module. |
#define adc_get_config_compare_value | ( | conf | ) | (conf->cmp) |
Get ADC compare value from configuration.
conf | Pointer to ADC module configuration. |
#define adc_get_result | ( | adc, | |
ch_mask | |||
) | (adc_get_channel(adc, ch_mask)->RES) |
Get result from ADC channel.
Gets the latest conversion result from the ADC channel.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
Referenced by differential_signed_average(), get_mean_sample_value(), ISR(), and single_ended_unsigned_average().
#define ADC_INT_BANDGAP ADC_BANDGAP_bm |
Bandgap reference.
#define ADC_INT_TEMPSENSE ADC_TEMPREF_bm |
Temperature sensor.
Referenced by main().
#define ADC_NR_OF_CHANNELS 4 |
Number of channels per ADC.
Referenced by adc_get_channel(), adc_set_conversion_trigger(), and adc_set_dma_request_group().
#define adc_set_compare_value | ( | adc, | |
val | |||
) |
Set compare value directly to ADC.
Sets the compare value directly to the ADC, for quick access while the ADC is enabled.
adc | Pointer to ADC module. |
val | Compare value to set, either signed or unsigned. |
#define adc_set_config_compare_value | ( | conf, | |
val | |||
) |
Set ADC compare value in configuration.
conf | Pointer to ADC module configuration. |
val | Compare value to set. |
#define ADCACAL0 offsetof(NVM_PROD_SIGNATURES_t, ADCACAL0) |
ADC A, calibration byte 0.
Referenced by adc_get_calibration_data().
#define ADCACAL1 offsetof(NVM_PROD_SIGNATURES_t, ADCACAL1) |
ADC A, calibration byte 1.
Referenced by adc_get_calibration_data().
#define ADCBCAL0 offsetof(NVM_PROD_SIGNATURES_t, ADCBCAL0) |
ADC B, calibration byte 0.
Referenced by adc_get_calibration_data().
#define ADCBCAL1 offsetof(NVM_PROD_SIGNATURES_t, ADCBCAL1) |
ADC B, calibration byte 1.
Referenced by adc_get_calibration_data().
#define CONFIG_ADC_CALLBACK_ENABLE |
Configuration symbol to enable callback on ADC interrupts.
Define this symbol in conf_adc.h to enable callbacks on ADC interrupts. A function of type adc_callback_t must be defined by the user, and the driver be configured to use it with adc_set_callback.
#define CONFIG_ADC_CALLBACK_TYPE uint16_t |
Configuration symbol for datatype of result parameter for callback.
Define the datatype of the ADC conversion result parameter for callback functions. This should be defined according to the signedness and resolution of the conversions:
int16_t
for signed, 12-bituint16_t
for unsigned, 12-bit (the default type)int8_t
for signed, 8-bituint8_t
for unsigned, 8-bitDefine this in conf_adc.h if the default datatype is not desired.
#define HOTTEMP offsetof(NVM_PROD_SIGNATURES_t, HOTTEMP) |
Temperature at which TEMPSENSE1/TEMPSENSE0 is measured.
Referenced by adc_get_calibration_data().
#define ROOMTEMP offsetof(NVM_PROD_SIGNATURES_t, ROOMTEMP) |
Temperature at which TEMPSENSE3/TEMPSENSE2 is measured.
Referenced by adc_get_calibration_data().
#define TEMPSENSE0 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE0) |
Temperature sensor calibration byte 0.
Referenced by adc_get_calibration_data().
#define TEMPSENSE1 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE1) |
Temperature sensor calibration byte 1.
Referenced by adc_get_calibration_data().
#define TEMPSENSE2 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE2) |
Temperature sensor calibration byte 2.
Referenced by adc_get_calibration_data().
#define TEMPSENSE3 offsetof(NVM_PROD_SIGNATURES_t, TEMPSENSE3) |
Temperature sensor calibration byte 3.
Referenced by adc_get_calibration_data().
typedef void(* adc_callback_t)(ADC_t *adc, uint8_t ch_mask, adc_result_t res) |
ADC interrupt callback function pointer.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
res | ADC conversion result. |
typedef CONFIG_ADC_CALLBACK_TYPE adc_result_t |
Datatype of ADC conversion result parameter for callback.
enum adc_calibration_data |
ADC calibration data.
enum adc_current_limit |
enum adc_reference |
ADC reference settings.
enum adc_resolution |
enum adc_sign |
enum adc_trigger |
ADC conversion trigger settings.
|
inlinestatic |
Clear interrupt flag of ADC channel(s)
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
Referenced by adc_wait_for_interrupt_flag().
void adc_disable | ( | ADC_t * | adc | ) |
Disable ADC.
Disables the ADC and unlocks IDLE mode for the sleep manager.
adc | Pointer to ADC module |
References adc_disable_clock(), cpu_irq_restore(), cpu_irq_save(), SLEEPMGR_IDLE, and sleepmgr_unlock_mode().
Referenced by differential_signed_average(), and single_ended_unsigned_average().
|
inlinestatic |
Disable internal ADC input.
conf | Pointer to ADC module configuration. |
int_inp | Internal input to disable:
|
References adc_config::refctrl.
void adc_enable | ( | ADC_t * | adc | ) |
Enable ADC.
Enables the ADC and locks IDLE mode for the sleep manager.
adc | Pointer to ADC module |
References adc_enable_clock(), cpu_irq_restore(), cpu_irq_save(), SLEEPMGR_IDLE, and sleepmgr_lock_mode().
Referenced by differential_signed_average(), main(), and single_ended_unsigned_average().
|
inlinestatic |
Enable internal ADC input.
conf | Pointer to ADC module configuration. |
int_inp | Internal input to enable:
|
References adc_config::refctrl.
Referenced by main().
|
inlinestatic |
Flush the ADC.
Forces the ADC to abort any ongoing conversions and restart its clock on the next peripheral clock cycle. Pending conversions are started after the clock reset.
adc | Pointer to ADC module. |
References cpu_irq_restore(), and cpu_irq_save().
|
inlinestatic |
Get calibration data.
cal | Identifier for calibration data to get. |
References ADC_CAL_ADCA, ADC_CAL_ADCB, ADC_CAL_HOTTEMP, ADC_CAL_ROOMTEMP, ADC_CAL_TEMPSENSE, ADC_CAL_TEMPSENSE2, ADCACAL0, ADCACAL1, ADCBCAL0, ADCBCAL1, Assert, data, HOTTEMP, nvm_read_production_signature_row(), ROOMTEMP, TEMPSENSE0, TEMPSENSE1, TEMPSENSE2, and TEMPSENSE3.
Referenced by adc_write_configuration(), and main().
|
static |
Get ADC channel pointer from channel mask.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
References ADC_NR_OF_CHANNELS, and Assert.
Referenced by adc_get_signed_result(), adc_get_unsigned_result(), adcch_read_configuration(), and adcch_write_configuration().
|
inlinestatic |
Get interrupt flag of ADC channel(s)
Returns the interrupt flag of the masked channels. The meaning of the interrupt flag depends on what mode the individual channels are in.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
Referenced by adc_wait_for_interrupt_flag().
|
inlinestatic |
Get signed compare value directly from ADC.
Gets the signed compare value directly from the ADC, with interrupt protection of the 16-bit read, for quick access while the ADC is enabled.
adc | Pointer to ADC module. |
References cpu_irq_restore(), and cpu_irq_save().
|
inlinestatic |
Get signed result from ADC channel.
Returns the latest conversion result from the ADC channel as a signed type, with interrupt protection of the 16-bit read.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
References adc_get_channel(), cpu_irq_restore(), and cpu_irq_save().
|
inlinestatic |
Get unsigned compare value directly from ADC.
Gets the unsigned compare value directly from the ADC, with interrupt protection of the 16-bit read, for quick access while the ADC is enabled.
adc | Pointer to ADC module. |
References cpu_irq_restore(), and cpu_irq_save().
|
inlinestatic |
Get unsigned result from ADC channel.
Returns the latest conversion result from the ADC channel as an unsigned type, with interrupt protection of the 16-bit read.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
References adc_get_channel(), cpu_irq_restore(), and cpu_irq_save().
bool adc_is_enabled | ( | ADC_t * | adc | ) |
Check if the ADC is enabled.
adc | Pointer to ADC module. |
true | if ADC is enabled. |
false | if ADC is disabled. |
References Assert.
void adc_read_configuration | ( | ADC_t * | adc, |
struct adc_config * | conf | ||
) |
Read configuration from ADC module.
Reads out the current configuration of the ADC module to the specified buffer.
adc | Pointer to ADC module. |
conf | Pointer to ADC module configuration. |
References adc_disable_clock(), adc_enable_clock(), adc_config::cmp, cpu_irq_restore(), cpu_irq_save(), adc_config::ctrla, adc_config::ctrlb, adc_config::evctrl, adc_config::prescaler, and adc_config::refctrl.
Referenced by main(), run_differential_12bit_conversion_test(), run_differential_12bit_with_gain_conversion_test(), run_dual_channel_12bit_conversion_test(), run_dual_channel_8bit_conversion_test(), run_single_channel_12bit_conversion_test(), run_single_channel_8bit_conversion_test(), run_single_ended_12bit_conversion_test(), and run_single_ended_8bit_conversion_test().
void adc_set_callback | ( | ADC_t * | adc, |
adc_callback_t | callback | ||
) |
Set ADC interrupt callback function.
Sets a new callback function for interrupts on the specified ADC.
adc | Pointer to ADC module. |
callback | Pointer to the callback function to set. |
References Assert, cpu_irq_restore(), and cpu_irq_save().
Referenced by main().
|
inlinestatic |
Set ADC prescaler to get desired clock rate.
Sets the ADC prescaling so that its clock rate becomes at most clk_adc_hz. This is done by computing the ratio of the peripheral clock rate to the desired ADC clock rate, and rounding it upward to the nearest prescaling factor.
conf | Pointer to ADC module configuration. |
clk_adc | Desired ADC clock rate. |
References Assert, adc_config::prescaler, and sysclk_get_per_hz().
Referenced by main(), run_differential_12bit_conversion_test(), run_differential_12bit_with_gain_conversion_test(), run_dual_channel_12bit_conversion_test(), run_dual_channel_8bit_conversion_test(), run_single_channel_12bit_conversion_test(), run_single_channel_8bit_conversion_test(), run_single_ended_12bit_conversion_test(), and run_single_ended_8bit_conversion_test().
|
inlinestatic |
Set ADC conversion parameters.
Sets the signedness, resolution and voltage reference for conversions in the ADC module configuration.
conf | Pointer to ADC module configuration. |
sign | Conversion signedness. |
res | Resolution of conversions. |
ref | Voltage reference to use. |
References adc_config::ctrlb, and adc_config::refctrl.
Referenced by main(), run_differential_12bit_conversion_test(), run_differential_12bit_with_gain_conversion_test(), run_dual_channel_12bit_conversion_test(), run_dual_channel_8bit_conversion_test(), run_single_channel_12bit_conversion_test(), run_single_channel_8bit_conversion_test(), run_single_ended_12bit_conversion_test(), and run_single_ended_8bit_conversion_test().
|
inlinestatic |
Set ADC conversion trigger.
Configures the conversion triggering of the ADC.
For automatic triggering modes, the number of channels to start conversions on must be specified with nr_of_ch. The channel selection for these modes is incrementally inclusive, always starting with channel 0.
For event triggered modes, the base event channel must also be specified with base_ev_ch. The event channels are assigned to the ADC channels in an incremental fashion without wrap-around (in single-trigger event mode). This means that the maximum base event channel that can be used is determined by the number of ADC channels to start conversions on, i.e., nr_of_ch.
conf | Pointer to ADC module configuration. |
trig | Conversion trigger to set. |
nr_of_ch | Number of ADC channels to trigger conversions on:
|
base_ev_ch | Base event channel, if used. |
References ADC_EVACT_SYNCSWEEP_gc, ADC_NR_OF_CHANNELS, ADC_TRIG_EVENT_SINGLE, ADC_TRIG_EVENT_SWEEP, ADC_TRIG_EVENT_SYNCSWEEP, ADC_TRIG_FREERUN, ADC_TRIG_FREERUN_SWEEP, ADC_TRIG_MANUAL, Assert, adc_config::ctrlb, and adc_config::evctrl.
Referenced by main(), run_differential_12bit_conversion_test(), run_differential_12bit_with_gain_conversion_test(), run_dual_channel_12bit_conversion_test(), run_dual_channel_8bit_conversion_test(), run_single_channel_12bit_conversion_test(), run_single_channel_8bit_conversion_test(), run_single_ended_12bit_conversion_test(), and run_single_ended_8bit_conversion_test().
|
inlinestatic |
Set ADC current limit.
Set the current limit mode for the ADC module. This setting affects the max sampling rate of the ADC.
conf | Pointer to ADC module configuration. |
currlimit | Current limit setting. |
References ADC_CURRENT_LIMIT_HIGH, ADC_CURRENT_LIMIT_LOW, ADC_CURRENT_LIMIT_MED, ADC_CURRENT_LIMIT_NO, ADC_CURRLIMIT_gm, ADC_CURRLIMIT_HIGH_gc, ADC_CURRLIMIT_LOW_gc, ADC_CURRLIMIT_MED_gc, ADC_CURRLIMIT_NO_gc, Assert, and adc_config::ctrlb.
|
inlinestatic |
Set DMA request group.
Configures the DMA group request for the specified number of ADC channels. The channel group selection is incrementally inclusive, always starting with channel 0.
conf | Pointer to ADC module configuration. |
nr_of_ch | Number of channels for group request:
|
References ADC_NR_OF_CHANNELS, Assert, and adc_config::ctrla.
|
inlinestatic |
Set ADC gain stage impedance mode.
conf | Pointer to ADC module configuration. |
impmode | Gain stage impedance mode. |
References ADC_GAIN_HIGHIMPEDANCE, ADC_GAIN_LOWIMPEDANCE, Assert, and adc_config::ctrlb.
|
inlinestatic |
Start one-shot conversion on ADC channel(s)
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
References cpu_irq_restore(), and cpu_irq_save().
Referenced by adc_handler(), differential_signed_average(), get_mean_sample_value(), ISR(), main(), and single_ended_unsigned_average().
|
inlinestatic |
Wait for interrupt flag of ADC channel(s)
Waits for the interrupt flag of the specified channel(s) to be set, then clears it before returning. If several channels are masked, the function will wait for all interrupt flags to be set.
adc | Pointer to ADC module. |
ch_mask | Mask of ADC channel(s):
|
References adc_clear_interrupt_flag(), and adc_get_interrupt_flag().
Referenced by differential_signed_average(), get_mean_sample_value(), main(), and single_ended_unsigned_average().
void adc_write_configuration | ( | ADC_t * | adc, |
const struct adc_config * | conf | ||
) |
Write configuration to ADC module.
Disables the ADC and flushes its pipeline before writing the specified configuration and factory calibration value to it. If the ADC was enabled upon entry of the function, it is enabled upon function return.
adc | Pointer to ADC module. |
conf | Pointer to ADC module configuration. |
References ADC_CAL_ADCA, ADC_CAL_ADCB, adc_disable_clock(), adc_enable_clock(), adc_get_calibration_data(), Assert, adc_config::cmp, cpu_irq_restore(), cpu_irq_save(), adc_config::ctrla, adc_config::ctrlb, adc_config::evctrl, adc_config::prescaler, and adc_config::refctrl.
Referenced by main(), run_differential_12bit_conversion_test(), run_differential_12bit_with_gain_conversion_test(), run_dual_channel_12bit_conversion_test(), run_dual_channel_8bit_conversion_test(), run_single_channel_12bit_conversion_test(), run_single_channel_8bit_conversion_test(), run_single_ended_12bit_conversion_test(), and run_single_ended_8bit_conversion_test().