Microchip® Advanced Software Framework

afec_xdmac_example.c File Reference

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
Value:
"-- AFEC XDMAC Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: fatfs_access_example.c:112
#define STRING_EOL
Definition: afec_xdmac_example.c:115

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 void afec_callback ( void  )
static

Callback function for AFE interrupt.

References afec_buf, BUFFER_SIZE, MAX_DIGITAL, and VOLT_REF.

Referenced by XDMAC_Handler().

static void configure_console ( void  )
static

Configure UART console.

References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

void XDMAC_Handler ( void  )

XDMAC interrupt handler.

References afec_callback(), XDMAC_CH, and xdmac_channel_get_interrupt_status().

uint32_t afec_buf[BUFFER_SIZE]
static
xdmac_channel_config_t xdmac_channel_cfg
static

XDMAC channel configuration.