RA Flexible Software Package Documentation  Release v5.2.0

 
DAC Interface

Detailed Description

Interface for D/A converters.

Summary

The DAC interface provides standard Digital/Analog Converter functionality. A DAC application writes digital sample data to the device and generates analog output on the DAC output pin.

Data Structures

struct  dac_info_t
 
struct  dac_cfg_t
 
struct  dac_api_t
 
struct  dac_instance_t
 

Typedefs

typedef void dac_ctrl_t
 

Enumerations

enum  dac_data_format_t
 

Data Structure Documentation

◆ dac_info_t

struct dac_info_t

DAC information structure to store various information for a DAC

Data Fields
uint8_t bit_width Resolution of the DAC.

◆ dac_cfg_t

struct dac_cfg_t

DAC Open API configuration parameter

Data Fields
uint8_t channel ID associated with this DAC channel.
bool ad_da_synchronized AD/DA synchronization.
void const * p_extend

◆ dac_api_t

struct dac_api_t

DAC driver structure. General DAC functions implemented at the HAL layer follow this API.

Data Fields

fsp_err_t(* open )(dac_ctrl_t *const p_ctrl, dac_cfg_t const *const p_cfg)
 
fsp_err_t(* close )(dac_ctrl_t *const p_ctrl)
 
fsp_err_t(* write )(dac_ctrl_t *const p_ctrl, uint16_t value)
 
fsp_err_t(* start )(dac_ctrl_t *const p_ctrl)
 
fsp_err_t(* stop )(dac_ctrl_t *const p_ctrl)
 

Field Documentation

◆ open

fsp_err_t(* dac_api_t::open) (dac_ctrl_t *const p_ctrl, dac_cfg_t const *const p_cfg)

Initial configuration.

Parameters
[in]p_ctrlPointer to control block. Must be declared by user. Elements set here.
[in]p_cfgPointer to configuration structure. All elements of this structure must be set by user.

◆ close

fsp_err_t(* dac_api_t::close) (dac_ctrl_t *const p_ctrl)

Close the D/A Converter.

Parameters
[in]p_ctrlControl block set in dac_api_t::open call for this timer.

◆ write

fsp_err_t(* dac_api_t::write) (dac_ctrl_t *const p_ctrl, uint16_t value)

Write sample value to the D/A Converter.

Parameters
[in]p_ctrlControl block set in dac_api_t::open call for this timer.
[in]valueSample value to be written to the D/A Converter.

◆ start

fsp_err_t(* dac_api_t::start) (dac_ctrl_t *const p_ctrl)

Start the D/A Converter if it has not been started yet.

Parameters
[in]p_ctrlControl block set in dac_api_t::open call for this timer.

◆ stop

fsp_err_t(* dac_api_t::stop) (dac_ctrl_t *const p_ctrl)

Stop the D/A Converter if the converter is running.

Parameters
[in]p_ctrlControl block set in dac_api_t::open call for this timer.

◆ dac_instance_t

struct dac_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
dac_ctrl_t * p_ctrl Pointer to the control structure for this instance.
dac_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
dac_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ dac_ctrl_t

typedef void dac_ctrl_t

DAC control block. Allocate an instance specific control block to pass into the DAC API calls.

Enumeration Type Documentation

◆ dac_data_format_t

DAC Open API data format settings.

Enumerator
DAC_DATA_FORMAT_FLUSH_RIGHT 

LSB of data is flush to the right leaving the top 4 bits unused.

DAC_DATA_FORMAT_FLUSH_LEFT 

MSB of data is flush to the left leaving the bottom 4 bits unused.