dac7 2.0.0.0
dac7.h File Reference

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

#include "drv_digital_out.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  dac7_t
 Click ctx object definition. More...
 
struct  dac7_cfg_t
 Click configuration structure definition. More...
 

Macros

#define DAC7_MAP_MIKROBUS(cfg, mikrobus)
 
#define DAC7_RETVAL   uint8_t
 
#define DAC7_RETVAL_T   uint8_t
 
#define DAC7_OK   0x00
 
#define DAC7_INIT_ERROR   0xFF
 
#define DAC7_ERROR   0x00
 
#define DAC7_SUCCESS   0x01
 
#define DAC7_COMMAND_WRITE_INPUT_REGISTER   0x00
 
#define DAC7_COMMAND_UPDATE_DAC_REGISTER   0x08
 
#define DAC7_COMMAND_WRITE_INPUT_REGISTER_UPDATE_ALL   0x10
 
#define DAC7_COMMAND_WRITE_UPDATE_CHANNEL   0x18
 
#define DAC7_COMMAND_POWER_UPDOWN   0x20
 
#define DAC7_COMMAND_RESET   0x28
 
#define DAC7_COMMAND_SET_LDAC   0x30
 
#define DAC7_COMMAND_REFERENCE_ONOFF   0x38
 
#define DAC7_ADDRESS_CHANNEL_A   0x00
 
#define DAC7_ADDRESS_CHANNEL_B   0x01
 
#define DAC7_ADDRESS_CHANNEL_C   0x02
 
#define DAC7_ADDRESS_CHANNEL_D   0x03
 
#define DAC7_ADDRESS_CHANNEL_ALL   0x07
 
#define DAC7_SELECT_CHANNEL_A   0x01
 
#define DAC7_SELECT_CHANNEL_B   0x02
 
#define DAC7_SELECT_CHANNEL_C   0x04
 
#define DAC7_SELECT_CHANNEL_D   0x08
 
#define DAC7_SELECT_CHANNEL_ALL   0x0F
 
#define DAC7_SET_MODE_INPUT   0x00
 
#define DAC7_SET_MODE_INPUT_DAC   0x18
 
#define DAC7_SET_MODE_INPUT_DAC_ALL   0x10
 
#define DAC7_PWR_MODE_NORMAL   0x00
 
#define DAC7_PWR_MODE_POWERDOWN_1K   0x10
 
#define DAC7_PWR_MODE_POWERDOWN_100K   0x20
 
#define DAC7_PWR_MODE_TRISTATE   0x30
 
#define DAC7_PWR_ON_DISABLE   0x00
 
#define DAC7_PWR_ON_ENABLE   0x01
 
#define DAC7_SW_RST_COMMAND   0x01
 
#define DAC7_DONT_CARE_COMMAND   0x00
 
#define DAC7_MASK_BIT_COMMAND   0x38
 
#define DAC7_MASK_BIT_ADDRESS   0x07
 
#define DAC7_MASK_BIT_POWERMODE   0x30
 
#define DAC7_MASK_BIT_SEL_CHANNEL   0x0F
 
#define DAC7_MASK_BIT_0   0x01
 
#define DAC7_MASK_BIT_LBS   0x00FF
 
#define DAC7_VREF_4096mV   0x1000
 
#define DAC7_VREF_5000mV   0x13BA
 

Functions

void dac7_cfg_setup (dac7_cfg_t *cfg)
 Config Object Initialization function.
 
DAC7_RETVAL dac7_init (dac7_t *ctx, dac7_cfg_t *cfg)
 Initialization function.
 
void dac7_write_data (dac7_t *ctx, uint8_t def_cmd, uint8_t addr_cmd, uint16_t write_data)
 Generic write data function.
 
DAC7_RETVAL_T dac7_set_channel (dac7_t *ctx, uint8_t set_cmd, uint8_t addr_ch, uint16_t write_data)
 Set the values of the specified channel function.
 
DAC7_RETVAL_T dac7_set_ch_voltage (dac7_t *ctx, uint8_t addr_ch, uint16_t vol_val, uint16_t v_ref_mv)
 Set the voltage values of the specified channel function.
 
DAC7_RETVAL_T dac7_update_channel (dac7_t *ctx, uint8_t addr_ch, uint16_t ch_data)
 Update channel function.
 
DAC7_RETVAL_T dac7_set_power (dac7_t *ctx, uint8_t pwr_en, uint8_t sel_ch)
 Set power mode function.
 
DAC7_RETVAL_T dac7_sw_reset (dac7_t *ctx)
 Software reset function.
 
DAC7_RETVAL_T dac7_set_ldac (dac7_t *ctx, uint8_t sel_ch)
 Set LDAC setup function.
 
DAC7_RETVAL_T dac7_set_internal_reference (dac7_t *ctx, uint8_t int_ref_en)
 Set internal reference function.
 

Detailed Description

This file contains API for DAC 7 Click driver.