dac14 2.1.0.0
dac14.h File Reference

This file contains API for DAC 14 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  dac14_s
 DAC 14 Click context object. More...
 
struct  dac14_cfg_t
 DAC 14 Click configuration object. More...
 

Macros

#define DAC14_REG_NOP   0x00
 DAC 14 register list.
 
#define DAC14_REG_DAC1_MARGIN_HIGH   0x01
 
#define DAC14_REG_DAC1_MARGIN_LOW   0x02
 
#define DAC14_REG_DAC1_VOUT_CMP_CONFIG   0x03
 
#define DAC14_REG_DAC1_IOUT_MISC_CONFIG   0x04
 
#define DAC14_REG_DAC1_CMP_MODE_CONFIG   0x05
 
#define DAC14_REG_DAC1_FUNC_CONFIG   0x06
 
#define DAC14_REG_DAC0_MARGIN_HIGH   0x13
 
#define DAC14_REG_DAC0_MARGIN_LOW   0x14
 
#define DAC14_REG_DAC0_VOUT_CMP_CONFIG   0x15
 
#define DAC14_REG_DAC0_IOUT_MISC_CONFIG   0x16
 
#define DAC14_REG_DAC0_CMP_MODE_CONFIG   0x17
 
#define DAC14_REG_DAC0_FUNC_CONFIG   0x18
 
#define DAC14_REG_DAC1_DATA   0x19
 
#define DAC14_REG_DAC0_DATA   0x1C
 
#define DAC14_REG_COMMON_CONFIG   0x1F
 
#define DAC14_REG_COMMON_TRIGGER   0x20
 
#define DAC14_REG_COMMON_DAC_TRIG   0x21
 
#define DAC14_REG_GENERAL_STATUS   0x22
 
#define DAC14_REG_CMP_STATUS   0x23
 
#define DAC14_REG_GPIO_CONFIG   0x24
 
#define DAC14_REG_DEVICE_MODE_CONFIG   0x25
 
#define DAC14_REG_INTERFACE_CONFIG   0x26
 
#define DAC14_REG_SRAM_CONFIG   0x2B
 
#define DAC14_REG_SRAM_DATA   0x2C
 
#define DAC14_REG_BRDCAST_DATA   0x50
 
#define DAC14_CC_WIN_LATCH_EN   0x8000
 DAC 14 COMMON_CONFIG register setting.
 
#define DAC14_CC_DEV_LOCK   0x4000
 
#define DAC14_CC_EE_READ_ADDR   0x2000
 
#define DAC14_CC_EN_INT_REF   0x1000
 
#define DAC14_CC_VOUT_PDN_0_POWER_UP   0x0000
 
#define DAC14_CC_VOUT_PDN_0_POWER_DOWN_10K   0x0400
 
#define DAC14_CC_VOUT_PDN_0_POWER_DOWN_100K   0x0800
 
#define DAC14_CC_VOUT_PDN_0_POWER_DOWN_Z   0x0C00
 
#define DAC14_CC_VOUT_PDN_0_MASK   0x0C00
 
#define DAC14_CC_IOUT_PDN_0_POWER_UP   0x0000
 
#define DAC14_CC_IOUT_PDN_0_POWER_DOWN   0x0200
 
#define DAC14_CC_IOUT_PDN_0_MASK   0x0200
 
#define DAC14_CC_RESERVED   0x0088
 
#define DAC14_CC_VOUT_PDN_1_POWER_UP   0x0000
 
#define DAC14_CC_VOUT_PDN_1_POWER_DOWN_10K   0x0002
 
#define DAC14_CC_VOUT_PDN_1_POWER_DOWN_100K   0x0004
 
#define DAC14_CC_VOUT_PDN_1_POWER_DOWN_Z   0x0006
 
#define DAC14_CC_VOUT_PDN_1_MASK   0x0006
 
#define DAC14_CC_IOUT_PDN_1_POWER_UP   0x0000
 
#define DAC14_CC_IOUT_PDN_1_POWER_DOWN   0x0001
 
#define DAC14_CC_IOUT_PDN_1_MASK   0x0001
 
#define DAC14_CDT_RESET_CMP_FLAG_1   0x8000
 DAC 14 COMMON_DAC_TRIG register setting.
 
#define DAC14_CDT_TRIG_MAR_LO_1   0x4000
 
