Microchip® Advanced Software Framework

dac.h File Reference

SAM Peripheral Digital-to-Analog Converter Driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <clock.h>
#include <gclk.h>
#include <system_interrupt.h>
#include <dac_feature.h>

Macros

#define DAC_TIMEOUT   0xFFFF
 Define DAC features set according to different device families. More...
 

Typedefs

typedef void(* dac_callback_t )(uint8_t channel)
 Type definition for a DAC module callback function. More...
 

Enumerations

enum  dac_callback {
  DAC_CALLBACK_DATA_EMPTY,
  DAC_CALLBACK_DATA_UNDERRUN,
  DAC_CALLBACK_TRANSFER_COMPLETE
}
 Enum for the possible callback types for the DAC module. More...
 

Functions

Configuration and Initialization
bool dac_is_syncing (struct dac_module *const dev_inst)
 Determines if the hardware module(s) are currently synchronizing to the bus. More...
 
void dac_get_config_defaults (struct dac_config *const config)
 Initializes a DAC configuration structure to defaults. More...
 
enum status_code dac_init (struct dac_module *const dev_inst, Dac *const module, struct dac_config *const config)
 Initialize the DAC device struct. More...
 
void dac_reset (struct dac_module *const dev_inst)
 Resets the DAC module. More...
 
void dac_enable (struct dac_module *const dev_inst)
 Enable the DAC module. More...
 
void dac_disable (struct dac_module *const dev_inst)
 Disable the DAC module. More...
 
void dac_enable_events (struct dac_module *const module_inst, struct dac_events *const events)
 Enables a DAC event input or output. More...
 
void dac_disable_events (struct dac_module *const module_inst, struct dac_events *const events)
 Disables a DAC event input or output. More...
 
Configuration and Initialization (Channel)
void dac_chan_get_config_defaults (struct dac_chan_config *const config)
 
void dac_chan_set_config (struct dac_module *const dev_inst, const enum dac_channel channel, struct dac_chan_config *const config)
 Writes a DAC channel configuration to the hardware module. More...
 
void dac_chan_enable (struct dac_module *const dev_inst, enum dac_channel channel)
 Enable a DAC channel. More...
 
void dac_chan_disable (struct dac_module *const dev_inst, enum dac_channel channel)
 Disable a DAC channel. More...
 
Channel Data Management
enum status_code dac_chan_write (struct dac_module *const dev_inst, enum dac_channel channel, const uint16_t data)
 Write to the DAC. More...
 
enum status_code dac_chan_write_buffer_wait (struct dac_module *const module_inst, enum dac_channel channel, uint16_t *buffer, uint32_t length)
 Write to the DAC. More...
 
Status Management
uint32_t dac_get_status (struct dac_module *const module_inst)
 Retrieves the current module status. More...
 
void dac_clear_status (struct dac_module *const module_inst, uint32_t status_flags)
 Clears a module status flag. More...