Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define DAC10_REG_STATUS 0xD0
60 #define DAC10_REG_GENERAL_CONFIG 0xD1
61 #define DAC10_REG_TRIGGER 0xD3
62 #define DAC10_REG_DAC_DATA 0x21
63 #define DAC10_REG_DAC_MARGIN_HIGH 0x25
64 #define DAC10_REG_DAC_MARGIN_LOW 0x26
65 #define DAC10_REG_PMBUS_OPERATION 0x01
66 #define DAC10_REG_PMBUS_STATUS_BYTE 0x78
67 #define DAC10_REG_PMBUS_VERSION 0x98
85 #define DAC10_STATUS_NVM_CRC_ALARM_USER 0x8000
86 #define DAC10_STATUS_NVM_CRC_ALARM_INTERNAL 0x4000
87 #define DAC10_STATUS_NVM_BUSY 0x2000
88 #define DAC10_STATUS_DAC_UPDATE_BUSY 0x1000
89 #define DAC10_STATUS_DEVICE_ID 0x000C
90 #define DAC10_STATUS_DEVICE_ID_MASK 0x003C
91 #define DAC10_STATUS_VERSION_ID_MASK 0x0003
97 #define DAC10_GEN_CONFIG_FCFG_TRIANGLE_WAVE 0x0000
98 #define DAC10_GEN_CONFIG_FCFG_SAW_TOOTH_WAVE_RISING 0x4000
99 #define DAC10_GEN_CONFIG_FCFG_SAW_TOOTH_WAVE_FALLING 0x8000
100 #define DAC10_GEN_CONFIG_FCFG_SQUARE_WAVE 0xC000
101 #define DAC10_GEN_CONFIG_FCFG_CLR_MASK 0xC000
102 #define DAC10_GEN_CONFIG_DEVICE_LOCKED 0x2000
103 #define DAC10_GEN_CONFIG_DEVICE_NOT_LOCKED 0x0000
104 #define DAC10_GEN_CONFIG_DEVICE_LOCK_MASK 0x2000
105 #define DAC10_GEN_CONFIG_PMBUS_ENABLE 0x1000
106 #define DAC10_GEN_CONFIG_PMBUS_DISABLE 0x0000
107 #define DAC10_GEN_CONFIG_PMBUS_EN_MASK 0x1000
108 #define DAC10_GEN_CONFIG_CODE_STEP_1LSB 0x0000
109 #define DAC10_GEN_CONFIG_CODE_STEP_2LSB 0x0200
110 #define DAC10_GEN_CONFIG_CODE_STEP_3LSB 0x0400
111 #define DAC10_GEN_CONFIG_CODE_STEP_4LSB 0x0600
112 #define DAC10_GEN_CONFIG_CODE_STEP_6LSB 0x0800
113 #define DAC10_GEN_CONFIG_CODE_STEP_8LSB 0x0A00
114 #define DAC10_GEN_CONFIG_CODE_STEP_16LSB 0x0C00
115 #define DAC10_GEN_CONFIG_CODE_STEP_32LSB 0x0E00
116 #define DAC10_GEN_CONFIG_CODE_STEP_MASK 0x0E00
117 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6US 0x0000
118 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p25 0x0020
119 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p50 0x0040
120 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p75 0x0060
121 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8US 0x0080
122 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p25 0x00A0
123 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p50 0x00C0
124 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p75 0x00E0
125 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MS 0x0100
126 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p25 0x0120
127 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p50 0x0140
128 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p75 0x0160
129 #define DAC10_GEN_CONFIG_SLEW_RATE_12US 0x0180
130 #define DAC10_GEN_CONFIG_SLEW_RATE_8US 0x01A0
131 #define DAC10_GEN_CONFIG_SLEW_RATE_4US 0x01C0
132 #define DAC10_GEN_CONFIG_SLEW_RATE_NO_SLEW 0x01E0
133 #define DAC10_GEN_CONFIG_SLEW_RATE_MASK 0x01E0
134 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_UP 0x0000
135 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_DOWN_10K 0x0008
136 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_DOWN_HIGH_Z 0x0010
137 #define DAC10_GEN_CONFIG_DAC_PDN_MASK 0x0018
138 #define DAC10_GEN_CONFIG_INT_REF_ENABLE 0x0004
139 #define DAC10_GEN_CONFIG_INT_REF_DISABLE 0x0000
140 #define DAC10_GEN_CONFIG_INT_REF_EN_MASK 0x0004
141 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_1p5X 0x0000
142 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_2X 0x0001
143 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_3X 0x0002
144 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_4X 0x0003
145 #define DAC10_GEN_CONFIG_DAC_SPAN_MASK 0x0003
151 #define DAC10_TRIGGER_DEVICE_UNLOCK_CODE 0x5000
152 #define DAC10_TRIGGER_DEVICE_UNLOCK_CODE_MASK 0xF000
153 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_INITIATED 0x0200
154 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_NOT_INITIATED 0x0000
155 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_MASK 0x0200
156 #define DAC10_TRIGGER_START_FUNC_GEN_ENABLE 0x0100
157 #define DAC10_TRIGGER_START_FUNC_GEN_DISABLE 0x0000
158 #define DAC10_TRIGGER_START_FUNC_GEN_MASK 0x0100
159 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_INITIATED 0x0080
160 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_NOT_INITIATED 0x0000
161 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_MASK 0x0080
162 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_INITIATED 0x0040
163 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_NOT_INITIATED 0x0000
164 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_MASK 0x0040
165 #define DAC10_TRIGGER_NWM_RELOAD_INITIATED 0x0020
166 #define DAC10_TRIGGER_NWM_RELOAD_NOT_INITIATED 0x0000
167 #define DAC10_TRIGGER_NWM_RELOAD_MASK 0x0020
168 #define DAC10_TRIGGER_NWM_PROG_INITIATED 0x0010
169 #define DAC10_TRIGGER_NWM_PROG_NOT_INITIATED 0x0000
170 #define DAC10_TRIGGER_NWM_PROG_MASK 0x0010
171 #define DAC10_TRIGGER_SW_RESET_INITIATED 0x0008
172 #define DAC10_TRIGGER_SW_RESET_NOT_INITIATED 0x000A
173 #define DAC10_TRIGGER_SW_RESET_MASK 0x000F
179 #define DAC10_PMBUS_OPERATION_CMD_TURN_OFF 0x0000
180 #define DAC10_PMBUS_OPERATION_CMD_TURN_ON 0x8000
181 #define DAC10_PMBUS_OPERATION_CMD_MARGIN_HIGH 0xA400
182 #define DAC10_PMBUS_OPERATION_CMD_MARGIN_LOW 0x9400
183 #define DAC10_PMBUS_OPERATION_CMD 0xFF00
189 #define DAC10_PMBUS_STATUS_BYTE_CML_NO_FAULT 0x0000
190 #define DAC10_PMBUS_STATUS_BYTE_CML_FAULT 0x0200
191 #define DAC10_PMBUS_STATUS_BYTE_CML_MASK 0x0200
197 #define DAC10_PMBUS_VERSION_DEFAULT 0x2200
198 #define DAC10_PMBUS_VERSION_MASK 0xFF00
204 #define DAC10_MIN_DAC_VALUE 0x0000
205 #define DAC10_MAX_DAC_VALUE 0x03FF
211 #define DAC10_VREF_3V3 3.3
212 #define DAC10_VREF_5V 5
213 #define DAC10_VREF_INT 1.21
220 #define DAC10_DEV_ADDR_GND 0x48
221 #define DAC10_DEV_ADDR_VCC 0x49
222 #define DAC10_DEV_ADDR_SDA 0x4A
223 #define DAC10_DEV_ADDR_SCL 0x4B
224 #define DAC10_DEV_ADDR_BROADCAST 0x47
243 #define DAC10_MAP_MIKROBUS( cfg, mikrobus ) \
244 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
245 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
err_t dac10_enable_dac(dac10_t *ctx)
DAC 10 enable DAC output function.
DAC 10 Click configuration object.
Definition: dac10.h:269
@ DAC10_OK
Definition: dac10.h:284
pin_name_t sda
Definition: dac10.h:271
err_t dac10_set_dac_value(dac10_t *ctx, uint16_t data_in)
DAC 10 set dac value function.
err_t dac10_set_output_voltage_int_vref(dac10_t *ctx, float voltage)
DAC 10 set output voltage with internal reference function.
err_t dac10_set_output_voltage(dac10_t *ctx, float vref, float voltage)
DAC 10 set output voltage function.
pin_name_t scl
Definition: dac10.h:270
uint8_t i2c_address
Definition: dac10.h:274
err_t dac10_set_dac_margin_low(dac10_t *ctx, uint16_t data_in)
DAC 10 set dac margin low function.
err_t dac10_check_device_id(dac10_t *ctx)
DAC 10 check device ID function.
DAC 10 Click context object.
Definition: dac10.h:255
err_t dac10_init(dac10_t *ctx, dac10_cfg_t *cfg)
DAC 10 initialization function.
err_t dac10_reg_write(dac10_t *ctx, uint8_t reg, uint16_t data_in)
DAC 10 I2C writing function.
err_t dac10_reg_read(dac10_t *ctx, uint8_t reg, uint16_t *data_in)
DAC 10 I2C reading function.
err_t dac10_set_dac_margin_high(dac10_t *ctx, uint16_t data_in)
DAC 10 set dac margin high function.
void dac10_cfg_setup(dac10_cfg_t *cfg)
DAC 10 configuration object setup function.
uint8_t slave_address
Definition: dac10.h:260
i2c_master_t i2c
Definition: dac10.h:257
uint32_t i2c_speed
Definition: dac10.h:273
@ DAC10_ERROR
Definition: dac10.h:285
dac10_return_value_t
DAC 10 Click return value data.
Definition: dac10.h:283