dac9 2.0.0.0
dac9.h File Reference

This file contains API for DAC 9 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  dac9_s
 DAC 9 Click context object. More...
 
struct  dac9_cfg_t
 DAC 9 Click configuration object. More...
 

Macros

#define DAC9_REG_NOOP   0x00
 DAC 9 description register.
 
#define DAC9_REG_DEVID   0x01
 
#define DAC9_REG_SYNC   0x02
 
#define DAC9_REG_CONFIG   0x03
 
#define DAC9_REG_GAIN   0x04
 
#define DAC9_REG_TRIGGER   0x05
 
#define DAC9_REG_STATUS   0x07
 
#define DAC9_REG_DAC   0x08
 
#define DAC9_SYNC_DISABLE   0x0000
 DAC 9 description setting.
 
#define DAC9_SYNC_ENABLE   0x0001
 
#define DAC9_CONFIG_REF_PWDWN_ENABLE   0x0000
 
#define DAC9_CONFIG_REF_PWDWN_DISABLE   0x0100
 
#define DAC9_CONFIG_REF_PWDWN_BIT_MASK   0x0100
 
#define DAC9_CONFIG_DAC_PWDWN_DISABLE   0x0000
 
#define DAC9_CONFIG_DAC_PWDWN_ENABLE   0x0001
 
#define DAC9_CONFIG_DAC_PWDWN_BIT_MASK   0x0001
 
#define DAC9_GAIN_REF_DIV_DISABLE   0x0000
 
#define DAC9_GAIN_REF_DIV_2   0x0100
 
#define DAC9_GAIN_REF_DIV_BIT_MASK   0x0100
 
#define DAC9_GAIN_BUFF_GAIN_1   0x0000
 
#define DAC9_GAIN_BUFF_GAIN_2   0x0001
 
#define DAC9_GAIN_BUFF_GAIN_BIT_MASK   0x0001
 
#define DAC9_TRIGGER_LDAC   0x0010
 
#define DAC9_TRIGGER_SOFT_RESET   0x000A
 
#define DAC9_STATUS_REF_ALARM_BIT_MASK   0x0001
 
#define DAC9_I2C_ADR_AGND   0x48
 DAC 9 device address setting.
 
#define DAC9_I2C_ADR_VDD   0x49
 
#define DAC9_I2C_ADR_SDA   0x4A
 
#define DAC9_I2C_ADR_SCL   0x4B
 
#define DAC9_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DAC9_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DAC9_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* dac9_master_io_t) (struct dac9_s *, uint8_t, uint8_t *, uint8_t)
 DAC 9 Click driver interface.
 
typedef struct dac9_s dac9_t
 DAC 9 Click context object.
 

Enumerations

enum  dac9_drv_t { DAC9_DRV_SEL_SPI , DAC9_DRV_SEL_I2C }
 DAC 9 Click driver selector. More...
 
enum  dac9_return_value_t { DAC9_OK = 0 , DAC9_ERROR = -1 }
 DAC 9 Click return value data. More...
 

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

This file contains API for DAC 9 Click Driver.

Typedef Documentation

◆ dac9_master_io_t

typedef err_t(* dac9_master_io_t) (struct dac9_s *, uint8_t, uint8_t *, uint8_t)

DAC 9 Click driver interface.

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

◆ dac9_t

typedef struct dac9_s dac9_t

DAC 9 Click context object.

Context object definition of DAC 9 Click driver.

Enumeration Type Documentation

◆ dac9_drv_t

enum dac9_drv_t

DAC 9 Click driver selector.

Selects target driver interface of DAC 9 Click driver.

Enumerator
DAC9_DRV_SEL_SPI 

SPI driver descriptor.

DAC9_DRV_SEL_I2C 

I2C driver descriptor.

◆ dac9_return_value_t

DAC 9 Click return value data.

Predefined enum values for driver return values.

Enumerator
DAC9_OK 
DAC9_ERROR