Analog-Front-End Controller driver for SAM.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
|
enum | afec_channel_num {
AFEC_CHANNEL_0 = 0,
AFEC_CHANNEL_1,
AFEC_CHANNEL_2,
AFEC_CHANNEL_3,
AFEC_CHANNEL_4,
AFEC_CHANNEL_5,
AFEC_CHANNEL_6,
AFEC_CHANNEL_7,
AFEC_CHANNEL_8,
AFEC_CHANNEL_9,
AFEC_CHANNEL_10,
AFEC_CHANNEL_11,
AFEC_CHANNEL_12,
AFEC_CHANNEL_13,
AFEC_CHANNEL_14,
AFEC_TEMPERATURE_SENSOR,
AFEC_CHANNEL_ALL = 0xFFFF
} |
| Definitions for AFEC channel number. More...
|
|
enum | afec_cmp_mode {
AFEC_CMP_MODE_0 = AFEC_EMR_CMPMODE_LOW,
AFEC_CMP_MODE_1 = AFEC_EMR_CMPMODE_HIGH,
AFEC_CMP_MODE_2 = AFEC_EMR_CMPMODE_IN,
AFEC_CMP_MODE_3 = AFEC_EMR_CMPMODE_OUT
} |
| Definitions for Comparison Mode. More...
|
|
enum | afec_gainvalue {
AFEC_GAINVALUE_0 = 0,
AFEC_GAINVALUE_1 = 1,
AFEC_GAINVALUE_2 = 2,
AFEC_GAINVALUE_3 = 3
} |
| Definitions for AFEC gain value. More...
|
|
enum | afec_interrupt_source {
AFEC_INTERRUPT_EOC_0 = 0,
AFEC_INTERRUPT_EOC_1,
AFEC_INTERRUPT_EOC_2,
AFEC_INTERRUPT_EOC_3,
AFEC_INTERRUPT_EOC_4,
AFEC_INTERRUPT_EOC_5,
AFEC_INTERRUPT_EOC_6,
AFEC_INTERRUPT_EOC_7,
AFEC_INTERRUPT_EOC_8,
AFEC_INTERRUPT_EOC_9,
AFEC_INTERRUPT_EOC_10,
AFEC_INTERRUPT_EOC_11,
AFEC_INTERRUPT_EOC_12,
AFEC_INTERRUPT_EOC_13,
AFEC_INTERRUPT_EOC_14,
AFEC_INTERRUPT_EOC_15,
AFEC_INTERRUPT_DATA_READY,
AFEC_INTERRUPT_OVERRUN_ERROR,
AFEC_INTERRUPT_COMP_ERROR,
AFEC_INTERRUPT_END_RXBUF,
AFEC_INTERRUPT_RXBUF_FULL,
AFEC_INTERRUPT_TEMP_CHANGE,
AFEC_INTERRUPT_END_CAL,
_AFEC_NUM_OF_INTERRUPT_SOURCE,
AFEC_INTERRUPT_ALL = 0xDF00FFFF
} |
| AFEC interrupt source type. More...
|
|
enum | afec_power_mode {
AFEC_POWER_MODE_0 = 0,
AFEC_POWER_MODE_1,
AFEC_POWER_MODE_2
} |
| Definitions for AFEC power mode. More...
|
|
enum | afec_resolution {
AFEC_12_BITS = AFEC_EMR_RES_NO_AVERAGE,
AFEC_13_BITS = AFEC_EMR_RES_OSR4,
AFEC_14_BITS = AFEC_EMR_RES_OSR16,
AFEC_15_BITS = AFEC_EMR_RES_OSR64,
AFEC_16_BITS = AFEC_EMR_RES_OSR256
} |
| Definitions for AFEC resolution. More...
|
|
enum | afec_sample_hold_mode {
AFEC_SAMPLE_HOLD_MODE_0,
AFEC_SAMPLE_HOLD_MODE_1
} |
|
enum | afec_settling_time {
AFEC_SETTLING_TIME_0 = AFEC_MR_SETTLING_AST3,
AFEC_SETTLING_TIME_1 = AFEC_MR_SETTLING_AST5,
AFEC_SETTLING_TIME_2 = AFEC_MR_SETTLING_AST9,
AFEC_SETTLING_TIME_3 = AFEC_MR_SETTLING_AST17
} |
| Definitions for AFEC analog settling time. More...
|
|
enum | afec_startup_time {
AFEC_STARTUP_TIME_0 = AFEC_MR_STARTUP_SUT0,
AFEC_STARTUP_TIME_1 = AFEC_MR_STARTUP_SUT8,
AFEC_STARTUP_TIME_2 = AFEC_MR_STARTUP_SUT16,
AFEC_STARTUP_TIME_3 = AFEC_MR_STARTUP_SUT24,
AFEC_STARTUP_TIME_4 = AFEC_MR_STARTUP_SUT64,
AFEC_STARTUP_TIME_5 = AFEC_MR_STARTUP_SUT80,
AFEC_STARTUP_TIME_6 = AFEC_MR_STARTUP_SUT96,
AFEC_STARTUP_TIME_7 = AFEC_MR_STARTUP_SUT112,
AFEC_STARTUP_TIME_8 = AFEC_MR_STARTUP_SUT512,
AFEC_STARTUP_TIME_9 = AFEC_MR_STARTUP_SUT576,
AFEC_STARTUP_TIME_10 = AFEC_MR_STARTUP_SUT640,
AFEC_STARTUP_TIME_11 = AFEC_MR_STARTUP_SUT704,
AFEC_STARTUP_TIME_12 = AFEC_MR_STARTUP_SUT768,
AFEC_STARTUP_TIME_13 = AFEC_MR_STARTUP_SUT832,
AFEC_STARTUP_TIME_14 = AFEC_MR_STARTUP_SUT896,
AFEC_STARTUP_TIME_15 = AFEC_MR_STARTUP_SUT960
} |
| Definitions for AFEC Start Up Time. More...
|
|
enum | afec_temp_cmp_mode {
AFEC_TEMP_CMP_MODE_0 = AFEC_TEMPMR_TEMPCMPMOD_LOW,
AFEC_TEMP_CMP_MODE_1 = AFEC_TEMPMR_TEMPCMPMOD_HIGH,
AFEC_TEMP_CMP_MODE_2 = AFEC_TEMPMR_TEMPCMPMOD_IN,
AFEC_TEMP_CMP_MODE_3 = AFEC_TEMPMR_TEMPCMPMOD_OUT
} |
| Definitions for Temperature Comparison Mode. More...
|
|
enum | afec_trigger {
AFEC_TRIG_SW = AFEC_MR_TRGEN_DIS,
AFEC_TRIG_EXT = AFEC_MR_TRGSEL_AFEC_TRIG0 | AFEC_MR_TRGEN,
AFEC_TRIG_TIO_CH_0 = AFEC_MR_TRGSEL_AFEC_TRIG1 | AFEC_MR_TRGEN,
AFEC_TRIG_TIO_CH_1 = AFEC_MR_TRGSEL_AFEC_TRIG2 | AFEC_MR_TRGEN,
AFEC_TRIG_TIO_CH_2 = AFEC_MR_TRGSEL_AFEC_TRIG3 | AFEC_MR_TRGEN,
AFEC_TRIG_PWM_EVENT_LINE_0 = AFEC_MR_TRGSEL_AFEC_TRIG4 | AFEC_MR_TRGEN,
AFEC_TRIG_PWM_EVENT_LINE_1 = AFEC_MR_TRGSEL_AFEC_TRIG5 | AFEC_MR_TRGEN,
AFEC_TRIG_ANALOG_COMPARATOR = AFEC_MR_TRGSEL_AFEC_TRIG6 | AFEC_MR_TRGEN,
AFEC_TRIG_FREERUN = 0xFF
} |
| Definitions for AFEC trigger. More...
|
|
|
void | afec_ch_get_config_defaults (struct afec_ch_config *const cfg) |
| Get the AFEC channel default configurations. More...
|
|
static void | afec_ch_sanity_check (Afec *const afec, const enum afec_channel_num channel) |
| AFEC channel sanity check. More...
|
|
void | afec_ch_set_config (Afec *const afec, const enum afec_channel_num channel, struct afec_ch_config *config) |
| Configure the AFEC channel. More...
|
|
static void | afec_channel_disable (Afec *const afec, const enum afec_channel_num afec_ch) |
| Disable the specified AFEC channel. More...
|
|
static void | afec_channel_enable (Afec *const afec, const enum afec_channel_num afec_ch) |
| Enable the specified AFEC channel. More...
|
|
static uint32_t | afec_channel_get_status (Afec *const afec, const enum afec_channel_num afec_ch) |
| Get the AFEC channel status. More...
|
|
static uint32_t | afec_channel_get_value (Afec *const afec, enum afec_channel_num afec_ch) |
| Read the Converted Data of the selected channel. More...
|
|
static void | afec_channel_set_analog_offset (Afec *const afec, enum afec_channel_num afec_ch, uint16_t aoffset) |
| Set analog offset to be used for channel CSEL. More...
|
|
void | afec_configure_auto_error_correction (Afec *const afec, const enum afec_channel_num channel, int16_t offsetcorr, uint16_t gaincorr) |
|
void | afec_configure_sequence (Afec *const afec, const enum afec_channel_num ch_list[], const uint8_t uc_num) |
| Configure conversion sequence. More...
|
|
void | afec_disable (Afec *const afec) |
| Disable AFEC Module. More...
|
|
void | afec_disable_interrupt (Afec *const afec, enum afec_interrupt_source interrupt_source) |
| Disable AFEC interrupts. More...
|
|
void | afec_enable (Afec *const afec) |
| Enable AFEC Module. More...
|
|
void | afec_enable_interrupt (Afec *const afec, enum afec_interrupt_source interrupt_source) |
| Enable AFEC interrupts. More...
|
|
static enum afec_cmp_mode | afec_get_comparison_mode (Afec *const afec) |
| Get comparison mode. More...
|
|
void | afec_get_config_defaults (struct afec_config *const cfg) |
| Get the AFEC default configurations. More...
|
|
uint32_t | afec_get_correction_value (Afec *const afec, const enum afec_channel_num afec_ch) |
|
static uint32_t | afec_get_interrupt_mask (Afec *const afec) |
| Get AFEC interrupt mask. More...
|
|
static uint32_t | afec_get_interrupt_status (Afec *const afec) |
| Get AFEC interrupt status. More...
|
|
static uint32_t | afec_get_latest_chan_num (Afec *const afec) |
| Get the Last Converted Channel Number. More...
|
|
static uint32_t | afec_get_latest_value (Afec *const afec) |
| Get the Last Data Converted. More...
|
|
static uint32_t | afec_get_overrun_status (Afec *const afec) |
| Get AFEC overrun error status. More...
|
|
static Pdc * | afec_get_pdc_base (Afec *const afec) |
| Get PDC registers base address. More...
|
|
static uint32_t | afec_get_writeprotect_status (Afec *const afec) |
| Indicate write protect status. More...
|
|
enum status_code | afec_init (Afec *const afec, struct afec_config *const config) |
| Initialize the AFEC Module. More...
|
|
void | afec_set_callback (Afec *const afec, enum afec_interrupt_source source, afec_callback_t callback, uint8_t irq_level) |
| Set callback for AFEC. More...
|
|
void | afec_set_comparison_mode (Afec *const afec, const enum afec_cmp_mode mode, const enum afec_channel_num channel, uint8_t cmp_filter) |
| Configure comparison mode. More...
|
|
static void | afec_set_comparison_window (Afec *const afec, const uint16_t us_low_threshold, const uint16_t us_high_threshold) |
| Configure AFEC compare window. More...
|
|
void | afec_set_power_mode (Afec *const afec, const enum afec_power_mode mode) |
| Configure AFEC power mode. More...
|
|
static void | afec_set_resolution (Afec *const afec, const enum afec_resolution res) |
| Configure conversion resolution. More...
|
|
void | afec_set_sample_hold_mode (Afec *const afec, const enum afec_channel_num channel, const enum afec_sample_hold_mode mode) |
|
static void | afec_set_trigger (Afec *const afec, const enum afec_trigger trigger) |
| Configure conversion trigger and free run mode. More...
|
|
static void | afec_set_writeprotect (Afec *const afec, const bool is_enable) |
| Enable or disable write protection of AFEC registers. More...
|
|
static enum status_code | afec_start_calibration (Afec *const afec) |
| Launch an automatic calibration of the AFEC on next sequence. More...
|
|
static void | afec_start_software_conversion (Afec *const afec) |
| Start analog-to-digital conversion. More...
|
|
void | afec_temp_sensor_get_config_defaults (struct afec_temp_sensor_config *const cfg) |
| Get the AFEC Temperature Sensor default configurations. More...
|
|
void | afec_temp_sensor_set_config (Afec *const afec, struct afec_temp_sensor_config *config) |
| Configure the AFEC temperature sensor. More...
|
|