Microchip® Advanced Software Framework

afec.c File Reference

Analog-Front-End Controller driver for SAM.

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

#include "afec.h"
#include "sleepmgr.h"
#include "status_codes.h"
#include "sysclk.h"

Macros

#define AFEC_INTERRUPT_GAP2   (1UL)
 
#define AFEC_SEQ1_CHANNEL_NUM   (8UL)
 
#define AFEC_TEMP_INT_SOURCE_NUM   (15UL)
 
#define NUM_OF_AFEC   (1UL)
 

Functions

void AFEC0_Handler (void)
 Interrupt handler for AFEC0. More...
 
void AFEC1_Handler (void)
 Interrupt handler for AFEC1. More...
 
void afec_ch_get_config_defaults (struct afec_ch_config *const cfg)
 Get the AFEC channel default configurations. 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...
 
void afec_configure_sequence (Afec *const afec, const enum afec_channel_num ch_list[], 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 uint32_t afec_find_inst_num (Afec *const afec)
 Get AFEC instance number. More...
 
static uint32_t afec_find_pid (Afec *const afec)
 Get AFEC Peripheral ID. More...
 
void afec_get_config_defaults (struct afec_config *const cfg)
 Get the AFEC default configurations. More...
 
enum status_code afec_init (Afec *const afec, struct afec_config *config)
 Initialize the AFEC Module. More...
 
static void afec_interrupt (uint8_t inst_num, enum afec_interrupt_source source)
 Common AFEC interrupt handler. More...
 
static void afec_process_callback (Afec *const afec)
 Call the callback function if the corresponding interrupt is asserted. 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_config (Afec *const afec, struct afec_config *config)
 Configure the AFEC Module. More...
 
void afec_set_power_mode (Afec *const afec, const enum afec_power_mode mode)
 Configure AFEC power mode. 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...
 

Variables

afec_callback_t afec_callback_pointer [NUM_OF_AFEC][_AFEC_NUM_OF_INTERRUPT_SOURCE]