Atmel Software Framework

dac.h File Reference

AVR XMEGA Digital to Analog Converter driver.

Copyright (c) 2010-2016 Atmel Corporation. All rights reserved.

#include <compiler.h>
#include <nvm.h>
#include <sysclk.h>

Data Structures

struct  dac_config
 DAC configuration. More...
 

Macros

#define XMEGA_DAC_VERSION_1   true
 
DAC channel masks
#define DAC_CH0   (1 << 0)
 DAC channel 0. More...
 
#define DAC_CH1   (1 << 1)
 DAC channel 1. More...
 

Enumerations

enum  dac_adjust {
  DAC_ADJ_RIGHT,
  DAC_ADJ_LEFT = DAC_LEFTADJ_bm
}
 DAC value adjust settings. More...
 
enum  dac_reference {
  DAC_REF_BANDGAP = DAC_REFSEL_INT1V_gc,
  DAC_REF_AVCC = DAC_REFSEL_AVCC_gc,
  DAC_REF_AREFA = DAC_REFSEL_AREFA_gc,
  DAC_REF_AREFB = DAC_REFSEL_AREFB_gc
}
 DAC reference settings. More...
 

Functions

DAC module and channel management
void dac_enable (DAC_t *dac)
 Enable DAC. More...
 
void dac_disable (DAC_t *dac)
 Disable DAC. More...
 
bool dac_is_enabled (DAC_t *dac)
 Check if DAC is enabled. More...
 
static __always_inline uint8_t dac_get_calibration_data (enum dac_calibration_data cal)
 Get calibration data. More...
 
static __always_inline void dac_set_channel_value (DAC_t *dac, uint8_t ch_mask, uint16_t val)
 Set value of DAC channel. More...
 
static __always_inline uint16_t dac_get_channel_value (DAC_t *dac, uint8_t ch_mask)
 Get value of DAC channel. More...
 
static __always_inline bool dac_channel_is_ready (DAC_t *dac, uint8_t ch_mask)
 Check whether DAC channel(s) are ready for data. More...
 
static __always_inline void dac_wait_for_channel_ready (DAC_t *dac, uint8_t ch_mask)
 Wait for DAC channel(s) to get ready for data. More...
 
DAC module and channel configuration
void dac_write_configuration (DAC_t *dac, struct dac_config *conf)
 Write configuration to DAC. More...
 
void dac_read_configuration (DAC_t *dac, struct dac_config *conf)
 Read configuration from DAC. More...
 
static __always_inline void dac_set_active_channel (struct dac_config *conf, uint8_t ch_mask, uint8_t int_out_ch_mask)
 Set active DAC channel(s) and output(s) More...
 
static __always_inline void dac_set_refresh_interval (struct dac_config *conf, uint8_t us)
 Set automatic refresh timing interval. More...
 
static __always_inline void dac_set_conversion_interval (struct dac_config *conf, uint8_t us)
 Set conversion timing interval. More...
 
static __always_inline void dac_set_conversion_parameters (struct dac_config *conf, enum dac_reference ref, enum dac_adjust adj)
 Set DA conversion parameters. More...
 
static __always_inline void dac_set_conversion_trigger (struct dac_config *conf, uint8_t ch_mask, uint8_t ev_ch)
 Set DA conversions triggers. More...