Microchip® Advanced Software Framework

adcifa.h File Reference
#include <avr32/io.h>
#include "compiler.h"

Data Structures

struct  adcifa_opt_t
 Parameters for the ADCIFA peripheral. More...
 
struct  adcifa_sequencer_conversion_opt_t
 Parameters for an conversion in the Sequencer. More...
 
struct  adcifa_sequencer_opt_t
 Parameters for the configuration of the Sequencer. More...
 
struct  adcifa_window_monitor_opt_t
 Parameters for the windows monitor mode. More...
 

Macros

#define ADCIFA_clear_eoc_sequencer_0()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_SEOC0))
 Sequencer 0 : Ack end of Conversion. More...
 
#define ADCIFA_clear_eoc_sequencer_1()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_SEOC1)
 Sequencer 1 : Ack end of Conversion. More...
 
#define ADCIFA_clear_eos_sequencer_0()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_SEOS0))
 Sequencer 0 : Ack end of Sequence. More...
 
#define ADCIFA_clear_eos_sequencer_1()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_SEOS1))
 Sequencer 1 : Ack end of Sequence. More...
 
#define ADCIFA_clear_window_0()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_WM0))
 Window Monitor 0 : Ack the Window Monitor 0 Status Bit. More...
 
#define ADCIFA_clear_window_1()   ((AVR32_ADCIFA.scr) |= (1 << AVR32_ADCIFA_SCR_WM1))
 Window Monitor 1 : Ack the Window Monitor 1 Status Bit. More...
 
#define ADCIFA_CONFIGURATION_ACCEPTED   0x1
 This constant is used as return value for adcifa_configure and adcifa_configure_sequencer functions. More...
 
#define ADCIFA_CONFIGURATION_REFUSED   0x0
 This constant is used as return value for adcifa_configure and adcifa_configure_sequencer functions. More...
 
#define ADCIFA_configure_muxsel0n(m7, m6, m5, m4, m3, m2, m1, m0)
 Configuration of Mux Negative for Sequencer 0. More...
 
#define ADCIFA_configure_muxsel0p(m7, m6, m5, m4, m3, m2, m1, m0)
 Configuration of Mux Positive for Sequencer 0. More...
 
#define ADCIFA_configure_muxsel1n(m7, m6, m5, m4, m3, m2, m1, m0)
 Configuration of Mux Negative for Sequencer 1. More...
 
#define ADCIFA_configure_muxsel1p(m7, m6, m5, m4, m3, m2, m1, m0)
 Configuration of Mux Positive for Sequencer 1. More...
 
#define ADCIFA_configure_sequencer_0(cnvnb, sres, trgsel, socb, sh_mode, hwla, sa)
 Configuration of Sequencer 0. More...
 
#define ADCIFA_configure_sequencer_1(cnvnb, sres, trgsel, socb, csws, hwla, sa)
 Configuration of Sequencer 1. More...
 
#define ADCIFA_configure_sh0gain(g7, g6, g5, g4, g3, g2, g1, g0)
 Configuration of Gain for Sequencer 0. More...
 
#define ADCIFA_configure_sh1gain(g7, g6, g5, g4, g3, g2, g1, g0)
 Configuration of Gain for Sequencer 1. More...
 
#define ADCIFA_disable()
 Enable the ADCIFA. More...
 
#define ADCIFA_enable()
 Enable the ADCIFA. More...
 
#define ADCIFA_is_eoc_sequencer_0()
 Sequencer 0 : Check end of Conversion. More...
 
#define ADCIFA_is_eoc_sequencer_1()
 Sequencer 1 : Check end of Conversion. More...
 
#define ADCIFA_is_eos_sequencer_0()
 Sequencer 0 : Check end of Sequence. More...
 
#define ADCIFA_is_eos_sequencer_1()
 Sequencer 1 : Check end of Sequence. More...
 
#define ADCIFA_is_startup_time()
 Check Startup Time flag. More...
 
#define ADCIFA_is_window_0_set()
 Window Monitor 0 : Check the Window Monitor 0 Status Bit. More...
 
#define ADCIFA_is_window_1_set()
 Window Monitor 1 : Check the Window Monitor 1 Status Bit. More...
 
#define ADCIFA_NONE   0xFF
 Parameter. More...
 
#define ADCIFA_read_resx_sequencer_0(ind)   ((int32_t)AVR32_ADCIFA.resx[(ind)])
 Return result for conversion for Sequencer 0. More...
 
#define ADCIFA_read_resx_sequencer_1(ind)   ((int)AVR32_ADCIFA.resx[(ind) + 8])
 Return result for conversion for Sequencer 1. More...
 
#define ADCIFA_set_gain_calibration(gcal)
 Set Gain Calibration. More...
 
