dac15 2.1.0.0
dac15.h File Reference

This file contains API for DAC 15 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  dac15_s
 DAC 15 Click context object. More...
 
struct  dac15_cfg_t
 DAC 15 Click configuration object. More...
 

Macros

#define DAC15_REG_NOOP   0x00
 DAC 15 description register.
 
#define DAC15_REG_DEVID   0x01
 
#define DAC15_REG_SYNC   0x02
 
#define DAC15_REG_CONFIG   0x03
 
#define DAC15_REG_GAIN   0x04
 
#define DAC15_REG_TRIGGER   0x05
 
#define DAC15_REG_BRDCAST   0x06
 
#define DAC15_REG_STATUS   0x07
 
#define DAC15_REG_DAC_A_DATA   0x08
 
#define DAC15_REG_DAC_B_DATA   0x09
 
#define DAC15_DEVICE_ID   0x0295u
 DAC 15 description of device ID data.
 
#define DAC15_SYNC_DAC_B_BRDCAST_DIS   0x0000u
 DAC 15 SYNC register field descriptions.
 
#define DAC15_SYNC_DAC_B_BRDCAST_EN   0x0100u
 
#define DAC15_SYNC_DAC_A_BRDCAST_DIS   0x0000u
 
#define DAC15_SYNC_DAC_A_BRDCAST_EN   0x0080u
 
#define DAC15_SYNC_DAC_B_SYNC_DIS   0x0000u
 
#define DAC15_SYNC_DAC_B_SYNC_EN   0x0002u
 
#define DAC15_SYNC_DAC_A_SYNC_DIS   0x0000u
 
#define DAC15_SYNC_DAC_A_SYNC_EN   0x0001u
 
#define DAC15_CONFIG_REF_PWUP   0x0000u
 DAC 15 CONFIG register field descriptions.
 
#define DAC15_CONFIG_REF_PWDWN   0x0100u
 
#define DAC15_CONFIG_DAC_B_PWUP   0x0000u
 
#define DAC15_CONFIG_DAC_B_PWDWN   0x0002u
 
#define DAC15_CONFIG_DAC_A_PWUP   0x0000u
 
#define DAC15_CONFIG_DAC_A_PWDWN   0x0001u
 
#define DAC15_GAIN_REF_DIV_1   0x0000u
 DAC 15 GAIN register field descriptions.
 
#define DAC15_GAIN_REF_DIV_2   0x0100u
 
#define DAC15_GAIN_BUFF_B_GAIN_1   0x0000u
 
#define DAC15_GAIN_BUFF_B_GAIN_2   0x0002u
 
#define DAC15_GAIN_BUFF_A_GAIN_1   0x0000u
 
#define DAC15_GAIN_BUFF_A_GAIN_2   0x0001u
 
#define DAC15_TRIGGER_LDA_SYNC_LOAD_DAC   0x0010u
 DAC 15 TRIGGER register field descriptions.
 
#define DAC15_TRIGGER_SOFT_RESET   0x000Au
 
#define DAC15_SET_DAC_A   0
 DAC 15 DAC selection data.
 
#define DAC15_SET_DAC_B   1
 
#define DAC15_DAC_RES_16BIT   0xFFFFu
 DAC 15 calculation data.
 
#define DAC15_MAX_DAC_DATA   65535.0f
 
#define DAC15_MAX_VOUT_MV   3300.0f
 
#define DAC15_VREF_3V3   3.3f
 
#define DAC15_VREF_5V   5.0f
 
#define DAC15_CONV_DEV_MV_TO_V   1000.0f
 
#define DAC15_DEVICE_ADDRESS_GND   0x48
 DAC 15 device address setting.
 
#define DAC15_DEVICE_ADDRESS_VCC   0x49
 
#define DAC15_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DAC15_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DAC15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* dac15_master_io_t) (struct dac15_s *, uint8_t, uint8_t *, uint8_t)
 DAC 15 Click driver interface.
 
typedef struct dac15_s dac15_t
 DAC 15 Click context object.
 

Enumerations

enum  dac15_drv_t { DAC15_DRV_SEL_SPI , DAC15_DRV_SEL_I2C }
 DAC 15 Click driver selector. More...
 
enum  dac15_return_value_t { DAC15_OK = 0 , DAC15_ERROR = -1 }
 DAC 15 Click return value data. More...
 

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

This file contains API for DAC 15 Click Driver.

Typedef Documentation

◆ dac15_master_io_t

typedef err_t(* dac15_master_io_t) (struct dac15_s *, uint8_t, uint8_t *, uint8_t)

DAC 15 Click driver interface.

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

◆ dac15_t

typedef struct dac15_s dac15_t

DAC 15 Click context object.

Context object definition of DAC 15 Click driver.

Enumeration Type Documentation

◆ dac15_drv_t

DAC 15 Click driver selector.

Selects target driver interface of DAC 15 Click driver.

Enumerator
DAC15_DRV_SEL_SPI 

SPI driver descriptor.

DAC15_DRV_SEL_I2C 

I2C driver descriptor.

◆ dac15_return_value_t

DAC 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
DAC15_OK 
DAC15_ERROR