AFEC XDMAC example for SAM.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "asf.h"
Macros | |
#define | AFEC0_XDMAC_CH_NUM 35 |
XDMAC channel HW Interface number for AFEC0. More... | |
#define | BUFFER_SIZE 100 |
The buffer size for transfer. More... | |
#define | MAX_DIGITAL (4095UL) |
The maximal digital value. More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | VOLT_REF (3300) |
Reference voltage for AFEC,in mv. More... | |
#define | XDMAC_CH 0 |
XDMAC channel used in this example. More... | |
Functions | |
static void | afec_callback (void) |
Callback function for AFE interrupt. More... | |
static void | afec_xdmac_configure (Afec *const afec) |
configure xdmac for afec. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
int | main (void) |
Application entry point. More... | |
void | XDMAC_Handler (void) |
XDMAC interrupt handler. More... | |
Variables | |
static uint32_t | afec_buf [BUFFER_SIZE] |
static xdmac_channel_config_t | xdmac_channel_cfg |
XDMAC channel configuration. More... | |
#define AFEC0_XDMAC_CH_NUM 35 |
XDMAC channel HW Interface number for AFEC0.
Referenced by afec_xdmac_configure().
#define BUFFER_SIZE 100 |
The buffer size for transfer.
Referenced by afec_callback(), and afec_xdmac_configure().
#define MAX_DIGITAL (4095UL) |
The maximal digital value.
Referenced by afec_callback().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define VOLT_REF (3300) |
Reference voltage for AFEC,in mv.
Referenced by afec_callback().
#define XDMAC_CH 0 |
XDMAC channel used in this example.
Referenced by afec_xdmac_configure(), and XDMAC_Handler().
|
static |
Callback function for AFE interrupt.
References afec_buf, BUFFER_SIZE, MAX_DIGITAL, and VOLT_REF.
Referenced by XDMAC_Handler().
|
static |
configure xdmac for afec.
afec | Base address of the AFEC |
References AFEC0_XDMAC_CH_NUM, afec_buf, BUFFER_SIZE, xdmac_channel_config_t::mbr_bc, xdmac_channel_config_t::mbr_cfg, xdmac_channel_config_t::mbr_da, xdmac_channel_config_t::mbr_ds, xdmac_channel_config_t::mbr_dus, xdmac_channel_config_t::mbr_sa, xdmac_channel_config_t::mbr_sus, xdmac_channel_config_t::mbr_ubc, pmc_enable_periph_clk(), XDMAC_CH, xdmac_channel_enable(), xdmac_channel_enable_interrupt(), xdmac_channel_set_descriptor_control(), xdmac_configure_transfer(), xdmac_enable_interrupt(), XDMAC_UBC_NDE_FETCH_DIS, XDMAC_UBC_NDEN_UPDATED, and XDMAC_UBC_NVIEW_NDV0.
Referenced by main().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Application entry point.
References afec_ch_get_config_defaults(), afec_ch_set_config(), afec_channel_enable(), afec_channel_set_analog_offset(), afec_enable(), AFEC_GAINVALUE_0, afec_get_config_defaults(), afec_init(), afec_set_trigger(), afec_temp_sensor_get_config_defaults(), afec_temp_sensor_set_config(), AFEC_TRIG_FREERUN, afec_xdmac_configure(), board_init(), configure_console(), afec_ch_config::gain, afec_temp_sensor_config::rctc, STRING_HEADER, and sysclk_init().
void XDMAC_Handler | ( | void | ) |
XDMAC interrupt handler.
References afec_callback(), XDMAC_CH, and xdmac_channel_get_interrupt_status().
|
static |
Referenced by afec_callback(), and afec_xdmac_configure().
|
static |
XDMAC channel configuration.