Microchip® Advanced Software Framework

acifc.h File Reference

SAM4L Analog Comparator Interface Driver.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <status_codes.h>

Data Structures

struct  ac_ch_config
 ACIFC channel configuration structure. More...
 
struct  ac_config
 ACIFC module configuration structure. More...
 
struct  ac_dev_inst
 ACIFC driver structure. More...
 
struct  ac_win_config
 ACIFC window configuration structure. More...
 

Typedefs

typedef void(* ac_callback_t )(void)
 ACIFC interrupt callback type. More...
 
typedef enum ac_interrupt_source ac_interrupt_source_t
 ACIFC interrupt configuration type. More...
 

Enumerations

enum  ac_ch_interrupt_setting {
  AC_CH_IS_VINP_GT_VINN = 0,
  AC_CH_IS_VINP_LT_VINN,
  AC_CH_IS_OUTPUT_TGL,
  AC_CH_IS_COMP_DONE
}
 ACIFC channel interrupt setting. More...
 
enum  ac_comparator_mode {
  AC_COMPARATOR_OFF = 0,
  AC_COMPARATOR_CONTINUOUS,
  AC_COMPARATOR_USER_TRIGGERED,
  AC_COMPARATOR_EVENT_TRIGGERED
}
 ACIFC comparator mode. More...
 
enum  ac_hysteresis_voltage {
  AC_HYSTERESIS_0_MV = 0,
  AC_HYSTERESIS_25_MV,
  AC_HYSTERESIS_50_MV,
  AC_HYSTERESIS_75_MV
}
 ACIFC hysteresis voltage. More...
 
enum  ac_interrupt_source {
  AC_INTERRUPT_CONVERSION_COMPLETED_0 = 0,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_0,
  AC_INTERRUPT_CONVERSION_COMPLETED_1,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_1,
  AC_INTERRUPT_CONVERSION_COMPLETED_2,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_2,
  AC_INTERRUPT_CONVERSION_COMPLETED_3,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_3,
  AC_INTERRUPT_CONVERSION_COMPLETED_4,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_4,
  AC_INTERRUPT_CONVERSION_COMPLETED_5,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_5,
  AC_INTERRUPT_CONVERSION_COMPLETED_6,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_6,
  AC_INTERRUPT_CONVERSION_COMPLETED_7,
  AC_INTERRUPT_STARTUP_TIME_ELAPSED_7,
  AC_INTERRUPT_WINDOW_0,
  AC_INTERRUPT_WINDOW_1,
  AC_INTERRUPT_WINDOW_2,
  AC_INTERRUPT_WINDOW_3
}
 ACIFC interrupt configuration type. More...
 
enum  ac_negative_input { AC_NEGTIVE_INPUT_EXTERNAL = 0 }
 ACIFC negative input. More...
 
enum  ac_win_event_source {
  AC_WIN_EVENT_ACWOUT_RISING_EDGE = 0,
  AC_WIN_EVENT_ACWOUT_FALLING_EDGE,
  AC_WIN_EVENT_ACWOUT_ON_ANY_EDGE,
  AC_WIN_EVENT_INSIDE_WINDOW,
  AC_WIN_EVENT_OUTSIDE_WINDOW,
  AC_WIN_EVENT_MEASURE_DONE
}
 ACIFC window event output configuration. More...
 
enum  ac_win_interrupt_setting {
  AC_WIN_IS_VINP_INSIDE_WINDOW = 0,
  AC_WIN_IS_VINP_OUTSIDE_WINDOW,
  AC_WIN_IS_WINDOW_OUTPUT_TGL,
  AC_WIN_IS_WINDOW_COMP_DONE,
  AC_WIN_IS_VINP_ENTER_WINDOW,
  AC_WIN_IS_VINP_LEAVE_WINDOW
}
 ACIFC window interrupt settings. More...
 

Functions

static void ac_ch_get_config_defaults (struct ac_ch_config *const cfg)
 Initializes an ACIFC channel configuration structure to default values. More...
 
void ac_ch_set_config (struct ac_dev_inst *const dev_inst, uint32_t channel, struct ac_ch_config *cfg)
 Configure the specified ACIFC channel. More...
 
static void ac_clear_interrupt_status (struct ac_dev_inst *const dev_inst, uint32_t status)
 Write to the ACIFC interrupt status. More...
 
void ac_disable (struct ac_dev_inst *const dev_inst)
 Disable the ACIFC Module. More...
 
void ac_disable_interrupt (struct ac_dev_inst *const dev_inst, ac_interrupt_source_t source)
 Disable the specified ACIFC interrupt source. More...
 
void ac_enable (struct ac_dev_inst *const dev_inst)
 Enable the ACIFC module. More...
 
void ac_enable_interrupt (struct ac_dev_inst *const dev_inst, ac_interrupt_source_t source)
 Enable the specified ACIFC interrupt source. More...
 
static void ac_get_config_defaults (struct ac_config *const cfg)
 Initialize an ACIFC configuration structure to default values. More...
 
static uint32_t ac_get_interrupt_mask (struct ac_dev_inst *const dev_inst)
 Get the ACIFC interrupt mask. More...
 
static uint32_t ac_get_interrupt_status (struct ac_dev_inst *const dev_inst)
 Get the ACIFC interrupt status. More...
 
static uint32_t ac_get_status (struct ac_dev_inst *const dev_inst)
 Get the ACIFC status. More...
 
enum status_code ac_init (struct ac_dev_inst *const dev_inst, Acifc *const ac, struct ac_config *const cfg)
 Initialize the ACIFC module. More...
 
static bool ac_is_comparison_done (struct ac_dev_inst *const dev_inst)
 Check if the ACIFC comparison is done. More...
 
void ac_set_callback (struct ac_dev_inst *const dev_inst, ac_interrupt_source_t source, ac_callback_t callback, uint8_t irq_level)
 Set the ACIFC interrupt callback. More...
 
static void ac_user_trigger_single_comparison (struct ac_dev_inst *const dev_inst)
 Start a single ACIFC comparison. More...
 
static void ac_win_get_config_defaults (struct ac_win_config *const cfg)
 Initializes an ACIFC window configuration structure to default values. More...
 
void ac_win_set_config (struct ac_dev_inst *const dev_inst, uint32_t window, struct ac_win_config *cfg)
 Configure the specified ACIFC window. More...