Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ACIFA - Analog Comparator Interface

Analog Comparator Interface is able to control two Analog Comparators (AC) with identical behavior.

Modules

 

Functions

void acifa_clear_flags (volatile avr32_acifa_t *acifa, uint32_t flag_mask)
 Clear Flags. More...
 
void acifa_configure (volatile avr32_acifa_t *acifa, uint8_t comp_sel, uint8_t input_p, uint8_t input_n, uint32_t pb_hz)
 Configure ACIFA Normal Mode. More...
 
void acifa_configure_hysteresis (volatile avr32_acifa_t *acifa, uint8_t comp_sel, uint8_t level)
 Configure Hysteresis on comparator. More...
 
void acifa_configure_vccscale (volatile avr32_acifa_t *acifa, uint8_t vccscale_sel, uint8_t scale)
 Configure VCC Scale on comparator. More...
 
void acifa_configure_window (volatile avr32_acifa_t *acifa, uint8_t input_p, uint8_t input_n, uint8_t common_input, uint32_t pb_hz)
 Configure ACIFA Window Mode. More...
 
void acifa_enable_interrupt (volatile avr32_acifa_t *acifa, uint32_t flag_mask)
 Enable Interrupt Flags. More...
 
void acifa_enable_interrupt_inp_higher (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Enable AC Interrupt when Vinp>Vin. More...
 
void acifa_enable_interrupt_inp_lower (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Enable AC Interrupt when Vinp<Vin. More...
 
void acifa_enable_interrupt_toggle (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Enable AC Interrupt when a toggle of the comparator occurs. More...
 
void acifa_enable_output (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Enable Output on comparator. More...
 
bool acifa_is_aca_inp_higher (volatile avr32_acifa_t *acifa)
 Return comparator A status. More...
 
bool acifa_is_acb_inp_higher (volatile avr32_acifa_t *acifa)
 Return comparator B status. More...
 
bool acifa_is_ci_inside_window (volatile avr32_acifa_t *acifa)
 Return Window status. More...
 
void acifa_start (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Start comparator in Normal Mode. More...
 
void acifa_start_window (volatile avr32_acifa_t *acifa)
 Start comparator in Window Mode. More...
 
void acifa_stop (volatile avr32_acifa_t *acifa, uint8_t comp_sel)
 Stops the comparators that are currently started. More...
 

Positive Inputs Comparator 0 Instance A used by the ACIFA

#define AVR32_ACIFA_AC0A_INSELP_AC0AP0   0
 
#define AVR32_ACIFA_AC0A_INSELP_AC0AP1   1
 
#define AVR32_ACIFA_AC0A_INSELP_DAC0_INT   2
 

Negative Inputs Comparator 0 Instance A used by the ACIFA

#define AVR32_ACIFA_AC0A_INSELN_AC0AN0   0
 
#define AVR32_ACIFA_AC0A_INSELN_AC0AN1   1
 
#define AVR32_ACIFA_AC0A_INSELN_AC0BP0   2
 
#define AVR32_ACIFA_AC0A_INSELN_AC0BP1   3
 
#define AVR32_ACIFA_AC0A_INSELN_VDDANA_SCALED   4
 
#define AVR32_ACIFA_AC0A_INSELN_DAC1_INT   5
 

Positive Inputs Comparator 0 Instance B used by the ACIFA

#define AVR32_ACIFA_AC0B_INSELP_AC0AN0   0
 
#define AVR32_ACIFA_AC0B_INSELP_AC0AN1   1
 
#define AVR32_ACIFA_AC0B_INSELP_AC0BP0   2
 
#define AVR32_ACIFA_AC0B_INSELP_AC0BP1   3
 
#define AVR32_ACIFA_AC0B_INSELP_DAC0_INT   4
 
#define AVR32_ACIFA_AC0B_INSELP_VDDANA_SCALED   5
 

Negative Inputs Comparator 0 Instance B used by the ACIFA

#define AVR32_ACIFA_AC0B_INSELN_AC0BN0   0
 
#define AVR32_ACIFA_AC0B_INSELN_AC0BN1   1
 
#define AVR32_ACIFA_AC0B_INSELN_DAC1_INT   2
 

Positive Inputs Comparator 1 Instance A used by the ACIFA

#define AVR32_ACIFA_AC1A_INSELP_AC1AP0   0
 
#define AVR32_ACIFA_AC1A_INSELP_AC1AP1   1
 
#define AVR32_ACIFA_AC1A_INSELP_DAC0_INT   2
 

Negative Inputs Comparator 1 Instance A used by the ACIFA

#define AVR32_ACIFA_AC1A_INSELN_AC1AN0   0
 
#define AVR32_ACIFA_AC1A_INSELN_AC1AN1   1
 
#define AVR32_ACIFA_AC1A_INSELN_AC1BP0   2
 
#define AVR32_ACIFA_AC1A_INSELN_AC1BP1   3
 
#define AVR32_ACIFA_AC1A_INSELN_VDDANA_SCALED   4
 
#define AVR32_ACIFA_AC1A_INSELN_DAC1_INT   5
 

Positive Inputs Comparator 1 Instance B used by the ACIFA

#define AVR32_ACIFA_AC1B_INSELP_AC1AN0   0
 
#define AVR32_ACIFA_AC1B_INSELP_AC1AN1   1
 
#define AVR32_ACIFA_AC1B_INSELP_AC1BP0   2
 
#define AVR32_ACIFA_AC1B_INSELP_AC1BP1   3
 
#define AVR32_ACIFA_AC1B_INSELP_DAC0_INT   4
 
#define AVR32_ACIFA_AC1B_INSELP_VDDANA_SCALED   5
 

Negative Inputs Comparator 1 Instance B used by the ACIFA

#define AVR32_ACIFA_AC1B_INSELN_AC1BN0   0
 
#define AVR32_ACIFA_AC1B_INSELN_AC1BN1   1
 
#define AVR32_ACIFA_AC1B_INSELN_DAC1_INT   2
 

Comparator Selection

#define ACIFA_COMP_SELA   1
 
#define ACIFA_COMP_SELB   2
 

VCCSCALE Selection

#define ACIFA_VCCSCALE_SELA   1
 
#define ACIFA_VCCSCALE_SELB   2
 

#define ACIFA_VCCSCALE_SELA   1
#define ACIFA_VCCSCALE_SELB   2
#define AVR32_ACIFA_AC0A_INSELN_AC0AN0   0
#define AVR32_ACIFA_AC0A_INSELN_AC0AN1   1
#define AVR32_ACIFA_AC0A_INSELN_AC0BP0   2
#define AVR32_ACIFA_AC0A_INSELN_AC0BP1   3
#define AVR32_ACIFA_AC0A_INSELN_DAC1_INT   5
#define AVR32_ACIFA_AC0A_INSELN_VDDANA_SCALED   4
#define AVR32_ACIFA_AC0A_INSELP_AC0AP0   0
#define AVR32_ACIFA_AC0A_INSELP_AC0AP1   1
#define AVR32_ACIFA_AC0A_INSELP_DAC0_INT   2
#define AVR32_ACIFA_AC0B_INSELN_AC0BN0   0
#define AVR32_ACIFA_AC0B_INSELN_AC0BN1   1
#define AVR32_ACIFA_AC0B_INSELN_DAC1_INT   2
#define AVR32_ACIFA_AC0B_INSELP_AC0AN0   0
#define AVR32_ACIFA_AC0B_INSELP_AC0AN1   1
#define AVR32_ACIFA_AC0B_INSELP_AC0BP0   2
#define AVR32_ACIFA_AC0B_INSELP_AC0BP1   3
#define AVR32_ACIFA_AC0B_INSELP_DAC0_INT   4
#define AVR32_ACIFA_AC0B_INSELP_VDDANA_SCALED   5
#define AVR32_ACIFA_AC1A_INSELN_AC1AN0   0
#define AVR32_ACIFA_AC1A_INSELN_AC1AN1   1
#define AVR32_ACIFA_AC1A_INSELN_AC1BP0   2
#define AVR32_ACIFA_AC1A_INSELN_AC1BP1   3
#define AVR32_ACIFA_AC1A_INSELN_DAC1_INT   5
#define AVR32_ACIFA_AC1A_INSELN_VDDANA_SCALED   4
#define AVR32_ACIFA_AC1A_INSELP_AC1AP0   0
#define AVR32_ACIFA_AC1A_INSELP_AC1AP1   1
#define AVR32_ACIFA_AC1A_INSELP_DAC0_INT   2
#define AVR32_ACIFA_AC1B_INSELN_AC1BN0   0
#define AVR32_ACIFA_AC1B_INSELN_AC1BN1   1
#define AVR32_ACIFA_AC1B_INSELN_DAC1_INT   2
#define AVR32_ACIFA_AC1B_INSELP_AC1AN0   0
#define AVR32_ACIFA_AC1B_INSELP_AC1AN1   1
#define AVR32_ACIFA_AC1B_INSELP_AC1BP0   2
#define AVR32_ACIFA_AC1B_INSELP_AC1BP1   3
#define AVR32_ACIFA_AC1B_INSELP_DAC0_INT   4
#define AVR32_ACIFA_AC1B_INSELP_VDDANA_SCALED   5

void acifa_clear_flags ( volatile avr32_acifa_t *  acifa,
uint32_t  flag_mask 
)

Clear Flags.

Parameters
acifaBase address of the ACIFA
flag_maskFlag Mask Value
void acifa_configure ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel,
uint8_t  input_p,
uint8_t  input_n,
uint32_t  pb_hz 
)

Configure ACIFA Normal Mode.

Mandatory to call.

Parameters
acifaBase address of the ACIFA
comp_selComparator Selection
input_pInput Positive Selection
input_nInput Negative Selection
pb_hzPeripheral Bus frequency

References ACIFA_COMP_SELA, Assert, and NULL.

Referenced by main().

void acifa_configure_hysteresis ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel,
uint8_t  level 
)

Configure Hysteresis on comparator.

Parameters
*acifaBase address of the ACIFA
comp_selComparator Selection
levelLevel On Hysteresis

References ACIFA_COMP_SELA, Assert, and NULL.

void acifa_configure_vccscale ( volatile avr32_acifa_t *  acifa,
uint8_t  vcc_sel,
uint8_t  scale 
)

Configure VCC Scale on comparator.

Parameters
acifaBase address of the ACIFA
vcc_selVCC Scale Selection
scaleScale

References ACIFA_VCCSCALE_SELA, Assert, and NULL.

void acifa_configure_window ( volatile avr32_acifa_t *  acifa,
uint8_t  input_p,
uint8_t  input_n,
uint8_t  common_input,
uint32_t  pb_hz 
)

Configure ACIFA Window Mode.

Mandatory to call.

Parameters
acifaBase address of the ACIFA
input_pInput Positive Selection for window mode
input_nInput Negative Selection for window mode
common_inputCommon Input Selection for window mode
pb_hzPeripheral Bus frequency

References Assert, and NULL.

void acifa_enable_interrupt ( volatile avr32_acifa_t *  acifa,
uint32_t  flag_mask 
)

Enable Interrupt Flags.

Parameters
acifaBase address of the ACIFA
flag_maskFlag Mask Value

References Assert, and NULL.

void acifa_enable_interrupt_inp_higher ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Enable AC Interrupt when Vinp>Vin.

Parameters
acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA, ACIFA_COMP_SELB, Assert, and NULL.

void acifa_enable_interrupt_inp_lower ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Enable AC Interrupt when Vinp<Vin.

Parameters
acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA, ACIFA_COMP_SELB, Assert, and NULL.

void acifa_enable_interrupt_toggle ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Enable AC Interrupt when a toggle of the comparator occurs.

Parameters
acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA, ACIFA_COMP_SELB, Assert, and NULL.

void acifa_enable_output ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Enable Output on comparator.

Parameters
acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA.

bool acifa_is_aca_inp_higher ( volatile avr32_acifa_t *  acifa)

Return comparator A status.

Parameters
acifaBase address of the ACIFA
Return values
truewhen ACA Input P is higher than Input N
falsewhen ACA Input P is Lower than Input N

Referenced by main().

bool acifa_is_acb_inp_higher ( volatile avr32_acifa_t *  acifa)

Return comparator B status.

Parameters
acifaBase address of the ACIFA
Return values
truewhen ACB Input P is higher than Input N
falsewhen ACB Input P is Lower than Input N

Referenced by main().

bool acifa_is_ci_inside_window ( volatile avr32_acifa_t *  acifa)

Return Window status.

Parameters
acifaBase address of the ACIFA
Return values
trueif Common Input Signal is inside the window
falseif Common Input Signal is outside the window
void acifa_start ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Start comparator in Normal Mode.

Parameters
*acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA, ACIFA_COMP_SELB, acifa_is_aca_ready(), acifa_is_acb_ready(), Assert, and NULL.

Referenced by main().

void acifa_start_window ( volatile avr32_acifa_t *  acifa)

Start comparator in Window Mode.

Parameters
acifaBase address of the ACIFA

References acifa_is_wf_ready().

void acifa_stop ( volatile avr32_acifa_t *  acifa,
uint8_t  comp_sel 
)

Stops the comparators that are currently started.

Parameters
*acifaBase address of the ACIFA
comp_selComparator Selection

References ACIFA_COMP_SELA, ACIFA_COMP_SELB, Assert, and NULL.