dac15 2.1.0.0
DAC 15 Click Driver

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

Topics

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

Functions

void dac15_cfg_setup (dac15_cfg_t *cfg)
 DAC 15 configuration object setup function.
 
void dac15_drv_interface_selection (dac15_cfg_t *cfg, dac15_drv_t drv_sel)
 DAC 15 driver interface setup function.
 
err_t dac15_init (dac15_t *ctx, dac15_cfg_t *cfg)
 DAC 15 initialization function.
 
err_t dac15_default_cfg (dac15_t *ctx)
 DAC 15 default configuration function.
 
err_t dac15_generic_write (dac15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAC 15 data writing function.
 
err_t dac15_generic_read (dac15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAC 15 data reading function.
 
err_t dac15_write_reg (dac15_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 15 write register function.
 
err_t dac15_read_reg (dac15_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 15 read register function.
 
void dac15_power_up_to_zero_scale (dac15_t *ctx)
 DAC 15 DACs power up to zero scale function.
 
void dac15_power_up_to_midscale (dac15_t *ctx)
 DAC 15 DACs s power up to midscale function.
 
err_t dac15_get_device_id (dac15_t *ctx, uint16_t *device_id)
 DAC 15 get device ID function.
 
err_t dac15_set_sync_mode (dac15_t *ctx)
 DAC 15 set sync mode function.
 
err_t dac15_soft_reset (dac15_t *ctx)
 DAC 15 soft reset function.
 
err_t dac15_set_dac_data (dac15_t *ctx, uint8_t dac_sel, uint16_t dac_data)
 DAC 15 set DAC data function.
 
err_t dac15_get_dac_data (dac15_t *ctx, uint8_t dac_sel, uint16_t *dac_data)
 DAC 15 get DAC data function.
 
err_t dac15_set_dac_vout (dac15_t *ctx, uint8_t dac_sel, float vtg)
 DAC 15 set DAC output voltage function.
 
err_t dac15_get_dac_vout (dac15_t *ctx, uint8_t dac_sel, float *vtg)
 DAC 15 get DAC output voltage function.
 

Detailed Description

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

◆ dac15_cfg_setup()

void dac15_cfg_setup ( dac15_cfg_t * cfg)

DAC 15 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dac15_default_cfg()

err_t dac15_default_cfg ( dac15_t * ctx)

DAC 15 default configuration function.

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

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

◆ dac15_drv_interface_selection()

void dac15_drv_interface_selection ( dac15_cfg_t * cfg,
dac15_drv_t drv_sel )

DAC 15 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See dac15_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See dac15_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ dac15_generic_read()

err_t dac15_generic_read ( dac15_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

DAC 15 data reading function.

This function reads a desired number of data bytes starting from the selected register.

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

◆ dac15_generic_write()

err_t dac15_generic_write ( dac15_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

DAC 15 data writing function.

This function writes a desired number of data bytes starting from the selected register.

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

◆ dac15_get_dac_data()

err_t dac15_get_dac_data ( dac15_t * ctx,
uint8_t dac_sel,
uint16_t * dac_data )

DAC 15 get DAC data function.

This function read the raw DAC data for the selected DAC channel of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

Parameters
[in]ctx: Click context object. See dac15_t object definition for detailed explanation.
[in]dac_sel: DAC Vout channel:
  • 0 (DAC15_SET_DAC_A) - VOUTA,
  • 1 (DAC15_SET_DAC_B) - VOUTB.
[out]dac_data: DAC raw data, 16-bit.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac15_get_dac_vout()

err_t dac15_get_dac_vout ( dac15_t * ctx,
uint8_t dac_sel,
float * vtg )

DAC 15 get DAC output voltage function.

This function reads the DAC output voltage for the selected DAC channel of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

Parameters
[in]ctx: Click context object. See dac15_t object definition for detailed explanation.
[in]dac_sel: DAC Vout channel:
  • 0 (DAC15_SET_DAC_A) - VOUTA,
  • 1 (DAC15_SET_DAC_B) - VOUTB.
[out]vtg: DAC output voltage [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac15_get_device_id()

err_t dac15_get_device_id ( dac15_t * ctx,
uint16_t * device_id )

DAC 15 get device ID function.

This function reads device ID data of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_init()

err_t dac15_init ( dac15_t * ctx,
dac15_cfg_t * cfg )

DAC 15 initialization function.

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

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

◆ dac15_power_up_to_midscale()

void dac15_power_up_to_midscale ( dac15_t * ctx)

DAC 15 DACs s power up to midscale function.

This function sets DACs s power up to midscale of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_power_up_to_zero_scale()

void dac15_power_up_to_zero_scale ( dac15_t * ctx)

DAC 15 DACs power up to zero scale function.

This function sets DACs power up to zero scale of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_read_reg()

err_t dac15_read_reg ( dac15_t * ctx,
uint8_t reg,
uint16_t * data_out )

DAC 15 read register function.

This function reads data word from the selected register of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_set_dac_data()

err_t dac15_set_dac_data ( dac15_t * ctx,
uint8_t dac_sel,
uint16_t dac_data )

DAC 15 set DAC data function.

This function sets the raw DAC data for the selected DAC channel of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

Parameters
[in]ctx: Click context object. See dac15_t object definition for detailed explanation.
[in]dac_sel: DAC Vout channel:
  • 0 (DAC15_SET_DAC_A) - VOUTA,
  • 1 (DAC15_SET_DAC_B) - VOUTB.
[in]dac_data: DAC raw data, 16-bit.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac15_set_dac_vout()

err_t dac15_set_dac_vout ( dac15_t * ctx,
uint8_t dac_sel,
float vtg )

DAC 15 set DAC output voltage function.

This function sets the DAC output voltage for the selected DAC channel of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

Parameters
[in]ctx: Click context object. See dac15_t object definition for detailed explanation.
[in]dac_sel: DAC Vout channel:
  • 0 (DAC15_SET_DAC_A) - VOUTA,
  • 1 (DAC15_SET_DAC_B) - VOUTB.
[in]vtg: DAC output voltage [0V-3.3V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac15_set_sync_mode()

err_t dac15_set_sync_mode ( dac15_t * ctx)

DAC 15 set sync mode function.

This function set sync mode to synchronously load those DACs of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_soft_reset()

err_t dac15_soft_reset ( dac15_t * ctx)

DAC 15 soft reset function.

This function resets the device to its default state of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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

◆ dac15_write_reg()

err_t dac15_write_reg ( dac15_t * ctx,
uint8_t reg,
uint16_t data_in )

DAC 15 write register function.

This function writes a desired data word to the selected register of the DAC80502, Dual, 16-Bit, 14-Bit, and 12-Bit, 1-LSB INL, Voltage-Output DACs With Precision Internal Reference on the USB-C Sink 3 Click board™.

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