Microchip® Advanced Software Framework

dac.c File Reference

SAM Peripheral Digital-to-Analog Converter Driver.

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

#include "dac.h"
#include <system.h>
#include <pinmux.h>

Functions

static void _dac_set_config (struct dac_module *const module_inst, struct dac_config *const config)
 
void dac_chan_disable (struct dac_module *const module_inst, enum dac_channel channel)
 Disable a DAC channel. More...
 
void dac_chan_enable (struct dac_module *const module_inst, enum dac_channel channel)
 Enable a DAC channel. More...
 
void dac_chan_get_config_defaults (struct dac_chan_config *const config)
 
bool dac_chan_is_end_of_conversion (struct dac_module *const module_inst, enum dac_channel channel)
 Retrieves the status of DAC channel end of conversion. More...
 
void dac_chan_set_config (struct dac_module *const module_inst, const enum dac_channel channel, struct dac_chan_config *const config)
 Writes a DAC channel configuration to the hardware module. More...
 
enum status_code dac_chan_write (struct dac_module *const module_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...
 
void dac_clear_status (struct dac_module *const module_inst, uint32_t status_flags)
 Clears a module status flag. More...
 
void dac_disable (struct dac_module *const module_inst)
 Disable the DAC module. More...
 
void dac_disable_events (struct dac_module *const module_inst, struct dac_events *const events)
 Disables a DAC event input or output. More...
 
void dac_enable (struct dac_module *const module_inst)
 Enable 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_get_config_defaults (struct dac_config *const config)
 Initializes a DAC configuration structure to defaults. More...
 
uint32_t dac_get_status (struct dac_module *const module_inst)
 Retrieves the current module status. More...
 
enum status_code dac_init (struct dac_module *const module_inst, Dac *const module, struct dac_config *const config)
 Initialize the DAC device struct. More...
 
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_reset (struct dac_module *const module_inst)
 Resets the DAC module. More...
 

static void _dac_set_config ( struct dac_module *const  module_inst,
struct dac_config *const  config 
)
static

Writes a DAC configuration to the hardware module.

Writes out a given configuration to the hardware module.

Parameters
[out]module_instPointer to the DAC software instance struct
[in]configPointer to the configuration struct

References Assert, DAC_CHANNEL_0, DAC_CHANNEL_1, dac_config::differential_mode, and dac_config::reference.

Referenced by dac_init().