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

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

Functions

void adc_ch_set_config (struct adc_dev_inst *const dev_inst, struct adc_ch_config *cfg)
 Configure ADC channel with specified value. More...
 
void adc_disable (struct adc_dev_inst *const dev_inst)
 Disable ADC module. More...
 
status_code_t adc_enable (struct adc_dev_inst *const dev_inst)
 Enable ADC module. More...
 
status_code_t adc_init (struct adc_dev_inst *const dev_inst, Adcife *const adc, struct adc_config *const cfg)
 Initialize the ADC module. More...
 
static void adc_interrupt (void)
 Common ADCIFE interrupt handler. More...
 
void adc_pdca_set_config (struct adc_pdca_config *cfg)
 Configure ADC sequencer support multi-channel mode. More...
 
void adc_set_callback (struct adc_dev_inst *const dev_inst, adc_interrupt_source_t source, adc_callback_t callback, uint8_t irq_line, uint8_t irq_level)
 Set callback for ADC. More...
 
void adc_set_config (struct adc_dev_inst *const dev_inst, struct adc_config *cfg)
 Configure ADC with specified value. More...
 
void ADCIFE_Handler (void)
 Interrupt handler for ADCIFE interrupt. More...
 

Variables

adc_callback_t adc_callback_pointer
 

void adc_ch_set_config ( struct adc_dev_inst *const  dev_inst,
struct adc_ch_config cfg 
)

Configure ADC channel with specified value.

Parameters
dev_instDevice structure pointer.
cfgPointer to ADC Channel configuration.

References adc_configure_wm_mode(), adc_configure_wm_threshold(), adc_ch_config::high_threshold, adc_dev_inst::hw_dev, adc_ch_config::low_threshold, adc_ch_config::seq_cfg, and adc_ch_config::window_mode.

Referenced by run_adcife_diff_test(), run_adcife_itimer_trig_test(), and run_adcife_wm_test().

void adc_disable ( struct adc_dev_inst *const  dev_inst)

Disable ADC module.

Parameters
dev_instDevice structure pointer.

References adc_dev_inst::hw_dev, SLEEPMGR_SLEEP_1, sleepmgr_unlock_mode(), and sysclk_disable_peripheral_clock().

Referenced by run_adcife_wm_test().

status_code_t adc_enable ( struct adc_dev_inst *const  dev_inst)

Enable ADC module.

Parameters
dev_instDevice structure pointer.

References ADC_NUM_OF_ATTEMPTS, ERR_TIMEOUT, adc_dev_inst::hw_dev, sleepmgr_lock_mode(), SLEEPMGR_SLEEP_1, STATUS_OK, and sysclk_enable_peripheral_clock().

Referenced by run_adcife_init_test().

status_code_t adc_init ( struct adc_dev_inst *const  dev_inst,
Adcife *const  adc,
struct adc_config *const  cfg 
)

Initialize the ADC module.

Parameters
dev_instDevice structure pointer.
adcBase address of the ADC instance.
cfgPointer to AES configuration.
Return values
trueif the initialization was successful.
falseif initialization failed.

References adc_dev_inst::adc_cfg, adc_set_config(), Assert, adc_dev_inst::hw_dev, STATUS_OK, sysclk_disable_peripheral_clock(), and sysclk_enable_peripheral_clock().

Referenced by run_adcife_init_test().

static void adc_interrupt ( void  )
static

Common ADCIFE interrupt handler.

The optional callback used by the interrupt handler is set by the adcife_set_callback() function.

References adc_callback_pointer.

Referenced by ADCIFE_Handler().

void adc_pdca_set_config ( struct adc_pdca_config cfg)
void adc_set_callback ( struct adc_dev_inst *const  dev_inst,
adc_interrupt_source_t  source,
adc_callback_t  callback,
uint8_t  irq_line,
uint8_t  irq_level 
)

Set callback for ADC.

Parameters
dev_instDevice structure pointer.
sourceinterrupt source.
callbackcallback function pointer.
irq_lineinterrupt line.
irq_levelinterrupt level.

References adc_enable_interrupt(), and irq_register_handler.

Referenced by run_adcife_itimer_trig_test(), and run_adcife_wm_test().

void adc_set_config ( struct adc_dev_inst *const  dev_inst,
struct adc_config cfg 
)

Configure ADC with specified value.

Parameters
dev_instDevice structure pointer.
cfgPointer to ADC configuration.

References adc_config::clksel, CONFIG_ADC_GENERIC_DIV, CONFIG_ADC_GENERIC_SRC, genclk_enable_config(), adc_dev_inst::hw_dev, adc_config::prescal, adc_config::refsel, adc_config::speed, and adc_config::start_up.

Referenced by adc_init().

void ADCIFE_Handler ( void  )

Interrupt handler for ADCIFE interrupt.

References adc_interrupt().

adc_callback_t adc_callback_pointer

Referenced by adc_interrupt().