dac9 2.0.0.0
DAC 9 Click Driver

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

Topics

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

Functions

void dac9_cfg_setup (dac9_cfg_t *cfg)
 DAC 9 configuration object setup function.
 
void dac9_drv_interface_selection (dac9_cfg_t *cfg, dac9_drv_t drv_sel)
 DAC 9 driver interface setup function.
 
err_t dac9_init (dac9_t *ctx, dac9_cfg_t *cfg)
 DAC 9 initialization function.
 
err_t dac9_generic_write (dac9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAC 9 data writing function.
 
err_t dac9_generic_read (dac9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAC 9 data reading function.
 
err_t dac9_enable_sync (dac9_t *ctx, uint8_t en_sync)
 Enable synchronous function.
 
err_t dac9_set_config (dac9_t *ctx, uint16_t en_ref_pwdwn, uint16_t en_dac_pwdwn)
 Set config function.
 
err_t dac9_set_gain (dac9_t *ctx, uint16_t en_ref_div, uint16_t en_buff_gain)
 Set gain function.
 
void dac9_set_synchronously_load (dac9_t *ctx)
 Set synchronously load function.
 
void dac9_soft_reset (dac9_t *ctx)
 Set reset function.
 
uint8_t dac9_get_ref_alarm (dac9_t *ctx)
 Get ref alarm function.
 
err_t dac9_set_vout (dac9_t *ctx, uint16_t vout_mv)
 Set Vout function.
 

Detailed Description

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

◆ dac9_cfg_setup()

void dac9_cfg_setup ( dac9_cfg_t * cfg)

DAC 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ dac9_drv_interface_selection()

void dac9_drv_interface_selection ( dac9_cfg_t * cfg,
dac9_drv_t drv_sel )

DAC 9 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 dac9_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See dac9_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.

◆ dac9_enable_sync()

err_t dac9_enable_sync ( dac9_t * ctx,
uint8_t en_sync )

Enable synchronous function.

The function is used to set synchronous or asynchronous mode.

Parameters
[in]ctx: Click context object. See dac9_t object definition for detailed explanation.
[in]en_sync: DAC output mode
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dac9_generic_read()

err_t dac9_generic_read ( dac9_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

DAC 9 data reading function.

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

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

◆ dac9_generic_write()

err_t dac9_generic_write ( dac9_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

DAC 9 data writing function.

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

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

◆ dac9_get_ref_alarm()

uint8_t dac9_get_ref_alarm ( dac9_t * ctx)

Get ref alarm function.

The function is used to get reference alarm of the device.

Parameters
[in]ctx: Click context object. See dac9_t object definition for detailed explanation.
Returns
  • 0x00 - Ok.,
  • 0x01 - Difference between the reference and supply pins is below a minimum analog threshold.

◆ dac9_init()

err_t dac9_init ( dac9_t * ctx,
dac9_cfg_t * cfg )

DAC 9 initialization function.

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

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

◆ dac9_set_config()

err_t dac9_set_config ( dac9_t * ctx,
uint16_t en_ref_pwdwn,
uint16_t en_dac_pwdwn )

Set config function.

The function is used to set the devices configuration.

Parameters
[in]ctx: Click context object. See dac9_t object definition for detailed explanation.
[in]en_ref_pwdwn: Internal reference mode.
[in]en_dac_pwdwn: DAC in power-up mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dac9_set_gain()

err_t dac9_set_gain ( dac9_t * ctx,
uint16_t en_ref_div,
uint16_t en_buff_gain )

Set gain function.

The function is used to set gain and internal voltage reference.

Parameters
[in]ctx: Click context object. See dac9_t object definition for detailed explanation.
[in]en_ref_div: Reference voltage mode.
[in]en_buff_gain: DAC gain mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dac9_set_synchronously_load()

void dac9_set_synchronously_load ( dac9_t * ctx)

Set synchronously load function.

The function is used to set 'LDAC' bit in order to synchronously load the DAC in synchronous mode, This bit is self resetting.

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

◆ dac9_set_vout()

err_t dac9_set_vout ( dac9_t * ctx,
uint16_t vout_mv )

Set Vout function.

The function is used set Vout ( mV ) by calculating input data and writing it to the DAC data register.

Parameters
[in]ctx: Click context object. See dac9_t object definition for detailed explanation.
[in]vout_mv: Vout in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ dac9_soft_reset()

void dac9_soft_reset ( dac9_t * ctx)

Set reset function.

The function is used to perform software reset.

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