Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ACIFB - Analog Comparator

Interface.

Analog Comparator Interface is able to control a number of Analog Comparators (AC) with identical behavior.

Data Structures

struct  acifb_channel_t
 AC channel configuration. More...
 
struct  acifb_t
 ACIFB configuration. More...
 
struct  acifb_window_t
 AC Window configuration. More...
 

Macros

#define ACIFB_POLL_TIMEOUT   10000
 The timeguard used for polling. More...
 

Functions

void acifb_channels_setup (volatile avr32_acifb_t *acifb, const acifb_channel_t *ac_chan, uint32_t nb_chan)
 Configure a set of AC channels in normal mode. More...
 
static void acifb_clear_all_interrupt_flags (volatile avr32_acifb_t *acifb)
 Clear ACIFB all interrupt flags. More...
 
static void acifb_clear_comparison_interrupt_flag (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Clear ACIFB comparison complete interrupt flags. More...
 
static void acifb_clear_interrupt_flag (volatile avr32_acifb_t *acifb, uint32_t interrupt_mask)
 Clear ACIFB interrupt flags. More...
 
static void acifb_clear_startup_interrupt_flag (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Clear ACIFB startup interrupt flags. More...
 
static void acifb_clear_window_interrupt_flag (volatile avr32_acifb_t *acifb, uint8_t ac_combination)
 Clear ACIFB comparison window mode interrupt flags. More...
 
static void acifb_disable (volatile avr32_acifb_t *acifb)
 Disable ACIFB. More...
 
static void acifb_disable_all_interrupts (volatile avr32_acifb_t *acifb)
 Disable all ACIFB interrupts. More...
 
static void acifb_disable_comparison_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Disable ACIFB comparison complete interrupt. More...
 
static void acifb_disable_interrupt (volatile avr32_acifb_t *acifb, uint32_t interrupt_mask)
 Disable ACIFB interrupts. More...
 
static void acifb_disable_startup_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Disable ACIFB startup interrupt. More...
 
static void acifb_disable_window_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_combination)
 Disable ACIFB comparison window mode interrupt. More...
 
static void acifb_enable_comparison_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Enable ACIFB comparison complete interrupt. More...
 
static void acifb_enable_interrupt (volatile avr32_acifb_t *acifb, uint32_t interrupt_mask)
 Enable ACIFB interrupts. More...
 
static void acifb_enable_startup_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_channel)
 Enable ACIFB startup interrupt. More...
 
static void acifb_enable_window_interrupt (volatile avr32_acifb_t *acifb, uint8_t ac_combination)
 Enable ACIFB comparison window mode interrupt. More...
 
void acifb_setup_and_enable (volatile avr32_acifb_t *acifb, const acifb_t *ac)
 Configure and enable the ACIFB module. More...
 
static void acifb_test_event_trigger_single_comparison (volatile avr32_acifb_t *acifb)
 Test event trigger for single analog comparison. More...
 
static void acifb_user_trigger_single_comparison (volatile avr32_acifb_t *acifb)
 Trigger a Analog comparison. More...
 
bool acifb_wait_channels_ready (volatile avr32_acifb_t *acifb, const uint32_t acrdy_mask)
 Wait for channels to be ready. More...
 
void acifb_windows_setup (volatile avr32_acifb_t *acifb, const acifb_window_t *ac_window, uint32_t nb_combinations)
 Configure a set of AC channels in Window mode. More...
 

#define ACIFB_POLL_TIMEOUT   10000

The timeguard used for polling.

Referenced by acifb_wait_channels_ready().

void acifb_channels_setup ( volatile avr32_acifb_t *  acifb,
const acifb_channel_t ac_chan,
uint32_t  nb_chan 
)

Configure a set of AC channels in normal mode.

Parameters
acifbBase address of the ACIFB
ac_chanArray of channels configuration [INPUT]
nb_chanThe size of the ac_chan[] array [INPUT]

References acifb_channel_t::event_negative, acifb_channel_t::filter_len, acifb_channel_t::hysteresis_value, acifb_channel_t::interrupt_settings, acifb_channel_t::mode, acifb_channel_t::negative_input, and acifb_channel_t::positive_input.

Referenced by ac_init().

static void acifb_clear_all_interrupt_flags ( volatile avr32_acifb_t *  acifb)
inlinestatic

Clear ACIFB all interrupt flags.

Parameters
acifbBase address of the ACIFB module
static void acifb_clear_comparison_interrupt_flag ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Clear ACIFB comparison complete interrupt flags.

Parameters
acifbBase address of the ACIFB module
ac_channelACIFB Channel Used

Referenced by ISR().

static void acifb_clear_interrupt_flag ( volatile avr32_acifb_t *  acifb,
uint32_t  interrupt_mask 
)
inlinestatic

