dac8 2.0.0.0
dac8.h File Reference

This file contains API for DAC 8 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  dac8_s
 Click ctx object definition. More...
 
struct  dac8_cfg_t
 Click configuration structure definition. More...
 
struct  dac8_cfg_data_t
 

Macros

#define DAC8_MAP_MIKROBUS(cfg, mikrobus)
 
#define DAC8_MASTER_I2C   0
 
#define DAC8_MASTER_SPI   1
 
#define DAC8_RETVAL   uint8_t
 
#define DAC8_OK   0x00
 
#define DAC8_INIT_ERROR   0xFF
 
#define DAC8_I2C_SLAVE_ADDR   0x48
 
#define DAC8_REG_NOOP   0x00
 
#define DAC8_REG_DEVID   0x01
 
#define DAC8_REG_SYNC   0x02
 
#define DAC8_REG_CONFIG   0x03
 
#define DAC8_REG_GAIN   0x04
 
#define DAC8_REG_TRIGGER   0x05
 
#define DAC8_REG_STATUS   0x07
 
#define DAC8_REG_DAC   0x08
 
#define DAC8_SYNC_DISABLE   0x0000
 
#define DAC8_SYNC_ENABLE   0x0001
 
#define DAC8_CONFIG_REF_PWDWN_ENABLE   0x0000
 
#define DAC8_CONFIG_REF_PWDWN_DISABLE   0x0001
 
#define DAC8_CONFIG_REF_PWDWN_BIT_MASK   0x0001
 
#define DAC8_CONFIG_DAC_PWDWN_DISABLE   0x0000
 
#define DAC8_CONFIG_DAC_PWDWN_ENABLE   0x0001
 
#define DAC8_CONFIG_DAC_PWDWN_BIT_MASK   0x0001
 
#define DAC8_GAIN_REF_DIV_DISABLE   0x0000
 
#define DAC8_GAIN_REF_DIV_2   0x0001
 
#define DAC8_GAIN_REF_DIV_BIT_MASK   0x0001
 
#define DAC8_GAIN_BUFF_GAIN_1   0x0000
 
#define DAC8_GAIN_BUFF_GAIN_2   0x0001
 
#define DAC8_GAIN_BUFF_GAIN_BIT_MASK   0x0001
 
#define DAC8_TRIGGER_LDAC   0x0010
 
#define DAC8_TRIGGER_SOFT_RESET   0x000A
 
#define DAC8_STATUS_REF_ALARM_BIT_MASK   0x0001
 
#define DAC8_ERROR   0x00
 
#define DAC8_SUCCESS   0x01
 
#define DAC8_ADDR_DEFAULT   0x00
 
#define DAC8_ADDR_BIT_MASK   0x03
 
#define DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE   0x00
 
#define DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_UPDATE   0x01
 
#define DAC8_CTRL_UPD_AN_OUT_SIMULTANEOUS_UPDATE   0x02
 
#define DAC8_CTRL_UPD_AN_OUT_BROADCAST_UPDATE   0x03
 
#define DAC8_CTRL_UPD_AN_OUT_BIT_MASK   0x03
 
#define DAC8_DAC_SEL_CH_A   0x00
 
#define DAC8_DAC_SEL_CH_B   0x01
 
#define DAC8_DAC_SEL_CH_C   0x02
 
#define DAC8_DAC_SEL_CH_D   0x03
 
#define DAC8_DAC_SEL_ALL_CH_BROADCAST   0x30
 
#define DAC8_DAC_SEL_CH_BIT_MASK   0x03
 
#define DAC8_PWR_MODE_POWER_UP   0x00
 
#define DAC8_PWR_MODE_POWER_DOWN_OUT_HIGH_IMPEDANCE   0x09
 
#define DAC8_PWR_MODE_POWER_DOWN_OUT_TYP_1K_TO_GND   0x0B
 
#define DAC8_PWR_MODE_POWER_DOWN_OUT_TYP_100K_TO_GND   0x0D
 
#define DAC8_PWR_MODE_POWER_DOWN_OUT_HIGH_IMPEDANCES   0x0F
 
#define DAC8_PWR_UP_MODE_BIT_MASK   0x01
 
#define DAC8_PWR_DOWN_MODE_BIT_MASK   0x0E
 
#define DAC8_24_BIT_BIT_MASK   0x00FFFFFF
 
#define DAC8_DAC_OUT_DATA_MIN   0x0000
 
#define DAC8_DAC_OUT_DATA_MAX   0x0FFF
 
#define DAC8_LDAC_LOW   0x00
 
#define DAC8_LDAC_HIGH   0x01
 
#define DAC8_DAC8554_ENABLE   0x00
 
#define DAC8_DAC8554_DISABLE   0x01
 

Typedefs

typedef uint8_t dac8_select_t
 Communication type.
 
typedef void(* dac8_master_io_t) (struct dac8_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct dac8_s dac8_t
 Click ctx object definition.
 

Functions

void dac8_cfg_setup (dac8_cfg_t *cfg)
 Config Object Initialization function.
 
DAC8_RETVAL dac8_init (dac8_t *ctx, dac8_cfg_t *cfg, uint8_t master_mode)
 Initialization function.
 
void dac8_generic_write (dac8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void dac8_generic_read (dac8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
DAC8_RETVAL dac8_enable_sync (dac8_t *ctx, uint8_t en_sync)
 Enable synchronous function.
 
DAC8_RETVAL dac8_set_config (dac8_t *ctx, uint16_t en_ref_pwdwn, uint16_t en_dac_pwdwn)
 Set config function.
 
DAC8_RETVAL dac8_set_gain (dac8_t *ctx, uint16_t en_ref_div, uint16_t en_buff_gain)
 Set gain function.
 
void dac8_set_synchronously_load (dac8_t *ctx)
 Set synchronously load function.
 
void dac8_soft_reset (dac8_t *ctx)
 Set reset function.
 
uint8_t dac8_get_ref_alarm (dac8_t *ctx)
 Get ref alarm function.
 
DAC8_RETVAL dac8_set_vref (dac8_t *ctx, uint16_t vref_mv)
 Set vref function.
 
void dac8_device_enable (dac8_t *ctx, uint8_t en_sel)
 Device enable function.
 
void dac8_set_ldac (dac8_t *ctx, uint8_t ldac_sel)
 Set LDAC function.
 
void dac8_load_dac (dac8_t *ctx)
 Load DAC function.
 
void dac8_generic_spi_write (dac8_t *ctx, uint32_t tx_data)
 Generic SPI write function.
 
void dac8_device_config (dac8_t *ctx, dac8_cfg_data_t cfg_data)
 Set device config function.
 

Detailed Description

This file contains API for DAC 8 Click driver.