#define DAC14_CDT_TRIG_MAR_HI_1   0x2000
 
#define DAC14_CDT_STOP_FUNC_1   0x0000
 
#define DAC14_CDT_START_FUNC_1   0x1000
 
#define DAC14_CDT_RESET_CMP_FLAG_0   0x0008
 
#define DAC14_CDT_TRIG_MAR_LO_0   0x0004
 
#define DAC14_CDT_TRIG_MAR_HI_0   0x0002
 
#define DAC14_CDT_START_FUNC_0   0x0001
 
#define DAC14_CDT_STOP_FUNC_0   0x0000
 
#define DAC14_DXFC_CLR_SEL_X   0x8000
 DAC 14 DAC_X_FUNC_CONFIG register setting.
 
#define DAC14_DXFC_SYNC_CONFIG_X   0x4000
 
#define DAC14_DXFC_BRD_CONFIG_X   0x2000
 
#define DAC14_DXFC_PHASE_SEL_X_0_DEG   0x0000
 
#define DAC14_DXFC_PHASE_SEL_X_120_DEG   0x0800
 
#define DAC14_DXFC_PHASE_SEL_X_240_DEG   0x1000
 
#define DAC14_DXFC_PHASE_SEL_X_90_DEG   0x1800
 
#define DAC14_DXFC_PHASE_SEL_X_MASK   0x1800
 
#define DAC14_DXFC_FUNC_CONFIG_X_TRIANGULAR   0x0000
 
#define DAC14_DXFC_FUNC_CONFIG_X_SAWTH   0x0100
 
#define DAC14_DXFC_FUNC_CONFIG_X_INV_SAWTH   0x0200
 
#define DAC14_DXFC_FUNC_CONFIG_X_SINE   0x0400
 
#define DAC14_DXFC_FUNC_CONFIG_X_DIS_FC   0x0700
 
#define DAC14_DXFC_FUNC_CONFIG_X_MASK   0x0700
 
#define DAC14_DXFC_LOG_SLEW_EN_X   0x0080
 
#define DAC14_DXFC_CODE_STEP_X_1   0x0000
 
#define DAC14_DXFC_CODE_STEP_X_2   0x0010
 
#define DAC14_DXFC_CODE_STEP_X_3   0x0020
 
#define DAC14_DXFC_CODE_STEP_X_4   0x0030
 
#define DAC14_DXFC_CODE_STEP_X_6   0x0040
 
#define DAC14_DXFC_CODE_STEP_X_8   0x0050
 
#define DAC14_DXFC_CODE_STEP_X_16   0x0060
 
#define DAC14_DXFC_CODE_STEP_X_32   0x0070
 
#define DAC14_DXFC_CODE_STEP_X_MASK   0x0070
 
#define DAC14_DXFC_SLEW_RATE_X_NO_SR   0x0000
 
#define DAC14_DXFC_SLEW_RATE_X_4_US   0x0001
 
#define DAC14_DXFC_SLEW_RATE_X_8_US   0x0002
 
#define DAC14_DXFC_SLEW_RATE_X_12_US   0x0003
 
#define DAC14_DXFC_SLEW_RATE_X_18_US   0x0004
 
#define DAC14_DXFC_SLEW_RATE_X_27_04_US   0x0005
 
#define DAC14_DXFC_SLEW_RATE_X_40_48_US   0x0006
 
#define DAC14_DXFC_SLEW_RATE_X_60_72_US   0x0007
 
#define DAC14_DXFC_SLEW_RATE_X_91_12_US   0x0008
 
#define DAC14_DXFC_SLEW_RATE_X_136_72_US   0x0009
 
#define DAC14_DXFC_SLEW_RATE_X_239_2_US   0x000A
 
#define DAC14_DXFC_SLEW_RATE_X_418_64_US   0x000B
 
#define DAC14_DXFC_SLEW_RATE_X_732_56_US   0x000C
 
#define DAC14_DXFC_SLEW_RATE_X_1282_US   0x000D
 
#define DAC14_DXFC_SLEW_RATE_X_2563_96_US   0x000E
 
#define DAC14_DXFC_SLEW_RATE_X_5127_92_US   0x000F
 
#define DAC14_DXFC_SLEW_RATE_X_MASK   0x000F
 
