dac13 2.1.0.0
DAC 13 Click Driver

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

Topics

 DAC 13 Registers List
 List of registers of DAC 13 Click driver.
 
 DAC 13 Registers Settings
 Settings for registers of DAC 13 Click driver.
 
 DAC 13 MikroBUS Map
 MikroBUS pin mapping of DAC 13 Click driver.
 

Functions

void dac13_cfg_setup (dac13_cfg_t *cfg)
 DAC 13 configuration object setup function.
 
err_t dac13_init (dac13_t *ctx, dac13_cfg_t *cfg)
 DAC 13 initialization function.
 
err_t dac13_default_cfg (dac13_t *ctx)
 DAC 13 default configuration function.
 
err_t dac13_generic_write (dac13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAC 13 data writing function.
 
err_t dac13_generic_read (dac13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAC 13 data reading function.
 
err_t dac13_write_register (dac13_t *ctx, uint8_t reg, uint8_t data_in)
 DAC 13 write register function.
 
err_t dac13_read_register (dac13_t *ctx, uint8_t reg, uint8_t *data_out)
 DAC 13 read register function.
 
err_t dac13_write_register_16b (dac13_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 13 write register 16b function.
 
err_t dac13_read_register_16b (dac13_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 13 read register 16b function.
 
void dac13_set_ldc_pin (dac13_t *ctx, uint8_t state)
 DAC 13 set ldc pin function.
 
void dac13_set_rst_pin (dac13_t *ctx, uint8_t state)
 DAC 13 set rst pin function.
 
uint8_t dac13_get_alert_pin (dac13_t *ctx)
 DAC 13 get alert pin function.
 
void dac13_reset_device (dac13_t *ctx)
 DAC 13 reset device function.
 
err_t dac13_check_communication (dac13_t *ctx)
 DAC 13 check communication function.
 
err_t dac13_set_output_range (dac13_t *ctx, uint8_t out_range)
 DAC 13 set output range function.
 
err_t dac13_set_dac_value (dac13_t *ctx, uint16_t dac_value)
 DAC 13 set dac value function.
 
err_t dac13_set_output_voltage (dac13_t *ctx, float voltage)
 DAC 13 set output voltage function.
 

Detailed Description

API for configuring and manipulating DAC 13 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

◆ dac13_cfg_setup()

void dac13_cfg_setup ( dac13_cfg_t * cfg)

DAC 13 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dac13_check_communication()

err_t dac13_check_communication ( dac13_t * ctx)

DAC 13 check communication function.

This function checks the communication by reading and verifying the product and vendor IDs.

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

◆ dac13_default_cfg()

err_t dac13_default_cfg ( dac13_t * ctx)

DAC 13 default configuration function.

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

Parameters
[in]ctx: Click context object. See dac13_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.

◆ dac13_generic_read()

err_t dac13_generic_read ( dac13_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

DAC 13 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac13_generic_write()

err_t dac13_generic_write ( dac13_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

DAC 13 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac13_get_alert_pin()

uint8_t dac13_get_alert_pin ( dac13_t * ctx)

DAC 13 get alert pin function.

This function returns the alert pin logic state.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ dac13_init()

err_t dac13_init ( dac13_t * ctx,
dac13_cfg_t * cfg )

DAC 13 initialization function.

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

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

◆ dac13_read_register()

err_t dac13_read_register ( dac13_t * ctx,
uint8_t reg,
uint8_t * data_out )

DAC 13 read register function.

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

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

◆ dac13_read_register_16b()

err_t dac13_read_register_16b ( dac13_t * ctx,
uint8_t reg,
uint16_t * data_out )

DAC 13 read register 16b function.

This function reads two bytes of data starting from the selected register in descending order by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Address direction must be set to address descending in the INTERFACE_CONFIG_A register.

◆ dac13_reset_device()

void dac13_reset_device ( dac13_t * ctx)

DAC 13 reset device function.

This function resets the device by toggling the reset pin.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ dac13_set_dac_value()

err_t dac13_set_dac_value ( dac13_t * ctx,
uint16_t dac_value )

DAC 13 set dac value function.

This function sets the raw DAC value.

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

◆ dac13_set_ldc_pin()

void dac13_set_ldc_pin ( dac13_t * ctx,
uint8_t state )

DAC 13 set ldc pin function.

This function sets the LDC pin logic state.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ dac13_set_output_range()

err_t dac13_set_output_range ( dac13_t * ctx,
uint8_t out_range )

DAC 13 set output range function.

This function sets the output voltage range and as well as the ctx->v_zero_scale and ctx->v_full_scale variables for the selected range.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]out_range:
  • 0 - Range from 0V to 2.5V - Output gain jumper must be set to X1.
  • 1 - Range from 0V to 5V - Output gain jumper must be set to X1.
  • 2 - Range from 0V to 10V - Output gain jumper must be set to X2.
  • 3 - Range from -5V to 5V - Output gain jumper must be set to X2.
  • 4 - Range from -2.5V to 7.5V - Output gain jumper must be set to X2.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac13_set_output_voltage()

err_t dac13_set_output_voltage ( dac13_t * ctx,
float voltage )

DAC 13 set output voltage function.

This function sets the DAC output voltage.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]voltage: Float value of voltage to be set. The voltage range depends on the dac13_set_output_range setting.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac13_set_rst_pin()

void dac13_set_rst_pin ( dac13_t * ctx,
uint8_t state )

DAC 13 set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ dac13_write_register()

err_t dac13_write_register ( dac13_t * ctx,
uint8_t reg,
uint8_t data_in )

DAC 13 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 dac13_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac13_write_register_16b()

err_t dac13_write_register_16b ( dac13_t * ctx,
uint8_t reg,
uint16_t data_in )

DAC 13 write register 16b function.

This function writes two bytes of data starting from the selected register in descending order by using SPI serial interface.

Parameters
[in]ctx: Click context object. See dac13_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Address direction must be set to address descending in the INTERFACE_CONFIG_A register.