#define ADCIFA_set_offset_calibration(ocal)
 Set Offset Calibration. More...
 
#define ADCIFA_set_sh0_gain_calibration(scal)
 Set Sample & Hold Gain Calibration for Seq 0. More...
 
#define ADCIFA_set_sh1_gain_calibration(scal)
 Set Sample & Hold Gain Calibration for Seq 0. More...
 
#define ADCIFA_softsoc_sequencer(seq)
 
#define ADCIFA_softsoc_sequencer_0()   { AVR32_ADCIFA.cr = AVR32_ADCIFA_CR_SOC0_MASK; }
 Sequencer 0 : Software Start of Conversion. More...
 
#define ADCIFA_softsoc_sequencer_1()   { AVR32_ADCIFA.cr = AVR32_ADCIFA_CR_SOC1_MASK; }
 Sequencer 1 : Software Start of Conversion. More...
 
#define ADCIFA_START_UP_TIME   1000
 ADCIFA Start-Up time (us) More...
 
#define ADCIFA_STATUS_COMPLETED   0x2
 This constant is used as return value for the adcifa_get_values_from_sequencer function. More...
 
#define ADCIFA_STATUS_NOT_COMPLETED   0x3
 This constant is used as return value for the adcifa_get_values_from_sequencer function. More...
 
Positive Inputs used by the ADC
#define AVR32_ADCIFA_INP_ADCIN0   0
 
#define AVR32_ADCIFA_INP_ADCIN1   1
 
#define AVR32_ADCIFA_INP_ADCIN2   2
 
#define AVR32_ADCIFA_INP_ADCIN3   3
 
#define AVR32_ADCIFA_INP_ADCIN4   4
 
#define AVR32_ADCIFA_INP_ADCIN5   5
 
#define AVR32_ADCIFA_INP_ADCIN6   6
 
#define AVR32_ADCIFA_INP_ADCIN7   7
 
#define AVR32_ADCIFA_INP_DAC0_INT   8
 
#define AVR32_ADCIFA_INP_TSENSE   9
 
#define AVR32_ADCIFA_INP_GNDANA   10
 
Negative Inputs used by the ADC
#define AVR32_ADCIFA_INN_ADCIN8   0
 
#define AVR32_ADCIFA_INN_ADCIN9   1
 
#define AVR32_ADCIFA_INN_ADCIN10   2
 
#define AVR32_ADCIFA_INN_ADCIN11   3
 
#define AVR32_ADCIFA_INN_ADCIN12   4
 
#define AVR32_ADCIFA_INN_ADCIN13   5
 
#define AVR32_ADCIFA_INN_ADCIN14   6
 
#define AVR32_ADCIFA_INN_ADCIN15   7
 
#define AVR32_ADCIFA_INN_DAC1_INT   8
 
#define AVR32_ADCIFA_INN_GNDANA   9
 
References used by the ADC
#define ADCIFA_REF1V   0x0 /** Internal 1V reference */
 
#define ADCIFA_REF06VDD   0x1 /** Internal 0.6 x VDDANA reference */
 
#define ADCIFA_ADCREF0   0x2 /** External 0 reference ADCREF0 */
 
#define ADCIFA_ADCREF1   0x3 /** External 1 reference ADCREF1 */
 
#define ADCIFA_ADCREF   0x10 /** External reference ADCREFP/ADCREFN */
 
Triggering Source used by the ADC
#define ADCIFA_TRGSEL_SOFT   0x0 /** Trigger Source Software */
 
#define ADCIFA_TRGSEL_ITIMER   0x1 /** Trigger Source Timer */
 
#define ADCIFA_TRGSEL_EVT   0x2 /** Trigger Source Event */
 
#define ADCIFA_TRGSEL_CONTINUOUS   0x3 /** Trigger Source Continuous */
 
Resolution selected by the ADC
#define ADCIFA_SRES_8B   0x2 /** Resolution 8-Bits */
 
#define ADCIFA_SRES_10B   0x1 /** Resolution 10-Bits */
 
#define ADCIFA_SRES_12B   0x0 /** Resolution 12-Bits */
 
Gain selected on a Conversion by the ADC
#define ADCIFA_SHG_1   0x0 /** Gain Conversion = 1 */
 
#define ADCIFA_SHG_2   0x1 /** Gain Conversion = 2 */
 
#define ADCIFA_SHG_4   0x2 /** Gain Conversion = 4 */
 
#define ADCIFA_SHG_8   0x3 /** Gain Conversion = 8 */
 
#define ADCIFA_SHG_16   0x4 /** Gain Conversion = 16 */
 
#define ADCIFA_SHG_32   0x5 /** Gain Conversion = 32 */
 
