This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the conversion of digital values to analog voltage.
The following driver API modes are covered by this manual:
The following peripheral is used by this module:
The following devices can use this module:
The outline of this documentation is as follows:
There are no prerequisites for this module.
The Digital-to-Analog converter converts a digital value to analog voltage. The SAM DAC module has one channel with 10-bit resolution, and is capable of converting up to 350k samples per second (ksps).
A common use of DAC is to generate audio signals by connecting the DAC output to a speaker, or to generate a reference voltage; either for an external circuit or an internal peripheral such as the Analog Comparator.
After being set up, the DAC will convert new digital values written to the conversion data register (DATA) to an analog value either on the VOUT pin of the device, or internally for use as an input to the AC, ADC, and other analog modules.
Writing the DATA register will start a new conversion. It is also possible to trigger the conversion from the event system.
A simplified block diagram of the DAC can be seen in the figure below.
The conversion range is between GND and the selected voltage reference. Available voltage references are:
The output voltage from a DAC channel is given as:
\[ V_{OUT} = \frac{DATA}{0x3FF} \times VREF \]
The digital value written to the conversion data register (DATA) will be converted to an analog value. Writing the DATA register will start a new conversion. It is also possible to write the conversion data to the DATABUF register, the writing of the DATA register can then be triggered from the event system, which will load the value from DATABUF to DATA.
The analog output value can be output to either the VOUT pin or internally, but not both at the same time.
The output buffer must be enabled in order to drive the DAC output to the VOUT pin. Due to the output buffer, the DAC has high drive strength, and is capable of driving both resistive and capacitive loads, as well as loads which combine both.
The analog value can be internally available for use as input to the AC or ADC modules.
Events generation and event actions are configurable in the DAC. The DAC has one event line input and one event output: Start Conversion and Data Buffer Empty.
If the Start Conversion input event is enabled in the module configuration, an incoming event will load data from the data buffer to the data register and start a new conversion. This method synchronizes conversions with external events (such as those from a timer module) and ensures regular and fixed conversion intervals.
If the Data Buffer Empty output event is enabled in the module configuration, events will be generated when the DAC data buffer register becomes empty and new data can be loaded to the buffer.
The 10-bit input value to the DAC is contained in a 16-bit register. This can be configured to be either left or right adjusted. In the figure below both options are shown, and the position of the most (MSB) and the least (LSB) significant bits are indicated. The unused bits should always be written to zero.
The clock for the DAC interface (CLK_DAC) is generated by the Power Manager. This clock is turned on by default, and can be enabled and disabled in the Power Manager.
Additionally, an asynchronous clock source (GCLK_DAC) is required. These clocks are normally disabled by default. The selected clock source must be enabled in the Power Manager before it can be used by the DAC. The DAC core operates asynchronously from the user interface and peripheral bus. As a consequence, the DAC needs two clock cycles of both CLK_DAC and GCLK_DAC to synchronize the values written to some of the control and data registers. The oscillator source for the GCLK_DAC clock is selected in the System Control Interface (SCIF).
The DAC can only do conversions in Active or Idle modes. However, if the output buffer is enabled it will draw current even if the system is in sleep mode. Therefore, always make sure that the output buffer is not enabled when it is not needed, to ensure minimum power consumption.
DAC conversion time is approximately 2.85μs. The user must ensure that new data is not written to the DAC before the last conversion is complete. Conversions should be triggered by a periodic event from a Timer/Counter or another peripheral.
For extra information, see Extra Information for DAC Driver. This includes:
For a list of examples related to this driver, see Examples for DAC Driver.
Data Structures | |
struct | dac_chan_config |
DAC channel configuration structure. More... | |
struct | dac_config |
DAC configuration structure. More... | |
struct | dac_events |
DAC event enable/disable structure. More... | |
struct | dac_module |
DAC software device instance structure. More... | |
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... | |
enum | dac_channel { DAC_CHANNEL_0 } |
DAC channel selection enum. More... | |
enum | dac_output { DAC_OUTPUT_EXTERNAL = DAC_CTRLB_EOEN, DAC_OUTPUT_INTERNAL = DAC_CTRLB_IOEN, DAC_OUTPUT_NONE = 0 } |
DAC output selection enum. More... | |
enum | dac_reference { DAC_REFERENCE_INT1V = DAC_CTRLB_REFSEL(0), DAC_REFERENCE_AVCC = DAC_CTRLB_REFSEL(1), DAC_REFERENCE_AREF = DAC_CTRLB_REFSEL(2) } |
DAC reference voltage enum. More... | |
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) |
Initializes a DAC channel configuration structure to defaults. More... | |
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... | |
Callback Configuration and Initialization | |
enum status_code | dac_chan_write_buffer_job (struct dac_module *const module_inst, const enum dac_channel channel, uint16_t *buffer, uint32_t buffer_size) |
Convert a specific number digital data to analog through DAC. More... | |
enum status_code | dac_chan_write_job (struct dac_module *const module_inst, const enum dac_channel channel, uint16_t data) |
Convert one digital data job. More... | |
enum status_code | dac_register_callback (struct dac_module *const module, const enum dac_channel channel, const dac_callback_t callback, const enum dac_callback type) |
Registers an asynchronous callback function with the driver. More... | |
enum status_code | dac_unregister_callback (struct dac_module *const module, const enum dac_channel channel, const enum dac_callback type) |
Unregisters an asynchronous callback function with the driver. More... | |
Callback Enabling and Disabling (Channel) | |
enum status_code | dac_chan_enable_callback (struct dac_module *const module, const enum dac_channel channel, const enum dac_callback type) |
Enables asynchronous callback generation for a given channel and type. More... | |
enum status_code | dac_chan_disable_callback (struct dac_module *const module, const enum dac_channel channel, const enum dac_callback type) |
Disables asynchronous callback generation for a given channel and type. More... | |
enum status_code | dac_chan_get_job_status (struct dac_module *module_inst, const enum dac_channel channel) |
Gets the status of a job. More... | |
void | dac_chan_abort_job (struct dac_module *module_inst, const enum dac_channel channel) |
Aborts an ongoing job. More... | |
DAC Status Flags | |
DAC status flags, returned by dac_get_status() and cleared by dac_clear_status(). | |
#define | DAC_STATUS_CHANNEL_0_EMPTY (1UL << 0) |
Data Buffer Empty Channel 0 - Set when data is transferred from DATABUF to DATA by a start conversion event and DATABUF is ready for new data. More... | |
#define | DAC_STATUS_CHANNEL_0_UNDERRUN (1UL << 1) |
Under-run Channel 0 - Set when a start conversion event occurs when DATABUF is empty. More... | |
Configuration and Initialization (Channel) | |
void | dac_chan_enable_output_buffer (struct dac_module *const dev_inst, const enum dac_channel channel) |
Enable the output buffer. More... | |
void | dac_chan_disable_output_buffer (struct dac_module *const dev_inst, const enum dac_channel channel) |
Disable the output buffer. More... | |
#define DAC_STATUS_CHANNEL_0_EMPTY (1UL << 0) |
Data Buffer Empty Channel 0 - Set when data is transferred from DATABUF to DATA by a start conversion event and DATABUF is ready for new data.
Referenced by dac_clear_status(), and dac_get_status().
#define DAC_STATUS_CHANNEL_0_UNDERRUN (1UL << 1) |
Under-run Channel 0 - Set when a start conversion event occurs when DATABUF is empty.
Referenced by dac_clear_status(), and dac_get_status().
#define DAC_TIMEOUT 0xFFFF |
Define DAC features set according to different device families.
Referenced by dac_chan_write_buffer_wait().
typedef void(* dac_callback_t)(uint8_t channel) |
Type definition for a DAC module callback function.
enum dac_callback |
Enum for the possible callback types for the DAC module.
enum dac_channel |
enum dac_output |
enum dac_reference |
void dac_chan_abort_job | ( | struct dac_module * | module_inst, |
const enum dac_channel | channel | ||
) |
Aborts an ongoing job.
Aborts an ongoing job.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | Logical channel to enable callback function |
References Assert, STATUS_ABORTED, and UNUSED.
void dac_chan_disable | ( | struct dac_module *const | module_inst, |
enum dac_channel | channel | ||
) |
Disable a DAC channel.
Disables the selected DAC channel.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | Channel to disable |
References UNUSED.
enum status_code dac_chan_disable_callback | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
const enum dac_callback | type | ||
) |
Disables asynchronous callback generation for a given channel and type.
Disables asynchronous callbacks for a given logical DAC channel and type.
[in,out] | dac_module | Pointer to the DAC software instance struct |
[in] | channel | Logical channel to disable callback function |
[in] | type | Type of callback function callbacks to disable |
STATUS_OK | The callback was disabled successfully |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
References Assert, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.
void dac_chan_disable_output_buffer | ( | struct dac_module *const | module_inst, |
enum dac_channel | channel | ||
) |
Disable the output buffer.
Disables the output buffer.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | DAC channel to alter |
References Assert, DAC_OUTPUT_EXTERNAL, and UNUSED.
void dac_chan_enable | ( | struct dac_module *const | module_inst, |
enum dac_channel | channel | ||
) |
Enable a DAC channel.
Enables the selected DAC channel.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | Channel to enable |
References UNUSED.
Referenced by test_dac_init().
enum status_code dac_chan_enable_callback | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
const enum dac_callback | type | ||
) |
Enables asynchronous callback generation for a given channel and type.
Enables asynchronous callbacks for a given logical DAC channel and type. This must be called before a DAC channel will generate callback events.
[in,out] | dac_module | Pointer to the DAC software instance struct |
[in] | channel | Logical channel to enable callback function |
[in] | type | Type of callback function callbacks to enable |
STATUS_OK | The callback was enabled successfully |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
References Assert, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.
void dac_chan_enable_output_buffer | ( | struct dac_module *const | module_inst, |
enum dac_channel | channel | ||
) |
Enable the output buffer.
Enables the output buffer and drives the DAC output to the VOUT pin.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | DAC channel to alter |
References Assert, DAC_OUTPUT_EXTERNAL, and UNUSED.
void dac_chan_get_config_defaults | ( | struct dac_chan_config *const | config | ) |
Initializes a DAC channel configuration structure to defaults.
Initializes a given DAC channel configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application.
The default configuration is as follows:
[out] | config | Configuration structure to initialize to default values |
References Assert.
Referenced by test_dac_init().
enum status_code dac_chan_get_job_status | ( | struct dac_module * | module_inst, |
const enum dac_channel | channel | ||
) |
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.
Writes a given channel configuration to the hardware module.
[in] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | Channel to configure |
[in] | config | Pointer to the configuration struct |
References UNUSED.
Referenced by test_dac_init().
enum status_code dac_chan_write | ( | struct dac_module *const | module_inst, |
enum dac_channel | channel, | ||
const uint16_t | data | ||
) |
Write to the DAC.
This function writes to the DATA or DATABUF register. If the conversion is not event-triggered, the data will be written to the DATA register and the conversion will start. If the conversion is event-triggered, the data will be written to DATABUF and transferred to the DATA register and converted when a Start Conversion Event is issued. Conversion data must be right or left adjusted according to configuration settings.
[in] | module_inst | Pointer to the DAC software device struct |
[in] | channel | DAC channel to write to |
[in] | data | Conversion data |
STATUS_OK | If the data was written |
References Assert, dac_is_syncing(), STATUS_OK, and UNUSED.
Referenced by dac_chan_write_buffer_wait(), run_ac_callback_mode_test(), run_ac_single_shot_test(), and run_ac_window_mode_test().
enum status_code dac_chan_write_buffer_job | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
uint16_t * | buffer, | ||
uint32_t | length | ||
) |
Convert a specific number digital data to analog through DAC.
This function will perform a conversion of specific number of digital data. The conversion should be event-triggered, the data will be written to DATABUF and transferred to the DATA register and converted when a Start Conversion Event is issued. Conversion data must be right or left adjusted according to configuration settings.
[in] | module_inst | Pointer to the DAC software device struct |
[in] | channel | DAC channel to write to |
[in] | buffer | Pointer to the digital data write buffer to be converted |
[in] | length | Size of the write buffer |
STATUS_OK | If the data was written |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
STATUS_BUSY | The DAC is busy to accept new job |
References Assert, dac_is_syncing(), STATUS_BUSY, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, system_interrupt_enable(), SYSTEM_INTERRUPT_MODULE_DAC, and UNUSED.
Referenced by dac_chan_write_job().
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.
This function converts a specific number of digital data. The conversion should be event-triggered, the data will be written to DATABUF and transferred to the DATA register and converted when a Start Conversion Event is issued. Conversion data must be right or left adjusted according to configuration settings.
[in] | module_inst | Pointer to the DAC software device struct |
[in] | channel | DAC channel to write to |
[in] | buffer | Pointer to the digital data write buffer to be converted |
[in] | length | Length of the write buffer |
STATUS_OK | If the data was written or no data conversion required |
STATUS_ERR_UNSUPPORTED_DEV | The DAC is not configured as using event trigger |
STATUS_BUSY | The DAC is busy to convert |
References Assert, dac_chan_write(), dac_is_syncing(), DAC_TIMEOUT, STATUS_BUSY, STATUS_ERR_TIMEOUT, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.
enum status_code dac_chan_write_job | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
uint16_t | data | ||
) |
Convert one digital data job.
This function will perform a conversion of specfic number of digital data. The conversion is event-triggered, the data will be written to DATABUF and transferred to the DATA register and converted when a Start Conversion Event is issued. Conversion data must be right or left adjusted according to configuration settings.
[in] | module_inst | Pointer to the DAC software device struct |
[in] | channel | DAC channel to write to |
[in] | data | Digital data to be converted |
STATUS_OK | If the data was written |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
STATUS_BUSY | The DAC is busy to accept new job |
References Assert, dac_chan_write_buffer_job(), STATUS_BUSY, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.
void dac_clear_status | ( | struct dac_module *const | module_inst, |
uint32_t | status_flags | ||
) |
Clears a module status flag.
Clears the given status flag of the module.
[in] | module_inst | Pointer to the DAC software device struct |
[in] | status_flags | Bit mask of status flags to clear |
References Assert, DAC_STATUS_CHANNEL_0_EMPTY, and DAC_STATUS_CHANNEL_0_UNDERRUN.
void dac_disable | ( | struct dac_module *const | module_inst | ) |
Disable the DAC module.
Disables the DAC interface and the output buffer.
[in] | module_inst | Pointer to the DAC software instance struct |
References Assert, and dac_is_syncing().
void dac_disable_events | ( | struct dac_module *const | module_inst, |
struct dac_events *const | events | ||
) |
Disables a DAC event input or output.
Disables one or more input or output events to or from the DAC module. See dac_events for a list of events this module supports.
[in] | module_inst | Software instance for the DAC peripheral |
[in] | events | Struct containing flags of events to disable |
References Assert, dac_events::generate_event_on_buffer_empty, and dac_events::on_event_start_conversion.
void dac_enable | ( | struct dac_module *const | module_inst | ) |
Enable the DAC module.
Enables the DAC interface and the selected output. If any internal reference is selected it will be enabled.
[in] | module_inst | Pointer to the DAC software instance struct |
References Assert, dac_is_syncing(), DAC_REFERENCE_INT1V, SYSTEM_VOLTAGE_REFERENCE_BANDGAP, and system_voltage_reference_enable().
Referenced by test_dac_init().
void dac_enable_events | ( | struct dac_module *const | module_inst, |
struct dac_events *const | events | ||
) |
Enables a DAC event input or output.
Enables one or more input or output events to or from the DAC module. See dac_events for a list of events this module supports.
[in] | module_inst | Software instance for the DAC peripheral |
[in] | events | Struct containing flags of events to enable |
References Assert, dac_events::generate_event_on_buffer_empty, and dac_events::on_event_start_conversion.
void dac_get_config_defaults | ( | struct dac_config *const | config | ) |
Initializes a DAC configuration structure to defaults.
Initializes a given DAC configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application.
The default configuration is as follows:
[out] | config | Configuration structure to initialize to default values |
References Assert, dac_config::clock_source, DAC_OUTPUT_EXTERNAL, DAC_REFERENCE_INT1V, GCLK_GENERATOR_0, dac_config::left_adjust, dac_config::output, dac_config::reference, dac_config::run_in_standby, and dac_config::voltage_pump_disable.
Referenced by test_dac_init().
uint32_t dac_get_status | ( | struct dac_module *const | module_inst | ) |
Retrieves the current module status.
Checks the status of the module and returns it as a bitmask of status flags.
[in] | module_inst | Pointer to the DAC software device struct |
DAC_STATUS_CHANNEL_0_EMPTY | Data has been transferred from DATABUF to DATA by a start conversion event and DATABUF is ready for new data |
DAC_STATUS_CHANNEL_0_UNDERRUN | A start conversion event has occurred when DATABUF is empty |
References Assert, DAC_STATUS_CHANNEL_0_EMPTY, and DAC_STATUS_CHANNEL_0_UNDERRUN.
enum status_code dac_init | ( | struct dac_module *const | module_inst, |
Dac *const | module, | ||
struct dac_config *const | config | ||
) |
Initialize the DAC device struct.
Use this function to initialize the Digital to Analog Converter. Resets the underlying hardware module and configures it.
[out] | module_inst | Pointer to the DAC software instance struct |
[in] | module | Pointer to the DAC module instance |
[in] | config | Pointer to the config struct, created by the user application |
STATUS_OK | Module initiated correctly |
STATUS_ERR_DENIED | If module is enabled |
STATUS_BUSY | If module is busy resetting |
References _dac_instances, _dac_set_config(), Assert, dac_config::clock_source, system_pinmux_config::direction, system_pinmux_config::input_pull, system_pinmux_config::mux_position, dac_config::reference, system_gclk_chan_config::source_generator, STATUS_BUSY, STATUS_ERR_DENIED, STATUS_OK, system_apb_clock_set_mask(), SYSTEM_CLOCK_APB_APBC, system_gclk_chan_enable(), system_gclk_chan_get_config_defaults(), system_gclk_chan_set_config(), system_pinmux_get_config_defaults(), SYSTEM_PINMUX_PIN_DIR_INPUT, SYSTEM_PINMUX_PIN_PULL_NONE, and system_pinmux_pin_set_config().
Referenced by test_dac_init().
bool dac_is_syncing | ( | struct dac_module *const | dev_inst | ) |
Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus. This function can be used to delay further operations on a module until such time that it is ready, to prevent blocking delays for synchronization in the user application.
[in] | dev_inst | Pointer to the DAC software instance struct |
true | If the module synchronization is ongoing |
false | If the module has completed synchronization |
References Assert.
Referenced by _dac_set_config(), dac_chan_write(), dac_chan_write_buffer_job(), dac_chan_write_buffer_wait(), dac_disable(), dac_enable(), and dac_reset().
enum status_code dac_register_callback | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
const dac_callback_t | callback, | ||
const enum dac_callback | type | ||
) |
Registers an asynchronous callback function with the driver.
Registers an asynchronous callback with the DAC driver, fired when a callback condition occurs.
[in,out] | module_inst | Pointer to the DAC software instance struct |
[in] | callback | Pointer to the callback function to register |
[in] | channel | Logical channel to register callback function |
[in] | type | Type of callback function to register |
STATUS_OK | The callback was registered successfully |
STATUS_ERR_INVALID_ARG | If an invalid callback type was supplied |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
References Assert, STATUS_ERR_INVALID_ARG, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.
void dac_reset | ( | struct dac_module *const | module_inst | ) |
Resets the DAC module.
This function will reset the DAC module to its power on default values and disable it.
[in] | module_inst | Pointer to the DAC software instance struct |
References Assert, and dac_is_syncing().
enum status_code dac_unregister_callback | ( | struct dac_module *const | module_inst, |
const enum dac_channel | channel, | ||
const enum dac_callback | type | ||
) |
Unregisters an asynchronous callback function with the driver.
Unregisters an asynchronous callback with the DAC driver, removing it from the internal callback registration table.
[in,out] | module_inst | Pointer to the DAC software instance struct |
[in] | channel | Logical channel to unregister callback function |
[in] | type | Type of callback function to unregister |
STATUS_OK | The callback was unregistered successfully |
STATUS_ERR_INVALID_ARG | If an invalid callback type was supplied |
STATUS_ERR_UNSUPPORTED_DEV | If a callback that requires event driven mode was specified with a DAC instance configured in non-event mode |
References Assert, STATUS_ERR_INVALID_ARG, STATUS_ERR_UNSUPPORTED_DEV, STATUS_OK, and UNUSED.