Clear ACIFB interrupt flags.

Parameters
*acifbBase address of the ACIFB module
interrupt_maskBitmask of interrupts to clear
static void acifb_clear_startup_interrupt_flag ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Clear ACIFB startup interrupt flags.

Parameters
acifbBase address of the ACIFB module
ac_channelACIFB Channel Used
static void acifb_clear_window_interrupt_flag ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_combination 
)
inlinestatic

Clear ACIFB comparison window mode interrupt flags.

Parameters
acifbBase address of the ACIFB module
ac_combinationACIFB Channel combination Used
Note
ACPn, ACNn, ACP(n+1), ACN(n+1) -> nth combination
static void acifb_disable ( volatile avr32_acifb_t *  acifb)
inlinestatic

Disable ACIFB.

Parameters
acifbBase address of the ACIFB module
static void acifb_disable_all_interrupts ( volatile avr32_acifb_t *  acifb)
inlinestatic

Disable all ACIFB interrupts.

Parameters
acifbBase address of the ACIFB module
static void acifb_disable_comparison_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Disable ACIFB comparison complete interrupt.

Parameters
*acifbBase address of the ACIFB module
ac_channelACIFB Channel Used
static void acifb_disable_interrupt ( volatile avr32_acifb_t *  acifb,
uint32_t  interrupt_mask 
)
inlinestatic

Disable ACIFB interrupts.

Parameters
acifbBase address of the ACIFB module
interrupt_maskBitmask of interrupts to disable
static void acifb_disable_startup_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Disable ACIFB startup interrupt.

Parameters
acifbBase address of the ACIFB module
ac_channelACIFB Channel Used
static void acifb_disable_window_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_combination 
)
inlinestatic

Disable ACIFB comparison window mode interrupt.

Parameters
acifbBase address of the ACIFB module
ac_combinationACIFB Channel combination Used
Note
ACPn, ACNn, ACP(n+1), ACN(n+1) -> nth combination
static void acifb_enable_comparison_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Enable ACIFB comparison complete interrupt.

Parameters
acifbBase address of the ACIFB module
ac_channelACIFB Channel Used

Referenced by ac_init().

static void acifb_enable_interrupt ( volatile avr32_acifb_t *  acifb,
uint32_t  interrupt_mask 
)
inlinestatic

Enable ACIFB interrupts.

Parameters
acifbBase address of the ACIFB module
interrupt_maskBitmask of interrupts to enable
static void acifb_enable_startup_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_channel 
)
inlinestatic

Enable ACIFB startup interrupt.

Parameters
acifbBase address of the ACIFB module
ac_channelACIFB Channel Used
static void acifb_enable_window_interrupt ( volatile avr32_acifb_t *  acifb,
uint8_t  ac_combination 
)
inlinestatic

Enable ACIFB comparison window mode interrupt.

Parameters
acifbBase address of the ACIFB module
ac_combinationACIFB Channel combination Used
Note
ACPn, ACNn, ACP(n+1), ACN(n+1) -> nth combination
void acifb_setup_and_enable ( volatile avr32_acifb_t *  acifb,
const acifb_t ac 
)

Configure and enable the ACIFB module.

Parameters
acifbBase address of the ACIFB
acACIFB configuration [INPUT]

References acifb_t::actest, acifb_t::eventen, and acifb_t::sut.

Referenced by ac_init().

static void acifb_test_event_trigger_single_comparison ( volatile avr32_acifb_t *  acifb)
inlinestatic

Test event trigger for single analog comparison.

Parameters
acifbBase address of the ACIFB module
static void acifb_user_trigger_single_comparison ( volatile avr32_acifb_t *  acifb)
inlinestatic

Trigger a Analog comparison.

Parameters
acifbBase address of the ACIFB module
bool acifb_wait_channels_ready ( volatile avr32_acifb_t *  acifb,
const uint32_t  acrdy_mask 
)

Wait for channels to be ready.

Parameters
acifbBase address of the ACIFB
acrdy_maskMask of several AVR32_ACIFB_SR_ACRDYn_MASK [INPUT]
Return values
falseTimeout on ACIFB configuration
trueACIFB channels are ready

References ACIFB_POLL_TIMEOUT.

void acifb_windows_setup ( volatile avr32_acifb_t *  acifb,
const acifb_window_t ac_window,
uint32_t  nb_combinations 
)

Configure a set of AC channels in Window mode.

Parameters
acifbBase address of the ACIFB
ac_windowArray of Windows configuration [INPUT]
nb_combinationsThe size of the ac_window[] array [INPUT]

References acifb_window_t::interrupt_settings, acifb_window_t::window_event, and acifb_window_t::window_mode.