#define ADCIFA_SHG_64   0x6 /** Gain Conversion = 64 */
 
Conversion Management of the Sequence
#define ADCIFA_SOCB_ALLSEQ
 
#define ADCIFA_SOCB_SINGLECONV
 
Sampling Mode (OVSX2 & SHDYN)
#define ADCIFA_SH_MODE_STANDARD   0x0 /** No dynamic over sampling */
 
#define ADCIFA_SH_MODE_OVERSAMP   0x1 /** Over sampling: OVSX2 = 1 */
 
#define ADCIFA_SH_MODE_DYNAMIC   0x2 /** Dynamic: SHDYN = 1 */
 
Half Word Left Adjustment (HWLA)
#define ADCIFA_HWLA_NOADJ   0x0 /** Disable the HWLA mode */
 
#define ADCIFA_HWLA_LEFTADJ   0x1 /** Enable the HWLA mode */
 
Software Acknowledge (SA)
#define ADCIFA_SA_EOS_SOFTACK   0x0 /** Disable the SA mode */
 
#define ADCIFA_SA_NO_EOS_SOFTACK   0x1 /** Enable the SA mode */
 
Sequence numbers
#define ADCIFA_SEQ0   0x0
 
#define ADCIFA_SEQ1   0x1
 
#define ADCIFA_SEQ0_SEQ1   0x3
 
Window monitor
#define ADCIFA_WINDOW_MODE_NONE   0 /** No Window Mode : Default */
 
#define ADCIFA_WINDOW_MODE_BELOW   1 /** Active : Result < High Threshold */
 
#define ADCIFA_WINDOW_MODE_ABOVE   2 /** Active : Result > Low Threshold */
 
#define ADCIFA_WINDOW_MODE_INSIDE   3 /** Active : Low Threshold < Result < High Threshold */
 
#define ADCIFA_WINDOW_MODE_OUTSIDE   4 /** Active : Result >= Low Threshold or Result >= High Threshold */
 

Functions

void adcifa_calibrate_offset (volatile avr32_adcifa_t *adcifa, adcifa_opt_t *p_adcifa_opt, uint32_t pb_hz)
 
bool adcifa_check_eoc (volatile avr32_adcifa_t *adcifa, uint8_t sequencer)
 Get End of Conversion status bit. More...
 
bool adcifa_check_eos (volatile avr32_adcifa_t *adcifa, uint8_t sequencer)
 Get End of Conversion status bit. More...
 
void adcifa_clear_interrupt (volatile avr32_adcifa_t *adcifa, uint32_t interrupt_flags)
 Clear any ADCIFA interrupt. More...
 
uint8_t adcifa_configure (volatile avr32_adcifa_t *adcifa, adcifa_opt_t *p_adcifa_opt, uint32_t pb_hz)
 Configure ADCIFA. More...
 
uint8_t adcifa_configure_sequencer (volatile avr32_adcifa_t *adcifa, uint8_t sequencer, adcifa_sequencer_opt_t *p_adcifa_sequencer_opt, adcifa_sequencer_conversion_opt_t *p_adcifa_sequencer_conversion_opt)
 Configure ADCIFA specific sequencer. More...
 
void adcifa_configure_window_monitor (volatile avr32_adcifa_t *adcifa, uint8_t sequencer, adcifa_window_monitor_opt_t *adc_window_monitor_opt)
 Configure ADCIFA specific window monitor. More...
 
void adcifa_disable_interrupt (volatile avr32_adcifa_t *adcifa, uint32_t interrupt_flags)
 Disable any ADCIFA interrupt. More...
 
void adcifa_enable_interrupt (volatile avr32_adcifa_t *adcifa, uint32_t interrupt_flags)
 Enable any ADCIFA interrupt. More...
 
void adcifa_get_calibration_data (volatile avr32_adcifa_t *adcifa, adcifa_opt_t *p_adcifa_opt)
 Get ADCIFA Calibration Data. More...
 
uint8_t adcifa_get_values_from_sequencer (volatile avr32_adcifa_t *adcifa, uint8_t sequencer, adcifa_sequencer_opt_t *p_adcifa_sequencer_opt, int16_t *adcifa_values)
 Get channel values for a specific sequence. More...
 
void adcifa_start_itimer (volatile avr32_adcifa_t *adcifa, uint32_t timer_count)
 Start the ADCIFA timer. More...
 
void adcifa_start_sequencer (volatile avr32_adcifa_t *adcifa, uint8_t sequencer)
 Start analog to digital conversion for a specific sequencer. More...
 
void adcifa_stop_itimer (volatile avr32_adcifa_t *adcifa)
 Stop the ADCIFA timer. More...