Synergy Software Package User's Manual

Driver for the 12-Bit D/C Converter (DAC12). More...

Data Structures

struct  dac_instance_ctrl_t
 
struct  dac_extended_cfg_t
 

Functions

ssp_err_t R_DAC_Open (dac_ctrl_t *p_api_ctrl, dac_cfg_t const *const p_cfg)
 Perform required initialization described in hardware manual. Implements dac_api_t::open. Configures a single DAC channel, starts the channel, and provides a handle for use with the DAC API Write and Close functions. Must be called once prior to calling any other DAC API functions. After a channel is opened, Open should not be called again for the same channel without calling Close first. More...
 
ssp_err_t R_DAC_Close (dac_ctrl_t *p_api_ctrl)
 Stop the D/A conversion, stop output, and close the DAC channel. More...
 
ssp_err_t R_DAC_Write (dac_ctrl_t *p_api_ctrl, dac_size_t value)
 Write data to the D/A converter and enable the output if it has not been enabled. More...
 
ssp_err_t R_DAC_Start (dac_ctrl_t *p_api_ctrl)
 Start the D/A conversion output if it has not been started. More...
 
ssp_err_t R_DAC_Stop (dac_ctrl_t *p_api_ctrl)
 Stop the D/A conversion and disable the output signal. More...
 
ssp_err_t R_DAC_VersionGet (ssp_version_t *p_version)
 Get version and store it in provided pointer p_version. More...
 
ssp_err_t R_DAC_InfoGet (dac_info_t *const p_info)
 Get information about DAC Resolution and store it in provided pointer p_info. More...
 

Detailed Description

Driver for the 12-Bit D/C Converter (DAC12).

Summary

This module implements the following interface: DAC Interface.

Name of module used by error logger macro

Function Documentation

◆ R_DAC_Close()

ssp_err_t R_DAC_Close ( dac_ctrl_t p_api_ctrl)

Stop the D/A conversion, stop output, and close the DAC channel.

Return values
SSP_SUCCESSThe channel is successfully closed.
SSP_ERR_ASSERTIONp_api_ctrl is NULL.
SSP_ERR_NOT_OPENChannel associated with p_ctrl has not been opened.

Validate that the channel is opened.

Stop the channel

Update the channel state information.

Unlock the DAC Hardware Resource

Power down the DAC device.

Unlock the DAC Hardware Resource

◆ R_DAC_InfoGet()

ssp_err_t R_DAC_InfoGet ( dac_info_t *const  p_info)

Get information about DAC Resolution and store it in provided pointer p_info.

Return values
SSP_SUCCESSValue of DAC resolution written to caller's structure successfully.
SSP_ERR_ASSERTIONThe p_info parameter was null.

Assigning DAC bit resolution as 12bit.

◆ R_DAC_Open()

ssp_err_t R_DAC_Open ( dac_ctrl_t p_api_ctrl,
dac_cfg_t const *const  p_cfg 
)

Perform required initialization described in hardware manual. Implements dac_api_t::open. Configures a single DAC channel, starts the channel, and provides a handle for use with the DAC API Write and Close functions. Must be called once prior to calling any other DAC API functions. After a channel is opened, Open should not be called again for the same channel without calling Close first.

Return values
SSP_SUCCESSThe channel was successfully opened.
SSP_ERR_ASSERTIONOne or both of the following parameters may be NULL: p_api_ctrl or p_cfg Channel ID requested in p_cfg may not available on the device selected in r_bsp_config.h data_format value in p_cfg is out of range. ad_da_synchronized value in p_cfg is out of range.
SSP_ERR_IN_USEDAC resource is locked.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is reentrant for different channels. It is not reentrant for the same channel.

Validate the input parameter.

Make sure the peripheral exists.

Lock the DAC Hardware Resource.

Power on the DAC device.

Stop the channel.

Configure data format: left or right justified.

Configure D/A-A/D Synchronous Start Control Register(DAADSCR).

Set output amplifier configuration for the channel.

Set the reference voltage.

If charge pump has supported by MCU, configures the register(DAPC)

Initialize the channel state information.

All done. Return.

◆ R_DAC_Start()

ssp_err_t R_DAC_Start ( dac_ctrl_t p_api_ctrl)

Start the D/A conversion output if it has not been started.

Return values
SSP_SUCCESSThe channel is started successfully.
SSP_ERR_ASSERTIONp_api_ctrl is NULL.
SSP_ERR_NOT_OPENChannel associated with p_ctrl has not been opened.

Validate that the channel is opened.

Enable the output.

Update the internal state.

◆ R_DAC_Stop()

ssp_err_t R_DAC_Stop ( dac_ctrl_t p_api_ctrl)

Stop the D/A conversion and disable the output signal.

Return values
SSP_SUCCESSThe control is successfully stopped.
SSP_ERR_ASSERTIONp_api_ctrl is NULL.
SSP_ERR_NOT_OPENChannel associated with p_ctrl has not been opened.

Validate that the channel is opened.

Disable the output.

Mark the internal state.

◆ R_DAC_VersionGet()

ssp_err_t R_DAC_VersionGet ( ssp_version_t p_version)

Get version and store it in provided pointer p_version.

Return values
SSP_SUCCESSSuccessfully retrieved version information.
SSP_ERR_ASSERTIONp_version is NULL.

◆ R_DAC_Write()

ssp_err_t R_DAC_Write ( dac_ctrl_t p_api_ctrl,
dac_size_t  value 
)

Write data to the D/A converter and enable the output if it has not been enabled.

Return values
SSP_SUCCESSData is successfully written to the D/A Converter.
SSP_ERR_ASSERTIONp_api_ctrl is NULL.
SSP_ERR_NOT_OPENChannel associated with p_ctrl has not been opened.
Note
Write function automatically starts the D/A conversion after data is successfully written to the channel.

Validate that the channel is opened.

Write the value to D/A converter.

Start the converter if it has been idle.

Start the channel