dac13 2.1.0.0
dac13.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  dac13_t
 DAC 13 Click context object. More...
 
struct  dac13_cfg_t
 DAC 13 Click configuration object. More...
 

Macros

#define DAC13_REG_INTERFACE_CONFIG_A   0x00
 DAC 13 register list.
 
#define DAC13_REG_INTERFACE_CONFIG_B   0x01
 
#define DAC13_REG_DEVICE_CONFIG   0x02
 
#define DAC13_REG_CHIP_TYPE   0x03
 
#define DAC13_REG_PRODUCT_ID_L   0x04
 
#define DAC13_REG_PRODUCT_ID_H   0x05
 
#define DAC13_REG_CHIP_GRADE   0x06
 
#define DAC13_REG_SCRATCH_PAD   0x0A
 
#define DAC13_REG_SPI_REVISION   0x0B
 
#define DAC13_REG_VENDOR_L   0x0C
 
#define DAC13_REG_VENDOR_H   0x0D
 
#define DAC13_REG_STREAM_MODE   0x0E
 
#define DAC13_REG_TRANSFER_REGISTER   0x0F
 
#define DAC13_REG_INTERFACE_CONFIG_C   0x10
 
#define DAC13_REG_INTERFACE_STATUS_A   0x11
 
#define DAC13_REG_INTERFACE_CONFIG_D   0x14
 
#define DAC13_REG_REFERENCE_CONFIG   0x15
 
#define DAC13_REG_ERR_ALARM_MASK   0x16
 
#define DAC13_REG_ERR_STATUS   0x17
 
#define DAC13_REG_POWERDOWN_CONFIG   0x18
 
#define DAC13_REG_CH0_OUTPUT_RANGE   0x19
 
#define DAC13_REG_HW_LDAC_16B   0x28
 
#define DAC13_REG_CH0_DAC_16B   0x2A
 
#define DAC13_REG_DAC_PAGE_16B   0x2E
 
#define DAC13_REG_CH_SELECT_16B   0x2F
 
#define DAC13_REG_INPUT_PAGE_16B   0x31
 
#define DAC13_REG_SW_LDAC_16B   0x32
 
#define DAC13_REG_CH0_INPUT_16B   0x34
 
#define DAC13_REG_HW_LDAC_24B   0x37
 
#define DAC13_REG_CH0_DAC_24B   0x3A
 
#define DAC13_REG_DAC_PAGE_24B   0x40
 
#define DAC13_REG_CH_SELECT_24B   0x41
 
#define DAC13_REG_INPUT_PAGE_24B   0x44
 
#define DAC13_REG_SW_LDAC_24B   0x45
 
#define DAC13_REG_CH0_INPUT_24B   0x48
 
#define DAC13_SPI_READ_BIT   0x80
 DAC 13 SPI read/write bit setting.
 
#define DAC13_PRODUCT_ID   0x400B
 DAC 13 ID setting.
 
#define DAC13_VENDOR_ID   0x0456
 
#define DAC13_IDUMP_FASTMODE   0x40
 DAC 13 REFERENCE_CONFIG register setting.
 
#define DAC13_REFERENCE_VOLTAGE_SEL_INT   0x00
 
#define DAC13_REFERENCE_VOLTAGE_SEL_INT_OUT   0x01
 
#define DAC13_REFERENCE_VOLTAGE_SEL_EXT   0x02
 
#define DAC13_REFERENCE_VOLTAGE_SEL_MASK   0x03
 
#define DAC13_OUT_RANGE_0_TO_2p5V   0x00
 DAC 13 out range select setting.
 
#define DAC13_OUT_RANGE_0_TO_5V   0x01
 
#define DAC13_OUT_RANGE_0_TO_10V   0x02
 
#define DAC13_OUT_RANGE_NEG_5_TO_5V   0x03
 
#define DAC13_OUT_RANGE_NEG_2p5_TO_7p5V   0x04
 
#define DAC13_VZS_OUT_RANGE_0_TO_2p5V   ( -0.197f )
 DAC 13 voltage output setting.
 
#define DAC13_VFS_OUT_RANGE_0_TO_2p5V   ( 2.701f )
 
#define DAC13_VZS_OUT_RANGE_0_TO_5V   ( -0.077f )
 
#define DAC13_VFS_OUT_RANGE_0_TO_5V   ( 5.077f )
 
#define DAC13_VZS_OUT_RANGE_0_TO_10V   ( -0.162f )
 
#define DAC13_VFS_OUT_RANGE_0_TO_10V   ( 10.164f )
 
#define DAC13_VZS_OUT_RANGE_NEG_5_TO_5V   ( -5.164f )
 
#define DAC13_VFS_OUT_RANGE_NEG_5_TO_5V   ( 5.162f )
 
#define DAC13_VZS_OUT_RANGE_NEG_2p5_TO_7p5V   ( -2.663f )
 
#define DAC13_VFS_OUT_RANGE_NEG_2p5_TO_7p5V   ( 7.663f )
 
#define DAC13_DAC_RES_16BIT   0xFFFF
 
#define DAC13_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define DAC13_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define DAC13_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  dac13_return_value_t { DAC13_OK = 0 , DAC13_ERROR = -1 }
 DAC 13 Click return value data. More...
 

Functions

void dac13_cfg_setup (dac13_cfg_t *cfg)
 DAC 13 configuration object setup function.
 
err_t dac13_init (dac13_t *ctx, dac13_cfg_t *cfg)
 DAC 13 initialization function.
 
err_t dac13_default_cfg (dac13_t *ctx)
 DAC 13 default configuration function.
 
err_t dac13_generic_write (dac13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAC 13 data writing function.
 
err_t dac13_generic_read (dac13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAC 13 data reading function.
 
err_t dac13_write_register (dac13_t *ctx, uint8_t reg, uint8_t data_in)
 DAC 13 write register function.
 
err_t dac13_read_register (dac13_t *ctx, uint8_t reg, uint8_t *data_out)
 DAC 13 read register function.
 
err_t dac13_write_register_16b (dac13_t *ctx, uint8_t reg, uint16_t data_in)
 DAC 13 write register 16b function.
 
err_t dac13_read_register_16b (dac13_t *ctx, uint8_t reg, uint16_t *data_out)
 DAC 13 read register 16b function.
 
void dac13_set_ldc_pin (dac13_t *ctx, uint8_t state)
 DAC 13 set ldc pin function.
 
void dac13_set_rst_pin (dac13_t *ctx, uint8_t state)
 DAC 13 set rst pin function.
 
uint8_t dac13_get_alert_pin (dac13_t *ctx)
 DAC 13 get alert pin function.
 
void dac13_reset_device (dac13_t *ctx)
 DAC 13 reset device function.
 
err_t dac13_check_communication (dac13_t *ctx)
 DAC 13 check communication function.
 
err_t dac13_set_output_range (dac13_t *ctx, uint8_t out_range)
 DAC 13 set output range function.
 
err_t dac13_set_dac_value (dac13_t *ctx, uint16_t dac_value)
 DAC 13 set dac value function.
 
err_t dac13_set_output_voltage (dac13_t *ctx, float voltage)
 DAC 13 set output voltage function.
 

Detailed Description

This file contains API for DAC 13 Click Driver.

Enumeration Type Documentation

◆ dac13_return_value_t

DAC 13 Click return value data.

Predefined enum values for driver return values.

Enumerator
DAC13_OK 
DAC13_ERROR