SAMV71 Xplained Ultra Software Package 1.5

dac_dma.h File Reference

#include "chip.h"
#include <stdint.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  DacCmd
 Dac Transfer Request prepared by the application upper layer. More...
struct  DacDma

Defines

#define DAC_OK   0
#define DAC_ERROR   1
#define DAC_ERROR_LOCK   2
#define DACC_CHANNEL_0   0
#define DACC_CHANNEL_1   1
#define DACC_SoftReset(pDACC)   ((pDACC)->DACC_CR = DACC_CR_SWRST)
#define DACC_CfgModeReg(pDACC, mode)   { (pDACC)->DACC_MR = (mode); }
#define DACC_GetModeReg(pDACC)   ((pDACC)->DACC_MR)
#define DACC_CfgTrigger(pDACC, mode)   { (pDACC)->DACC_TRIGR = (mode); }
#define DACC_EnableChannel(pDACC, channel)   {(pDACC)->DACC_CHER = (1 << (channel));}
#define DACC_DisableChannel(pDACC, channel)   {(pDACC)->DACC_CHDR = (1 << (channel));}
#define DACC_EnableIt(pDACC, mode)   {(pDACC)->DACC_IER = (mode);}
#define DACC_DisableIt(pDACC, mode)   {(pDACC)->DACC_IDR = (mode);}
#define DACC_GetStatus(pDACC)   ((pDACC)->DACC_ISR)
#define DACC_GetChannelStatus(pDACC)   ((pDACC)->DACC_CHSR)
#define DACC_GetInterruptMaskStatus(pDACC)   ((pDACC)->DACC_IMR)

Typedefs

typedef void(* DacCallback )(uint8_t, void *)

Functions

uint32_t Dac_ConfigureDma (DacDma *pDacd, Dacc *pDacHw, uint8_t DacId, sXdmad *pXdmad)
 Initializes the DacDma structure and the corresponding DAC & DMA . hardware select value. The driver will uses DMA channel 0 for RX . The DMA channels are freed automatically when no DMA command processing.
uint32_t Dac_SendData (DacDma *pDacd, DacCmd *pCommand)
 Starts a DAC transfer. This is a non blocking function. It will return as soon as the transfer is started.

Detailed Description

Purpose

Interface for configuration the Analog-to-Digital Converter (DACC) peripheral.

Usage

  1. Configurate the pins for DACC
  2. Initialize the DACC with DACC_Initialize().
  3. Select the active channel using DACC_EnableChannel()
  4. Start the conversion with DACC_StartConversion()
  5. Wait the end of the conversion by polling status with DACC_GetStatus()
  6. Finally, get the converted data using DACC_GetConvertedData()

Definition in file dac_dma.h.


Typedef Documentation

typedef void(* DacCallback)(uint8_t, void *)

DAC transfer complete callback.

Definition at line 69 of file dac_dma.h.


Function Documentation

uint32_t Dac_ConfigureDma ( DacDma pDacd,
Dacc pDacHw,
uint8_t  DacId,
sXdmad pXdmad 
)

Initializes the DacDma structure and the corresponding DAC & DMA . hardware select value. The driver will uses DMA channel 0 for RX . The DMA channels are freed automatically when no DMA command processing.

Parameters:
pDacd Pointer to a DacDma instance.
pDacHw Associated Dac peripheral.
DacId Dac peripheral identifier.
pDmad Pointer to a Dmad instance.

Definition at line 188 of file dac_dma.c.

uint32_t Dac_SendData ( DacDma pDacd,
DacCmd pCommand 
)

Starts a DAC transfer. This is a non blocking function. It will return as soon as the transfer is started.

Parameters:
pDacd Pointer to a DacDma instance.
pCommand Pointer to the Dac command to execute.
Returns:
0 if the transfer has been started successfully; otherwise returns DAC_ERROR_LOCK is the driver is in use, or DAC_ERROR if the command is not valid.

Definition at line 212 of file dac_dma.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines