Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define DAC10_REG_STATUS 0xD0
70 #define DAC10_REG_GENERAL_CONFIG 0xD1
71 #define DAC10_REG_TRIGGER 0xD3
72 #define DAC10_REG_DAC_DATA 0x21
73 #define DAC10_REG_DAC_MARGIN_HIGH 0x25
74 #define DAC10_REG_DAC_MARGIN_LOW 0x26
75 #define DAC10_REG_PMBUS_OPERATION 0x01
76 #define DAC10_REG_PMBUS_STATUS_BYTE 0x78
77 #define DAC10_REG_PMBUS_VERSION 0x98
95 #define DAC10_STATUS_NVM_CRC_ALARM_USER 0x8000
96 #define DAC10_STATUS_NVM_CRC_ALARM_INTERNAL 0x4000
97 #define DAC10_STATUS_NVM_BUSY 0x2000
98 #define DAC10_STATUS_DAC_UPDATE_BUSY 0x1000
99 #define DAC10_STATUS_DEVICE_ID 0x000C
100 #define DAC10_STATUS_DEVICE_ID_MASK 0x003C
101 #define DAC10_STATUS_VERSION_ID_MASK 0x0003
107 #define DAC10_GEN_CONFIG_FCFG_TRIANGLE_WAVE 0x0000
108 #define DAC10_GEN_CONFIG_FCFG_SAW_TOOTH_WAVE_RISING 0x4000
109 #define DAC10_GEN_CONFIG_FCFG_SAW_TOOTH_WAVE_FALLING 0x8000
110 #define DAC10_GEN_CONFIG_FCFG_SQUARE_WAVE 0xC000
111 #define DAC10_GEN_CONFIG_FCFG_CLR_MASK 0xC000
112 #define DAC10_GEN_CONFIG_DEVICE_LOCKED 0x2000
113 #define DAC10_GEN_CONFIG_DEVICE_NOT_LOCKED 0x0000
114 #define DAC10_GEN_CONFIG_DEVICE_LOCK_MASK 0x2000
115 #define DAC10_GEN_CONFIG_PMBUS_ENABLE 0x1000
116 #define DAC10_GEN_CONFIG_PMBUS_DISABLE 0x0000
117 #define DAC10_GEN_CONFIG_PMBUS_EN_MASK 0x1000
118 #define DAC10_GEN_CONFIG_CODE_STEP_1LSB 0x0000
119 #define DAC10_GEN_CONFIG_CODE_STEP_2LSB 0x0200
120 #define DAC10_GEN_CONFIG_CODE_STEP_3LSB 0x0400
121 #define DAC10_GEN_CONFIG_CODE_STEP_4LSB 0x0600
122 #define DAC10_GEN_CONFIG_CODE_STEP_6LSB 0x0800
123 #define DAC10_GEN_CONFIG_CODE_STEP_8LSB 0x0A00
124 #define DAC10_GEN_CONFIG_CODE_STEP_16LSB 0x0C00
125 #define DAC10_GEN_CONFIG_CODE_STEP_32LSB 0x0E00
126 #define DAC10_GEN_CONFIG_CODE_STEP_MASK 0x0E00
127 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6US 0x0000
128 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p25 0x0020
129 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p50 0x0040
130 #define DAC10_GEN_CONFIG_SLEW_RATE_25p6USx1p75 0x0060
131 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8US 0x0080
132 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p25 0x00A0
133 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p50 0x00C0
134 #define DAC10_GEN_CONFIG_SLEW_RATE_204p8USx1p75 0x00E0
135 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MS 0x0100
136 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p25 0x0120
137 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p50 0x0140
138 #define DAC10_GEN_CONFIG_SLEW_RATE_1p6384MSx1p75 0x0160
139 #define DAC10_GEN_CONFIG_SLEW_RATE_12US 0x0180
140 #define DAC10_GEN_CONFIG_SLEW_RATE_8US 0x01A0
141 #define DAC10_GEN_CONFIG_SLEW_RATE_4US 0x01C0
142 #define DAC10_GEN_CONFIG_SLEW_RATE_NO_SLEW 0x01E0
143 #define DAC10_GEN_CONFIG_SLEW_RATE_MASK 0x01E0
144 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_UP 0x0000
145 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_DOWN_10K 0x0008
146 #define DAC10_GEN_CONFIG_DAC_PDN_POWER_DOWN_HIGH_Z 0x0010
147 #define DAC10_GEN_CONFIG_DAC_PDN_MASK 0x0018
148 #define DAC10_GEN_CONFIG_INT_REF_ENABLE 0x0004
149 #define DAC10_GEN_CONFIG_INT_REF_DISABLE 0x0000
150 #define DAC10_GEN_CONFIG_INT_REF_EN_MASK 0x0004
151 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_1p5X 0x0000
152 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_2X 0x0001
153 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_3X 0x0002
154 #define DAC10_GEN_CONFIG_DAC_SPAN_GAIN_4X 0x0003
155 #define DAC10_GEN_CONFIG_DAC_SPAN_MASK 0x0003
161 #define DAC10_TRIGGER_DEVICE_UNLOCK_CODE 0x5000
162 #define DAC10_TRIGGER_DEVICE_UNLOCK_CODE_MASK 0xF000
163 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_INITIATED 0x0200
164 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_NOT_INITIATED 0x0000
165 #define DAC10_TRIGGER_DEVICE_CONFIG_RESET_MASK 0x0200
166 #define DAC10_TRIGGER_START_FUNC_GEN_ENABLE 0x0100
167 #define DAC10_TRIGGER_START_FUNC_GEN_DISABLE 0x0000
168 #define DAC10_TRIGGER_START_FUNC_GEN_MASK 0x0100
169 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_INITIATED 0x0080
170 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_NOT_INITIATED 0x0000
171 #define DAC10_TRIGGER_PMBUS_MARGIN_HIGH_MASK 0x0080
172 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_INITIATED 0x0040
173 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_NOT_INITIATED 0x0000
174 #define DAC10_TRIGGER_PMBUS_MARGIN_LOW_MASK 0x0040
175 #define DAC10_TRIGGER_NWM_RELOAD_INITIATED 0x0020
176 #define DAC10_TRIGGER_NWM_RELOAD_NOT_INITIATED 0x0000
177 #define DAC10_TRIGGER_NWM_RELOAD_MASK 0x0020
178 #define DAC10_TRIGGER_NWM_PROG_INITIATED 0x0010
179 #define DAC10_TRIGGER_NWM_PROG_NOT_INITIATED 0x0000
180 #define DAC10_TRIGGER_NWM_PROG_MASK 0x0010
181 #define DAC10_TRIGGER_SW_RESET_INITIATED 0x0008
182 #define DAC10_TRIGGER_SW_RESET_NOT_INITIATED 0x000A
183 #define DAC10_TRIGGER_SW_RESET_MASK 0x000F
189 #define DAC10_PMBUS_OPERATION_CMD_TURN_OFF 0x0000
190 #define DAC10_PMBUS_OPERATION_CMD_TURN_ON 0x8000
191 #define DAC10_PMBUS_OPERATION_CMD_MARGIN_HIGH 0xA400
192 #define DAC10_PMBUS_OPERATION_CMD_MARGIN_LOW 0x9400
193 #define DAC10_PMBUS_OPERATION_CMD 0xFF00
199 #define DAC10_PMBUS_STATUS_BYTE_CML_NO_FAULT 0x0000
200 #define DAC10_PMBUS_STATUS_BYTE_CML_FAULT 0x0200
201 #define DAC10_PMBUS_STATUS_BYTE_CML_MASK 0x0200
207 #define DAC10_PMBUS_VERSION_DEFAULT 0x2200
208 #define DAC10_PMBUS_VERSION_MASK 0xFF00
214 #define DAC10_MIN_DAC_VALUE 0x0000
215 #define DAC10_MAX_DAC_VALUE 0x03FF
221 #define DAC10_VREF_3V3 3.3
222 #define DAC10_VREF_5V 5
223 #define DAC10_VREF_INT 1.21
230 #define DAC10_DEV_ADDR_GND 0x48
231 #define DAC10_DEV_ADDR_VCC 0x49
232 #define DAC10_DEV_ADDR_SDA 0x4A
233 #define DAC10_DEV_ADDR_SCL 0x4B
234 #define DAC10_DEV_ADDR_BROADCAST 0x47
253 #define DAC10_MAP_MIKROBUS( cfg, mikrobus ) \
254 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
255 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:279
@ DAC10_OK
Definition: dac10.h:294
pin_name_t sda
Definition: dac10.h:281
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:280
uint8_t i2c_address
Definition: dac10.h:284
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:265
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:270
i2c_master_t i2c
Definition: dac10.h:267
uint32_t i2c_speed
Definition: dac10.h:283
@ DAC10_ERROR
Definition: dac10.h:295
dac10_return_value_t
DAC 10 Click return value data.
Definition: dac10.h:293