dac12 2.0.0.0
DAC 12 Click Driver

API for configuring and manipulating DAC 12 Click driver. More...

Topics

 DAC 12 Registers List
 List of registers of DAC 12 Click driver.
 
 DAC 12 Control register Settings
 Settings for control registers of DAC 12 Click driver.
 
 DAC 12 MikroBUS Map
 MikroBUS pin mapping of DAC 12 Click driver.
 

Functions

void dac12_cfg_setup (dac12_cfg_t *cfg)
 DAC 12 configuration object setup function.
 
err_t dac12_init (dac12_t *ctx, dac12_cfg_t *cfg)
 DAC 12 initialization function.
 
err_t dac12_default_cfg (dac12_t *ctx)
 DAC 12 default configuration function.
 
err_t dac12_write_register (dac12_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 12 write register function.
 
err_t dac12_read_register (dac12_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 12 read register function.
 
err_t dac12_check_communication (dac12_t *ctx)
 DAC 12 check communication function.
 
err_t dac12_soft_reset (dac12_t *ctx)
 DAC 12 soft reset function.
 
err_t dac12_set_gain (dac12_t *ctx, uint8_t channel)
 DAC 12 set gain function.
 
err_t dac12_set_channel_value (dac12_t *ctx, uint8_t channel, uint16_t dac_value)
 DAC 12 set channel value function.
 
err_t dac12_set_channel_voltage (dac12_t *ctx, uint8_t channel, float voltage)
 DAC 12 set channel voltage function.
 

Detailed Description

API for configuring and manipulating DAC 12 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ dac12_cfg_setup()

void dac12_cfg_setup ( dac12_cfg_t * cfg)

DAC 12 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See dac12_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ dac12_check_communication()

err_t dac12_check_communication ( dac12_t * ctx)

DAC 12 check communication function.

This function checks the communication by reading and verifying the device ID.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_default_cfg()

err_t dac12_default_cfg ( dac12_t * ctx)

DAC 12 default configuration function.

This function executes a default configuration of DAC 12 click board.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ dac12_init()

err_t dac12_init ( dac12_t * ctx,
dac12_cfg_t * cfg )

DAC 12 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See dac12_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_read_register()

err_t dac12_read_register ( dac12_t * ctx,
uint8_t reg,
uint16_t * data_out )

DAC 12 read register function.

This function reads data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data [2 bytes].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_set_channel_value()

err_t dac12_set_channel_value ( dac12_t * ctx,
uint8_t channel,
uint16_t dac_value )

DAC 12 set channel value function.

This function sets the raw DAC value to the specific channels output.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]channel: Output channel mask.
[in]dac_value: 12-bit raw DAC value.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_set_channel_voltage()

err_t dac12_set_channel_voltage ( dac12_t * ctx,
uint8_t channel,
float voltage )

DAC 12 set channel voltage function.

This function sets the output voltage of the specific channels.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]channel: Output channel mask.
[in]voltage: Float value of voltage to be set (up to 2.5 V).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_set_gain()

err_t dac12_set_gain ( dac12_t * ctx,
uint8_t channel )

DAC 12 set gain function.

This function sets the gain of 2 to the selected channels, the other channels will have their gain disabled.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]channel: Output channel mask.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_soft_reset()

err_t dac12_soft_reset ( dac12_t * ctx)

DAC 12 soft reset function.

This function executes the software reset command.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ dac12_write_register()

err_t dac12_write_register ( dac12_t * ctx,
uint8_t reg,
uint16_t data_in )

DAC 12 write register function.

This function writes a desired data to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac12_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written [2 bytes].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.