Macros | Functions | Variables
Analog-Front-End Controller

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)
 
static uint32_t afec_find_pid (Afec *const afec)
 
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)
 
static void afec_process_callback (Afec *const afec)
 
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)
 
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]
 

Detailed Description

See Quickstart guide for SAM AFEC driver.

Driver for the Analog-Front-End Controller. This driver provides access to the main features of the AFEC controller.

Macro Definition Documentation

◆ AFEC_INTERRUPT_GAP2

#define AFEC_INTERRUPT_GAP2   (1UL)

Definition at line 74 of file afec.c.

◆ AFEC_SEQ1_CHANNEL_NUM

#define AFEC_SEQ1_CHANNEL_NUM   (8UL)

Definition at line 78 of file afec.c.

◆ AFEC_TEMP_INT_SOURCE_NUM

#define AFEC_TEMP_INT_SOURCE_NUM   (15UL)

Definition at line 85 of file afec.c.

◆ NUM_OF_AFEC

#define NUM_OF_AFEC   (1UL)

Definition at line 56 of file afec.c.

Function Documentation

◆ AFEC0_Handler()

void AFEC0_Handler ( void  )

Interrupt handler for AFEC0.

Definition at line 558 of file afec.c.

◆ AFEC1_Handler()

void AFEC1_Handler ( void  )

Interrupt handler for AFEC1.

Definition at line 566 of file afec.c.

◆ afec_ch_get_config_defaults()

void afec_ch_get_config_defaults ( struct afec_ch_config *const  cfg)

Get the AFEC channel default configurations.

Use to initialize the configuration structure to known default values.

The default configuration is as follows:

  • Single Ended Mode
  • Gain value is 1
Parameters
cfgPointer to channel configuration structure to be initiated.

Definition at line 271 of file afec.c.

◆ afec_ch_set_config()

void afec_ch_set_config ( Afec *const  afec,
const enum afec_channel_num  channel,
struct afec_ch_config config 
)

Configure the AFEC channel.

Parameters
afecBase address of the AFEC
channelThe channel number
configConfiguration for the AFEC channel

Definition at line 180 of file afec.c.

◆ afec_configure_sequence()

void afec_configure_sequence ( Afec *const  afec,
const enum afec_channel_num  ch_list[],
uint8_t  uc_num 
)

Configure conversion sequence.

Parameters
afecBase address of the AFEC.
ch_listChannel sequence list.
uc_numNumber of channels in the list.

Definition at line 610 of file afec.c.

◆ afec_disable()

void afec_disable ( Afec *const  afec)

Disable AFEC Module.

Parameters
afecBase address of the AFEC

Definition at line 592 of file afec.c.

◆ afec_disable_interrupt()

void afec_disable_interrupt ( Afec *const  afec,
enum afec_interrupt_source  interrupt_source 
)

Disable AFEC interrupts.

Parameters
afecBase address of the AFEC.
interrupt_sourceInterrupts to be disabled.

Definition at line 467 of file afec.c.

◆ afec_enable()

void afec_enable ( Afec *const  afec)

Enable AFEC Module.

Parameters
afecBase address of the AFEC

Definition at line 576 of file afec.c.

◆ afec_enable_interrupt()

void afec_enable_interrupt ( Afec *const  afec,
enum afec_interrupt_source  interrupt_source 
)

Enable AFEC interrupts.

Parameters
afecBase address of the AFEC.
interrupt_sourceInterrupts to be enabled.

Definition at line 434 of file afec.c.

◆ afec_find_inst_num()

static uint32_t afec_find_inst_num ( Afec *const  afec)
static

Definition at line 99 of file afec.c.

◆ afec_find_pid()

static uint32_t afec_find_pid ( Afec *const  afec)
static

Definition at line 122 of file afec.c.

◆ afec_get_config_defaults()

void afec_get_config_defaults ( struct afec_config *const  cfg)

Get the AFEC default configurations.

Use to initialize the configuration structure to known default values. This function should be called at the start of any AFEC initiation.

The default configuration is as follows:

  • 12 -bit resolution
  • AFEC clock frequency is 6MHz
  • Start Up Time is 64 periods AFEC clock, for SAMV71 is 24 periods AFEC clock
  • Analog Settling Time is 3 periods of AFEC clock
  • Tracking Time is 3 periods of AFEC clock
  • Transfer Period is 5 periods AFEC clock,for SAMV71 is 7 periods AFEC clock
  • Allows different analog settings for each channel
  • The controller converts channels in a simple numeric order
  • Appends the channel number to the conversion result in AFE_LDCR register
  • Only a Single Trigger is required to get an averaged value
  • AFE Bias Current Control value is 1
Parameters
cfgPointer to configuration structure to be initiated.

Definition at line 239 of file afec.c.

◆ afec_init()

enum status_code afec_init ( Afec *const  afec,
struct afec_config config 
)

Initialize the AFEC Module.

Parameters
afecBase address of the AFEC
configConfiguration for the AFEC
Return values
STATUS_OKInitialization is finished.
STATUS_ERR_BUSYInitialization failed.

Definition at line 315 of file afec.c.

◆ afec_interrupt()

static void afec_interrupt ( uint8_t  inst_num,
enum afec_interrupt_source  source 
)
static

Definition at line 504 of file afec.c.

◆ afec_process_callback()

static void afec_process_callback ( Afec *const  afec)
static

Definition at line 518 of file afec.c.

◆ afec_set_callback()

void afec_set_callback ( Afec *const  afec,
enum afec_interrupt_source  source,
afec_callback_t  callback,
uint8_t  irq_level 
)

Set callback for AFEC.

Parameters
afecBase address of the AFEC
sourceInterrupt source
callbackCallback function pointer
irq_levelInterrupt level

Definition at line 411 of file afec.c.

◆ afec_set_comparison_mode()

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.

Parameters
afecBase address of the AFEC.
modeComparison mode.
channelComparison Selected Channel.
cmp_filterCompare Event Filtering.

Definition at line 351 of file afec.c.

◆ afec_set_config()

static void afec_set_config ( Afec *const  afec,
struct afec_config config 
)
static

Definition at line 144 of file afec.c.

◆ afec_set_power_mode()

void afec_set_power_mode ( Afec *const  afec,
const enum afec_power_mode  mode 
)

Configure AFEC power mode.

Parameters
afecBase address of the AFEC.
modeAFEC power mode value.

Definition at line 380 of file afec.c.

◆ afec_temp_sensor_get_config_defaults()

void afec_temp_sensor_get_config_defaults ( struct afec_temp_sensor_config *const  cfg)

Get the AFEC Temperature Sensor default configurations.

Use to initialize the configuration structure to known default values.

The default configuration is as follows:

  • The temperature sensor measure is not triggered by RTC event
  • Generates an event when the converted data is in the comparison window
  • The window range is 0xFF ~ 0xFFF
Parameters
cfgPointer to temperature sensor configuration structure to be initiated.

Definition at line 294 of file afec.c.

◆ afec_temp_sensor_set_config()

void afec_temp_sensor_set_config ( Afec *const  afec,
struct afec_temp_sensor_config config 
)

Configure the AFEC temperature sensor.

Parameters
afecBase address of the AFEC
configConfiguration for the AFEC temperature sensor

Definition at line 203 of file afec.c.

Variable Documentation

◆ afec_callback_pointer

afec_callback_t afec_callback_pointer[NUM_OF_AFEC][_AFEC_NUM_OF_INTERRUPT_SOURCE]

Definition at line 88 of file afec.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:01