#define DAC14_VCC_VOUT_GAIN_X_EXT_VREF   0x0000
 DAC 14 DAC_X_VOUT_CMP_CONFIG register setting.
 
#define DAC14_VCC_VOUT_GAIN_X_VDD   0x0400
 
#define DAC14_VCC_VOUT_GAIN_X_INT_1_5X   0x0800
 
#define DAC14_VCC_VOUT_GAIN_X_INT_2X   0x0C00
 
#define DAC14_VCC_VOUT_GAIN_X_INT_3X   0x1000
 
#define DAC14_VCC_VOUT_GAIN_X_INT_4X   0x1400
 
#define DAC14_VCC_VOUT_GAIN_X_MASK   0x1C00
 
#define DAC14_VCC_CMP_X_OD_EN   0x0010
 
#define DAC14_VCC_CMP_X_OUT_EN   0x0008
 
#define DAC14_VCC_CMP_X_HIZ_IN_EN   0x0004
 
#define DAC14_VCC_CMP_X_INV_EN   0x0002
 
#define DAC14_VCC_CMP_X_EN   0x0001
 
#define DAC14_IC_TIMEOUT_EN   0x1000
 DAC 14 INTERFACE_CONFIG register setting.
 
#define DAC14_IC_EN_PMBUS   0x0100
 
#define DAC14_IC_FSDO_EN   0x0004
 
#define DAC14_IC_SDO_EN   0x0001
 
#define DAC14_IC_SDO_DIS   0x0000
 
#define DAC14_DAC_DATA_MAX   1023
 DAC 14 DAC setting.
 
#define DAC14_DAC_DATA_MIN   0
 
#define DAC14_DEVICE_ID_MASK   0xFC
 DAC 14 device ID setting.
 
#define DAC14_DEVICE_ID   0x1C
 
#define DAC14_SEL_DAC_0   0
 DAC 14 DAC selection setting.
 
#define DAC14_SEL_DAC_1   1
 
#define DAC14_EN_VOUT_POWER_UP   0
 DAC 14 DAC enable setting.
 
#define DAC14_EN_VOUT_POWER_DOWN_10K_AGND   1
 
#define DAC14_EN_VOUT_POWER_DOWN_100K_AGND   2
 
#define DAC14_EN_VOUT_POWER_DOWN_HI_Z_AGND   3
 
#define DAC14_WAVEFORM_TRIANGULAR   0
 DAC 14 DAC waveform setting.
 
#define DAC14_WAVEFORM_SAWTOOTH   1
 
#define DAC14_WAVEFORM_INV_SAWTOOTH   2
 
#define DAC14_WAVEFORM_SINE   4
 
#define DAC14_WAVEFORM_DISABLE   7
 
#define DAC14_CODE_STEP_1_LSB   0
 DAC 14 DAC code step setting.
 
#define DAC14_CODE_STEP_2_LSB   1
 
#define DAC14_CODE_STEP_3_LSB   2
 
#define DAC14_CODE_STEP_4_LSB   3
 
#define DAC14_CODE_STEP_6_LSB   4
 
#define DAC14_CODE_STEP_8_LSB   5
 
#define DAC14_CODE_STEP_16_LSB   6
 
#define DAC14_CODE_STEP_32_LSB   7
 
#define DAC14_SLEW_RATE_NO_SLEW   0
 DAC 14 DAC slew rate setting.
 
#define DAC14_SLEW_RATE_4_US   1
 
#define DAC14_SLEW_RATE_8_US   2
 
#define DAC14_SLEW_RATE_12_US   3
 
#define DAC14_SLEW_RATE_18_US   4
 
#define DAC14_SLEW_RATE_27_04_US   5
 
#define DAC14_SLEW_RATE_40_48_US   6
 
#define DAC14_SLEW_RATE_60_72_US   7
 
#define DAC14_SLEW_RATE_91_12_US   8
 
#define DAC14_SLEW_RATE_136_72_US   9
 
#define DAC14_SLEW_RATE_239_2_US   10
 
#define DAC14_SLEW_RATE_418_64_US   11
 
#define DAC14_SLEW_RATE_732_56_US   12
 
#define DAC14_SLEW_RATE_1282_US   13
 
#define DAC14_SLEW_RATE_2563_96_US   14
 
#define DAC14_SLEW_RATE_5127_92_US   15
 
#define DAC14_VREF_EXT   0
 DAC 14 DAC VREF setting.
 
#define DAC14_VREF_VDD   1
 
#define DAC14_VREF_INT_1_5X   2
 
#define DAC14_VREF_INT_2X   3
 
#define DAC14_VREF_INT_3X   4
 
#define DAC14_VREF_INT_4X   5
 
#define DAC14_VDD_3V3   3.3f
 DAC 14 DAC VDD setting.
 
#define DAC14_VDD_5V   5.0f
 
#define DAC14_DEVICE_ADDRESS_GND   0x48
 DAC 14 device address setting.
 
#define DAC14_DEVICE_ADDRESS_VCC   0x49
 
#define DAC14_DEVICE_ADDRESS_SDA   0x4A
 
#define DAC14_DEVICE_ADDRESS_SCL   0x4B
 
#define DAC14_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DAC14_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DAC14_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* dac14_master_io_t) (struct dac14_s *, uint8_t, uint16_t *)
 DAC 14 Click driver interface.
 
typedef struct dac14_s dac14_t
 DAC 14 Click context object.
 

Enumerations

enum  dac14_drv_t { DAC14_DRV_SEL_SPI , DAC14_DRV_SEL_I2C }
 DAC 14 Click driver selector. More...
 
enum  dac14_return_value_t { DAC14_OK = 0 , DAC14_ERROR = -1 }
 DAC 14 Click return value data. More...
 

Functions

void dac14_cfg_setup (dac14_cfg_t *cfg)
 DAC 14 configuration object setup function.
 
void dac14_drv_interface_selection (dac14_cfg_t *cfg, dac14_drv_t drv_sel)
 DAC 14 driver interface setup function.
 
err_t dac14_init (dac14_t *ctx, dac14_cfg_t *cfg)
 DAC 14 initialization function.
 
err_t dac14_default_cfg (dac14_t *ctx)
 DAC 14 default configuration function.
 
err_t dac14_write_register (dac14_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 14 write register function.
 
err_t dac14_read_register (dac14_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 14 read register function.
 
uint8_t dac14_get_int_pin (dac14_t *ctx)
 DAC 14 get int pin function.
 
err_t dac14_check_communication (dac14_t *ctx)
 DAC 14 check communication function.
 
err_t dac14_set_dac_vout_enable (dac14_t *ctx, uint8_t dac, uint8_t vout_pdn)
 DAC 14 set dac vout enable function.
 
err_t dac14_set_dac_vref (dac14_t *ctx, uint8_t dac, uint8_t vref)
 DAC 14 set dac vref function.
 
err_t dac14_set_dac_margins (dac14_t *ctx, uint8_t dac, uint16_t margin_l, uint16_t margin_h)
 DAC 14 set dac margins function.
 
err_t dac14_set_dac_data (dac14_t *ctx, uint8_t dac, uint16_t dac_data)
 DAC 14 set dac data function.
 
err_t dac14_start_function_gen (dac14_t *ctx, uint8_t dac)
 DAC 14 start function gen function.
 
err_t dac14_stop_function_gen (dac14_t *ctx, uint8_t dac)
 DAC 14 stop function gen function.
 
err_t dac14_config_function_gen (dac14_t *ctx, uint8_t dac, uint8_t waveform, uint8_t code_step, uint8_t slew_rate)
 DAC 14 config function gen function.
 

Detailed Description

This file contains API for DAC 14 Click Driver.

Typedef Documentation

◆ dac14_master_io_t

typedef err_t(* dac14_master_io_t) (struct dac14_s *, uint8_t, uint16_t *)

DAC 14 Click driver interface.

Definition of driver interface of DAC 14 Click driver. Driver serial interface.

◆ dac14_t

typedef struct dac14_s dac14_t

DAC 14 Click context object.

Context object definition of DAC 14 Click driver.

Enumeration Type Documentation

◆ dac14_drv_t

DAC 14 Click driver selector.

Selects target driver interface of DAC 14 Click driver.

Enumerator
DAC14_DRV_SEL_SPI 

SPI driver descriptor.

DAC14_DRV_SEL_I2C 

I2C driver descriptor.

◆ dac14_return_value_t

DAC 14 Click return value data.

Predefined enum values for driver return values.

Enumerator
DAC14_OK 
DAC14_ERROR