Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_i2c_master.h"
51 #define DAC5_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
53 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
54 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
55 cfg.lda = MIKROBUS( mikrobus, MIKROBUS_PWM )
62 #define DAC5_RETVAL uint8_t
65 #define DAC5_INIT_ERROR 0xFF
67 #define DAC5_SUCCESS 1
74 #define DAC5_SLAVE_ADDRESS_BROADCAST 0x47
75 #define DAC5_SLAVE_ADDRESS_GND 0x48
76 #define DAC5_SLAVE_ADDRESS_VCC 0x49
77 #define DAC5_SLAVE_ADDRESS_SDA 0x4A
78 #define DAC5_SLAVE_ADDRESS_SCL 0x4B
85 #define DAC5_VREF_3300MV 3300
86 #define DAC5_VREF_5000MV 5000
87 #define DAC5_VREF_2048MV 2048
88 #define DAC5_VREF_1024MV 1024
95 #define DAC5_REG_CONFIG 0x01
96 #define DAC5_REG_STATUS_TRIGGER 0x02
97 #define DAC5_REG_BRDCAST 0x03
98 #define DAC5_REG_DAC_A_DATA 0x08
99 #define DAC5_REG_DAC_B_DATA 0x09
100 #define DAC5_REG_DAC_C_DATA 0x0A
101 #define DAC5_REG_DAC_D_DATA 0x0B
102 #define DAC5_REG_DAC_E_DATA 0x0C
103 #define DAC5_REG_DAC_F_DATA 0x0D
104 #define DAC5_REG_DAC_G_DATA 0x0E
105 #define DAC5_REG_DAC_H_DATA 0x0F
112 #define DAC5_CONFIG_DEFAULT 0x00FF
113 #define DAC5_CONFIG_GLOBAL_ENABLED 0x0000
114 #define DAC5_CONFIG_GLOBAL_DISABLED 0x0100
115 #define DAC5_CONFIG_A_ENABLED 0x0000
116 #define DAC5_CONFIG_A_DISABLED 0x0001
117 #define DAC5_CONFIG_B_ENABLED 0x0000
118 #define DAC5_CONFIG_B_DISABLED 0x0002
119 #define DAC5_CONFIG_C_ENABLED 0x0000
120 #define DAC5_CONFIG_C_DISABLED 0x0004
121 #define DAC5_CONFIG_D_ENABLED 0x0000
122 #define DAC5_CONFIG_D_DISABLED 0x0008
123 #define DAC5_CONFIG_E_ENABLED 0x0000
124 #define DAC5_CONFIG_E_DISABLED 0x0010
125 #define DAC5_CONFIG_F_ENABLED 0x0000
126 #define DAC5_CONFIG_F_DISABLED 0x0020
127 #define DAC5_CONFIG_G_ENABLED 0x0000
128 #define DAC5_CONFIG_G_DISABLED 0x0040
129 #define DAC5_CONFIG_H_ENABLED 0x0000
130 #define DAC5_CONFIG_H_DISABLED 0x0080
137 #define DAC5_DEVICE_ID 0x0300
138 #define DAC5_SOFTWARE_RESET 0x000A
145 #define DAC5_MIN_DATA 0x0000
146 #define DAC5_MAX_DATA 0x0FFF
154 #define DAC5_SUCCESS 1
161 #define DAC5_SYNCHRONOUS 1
162 #define DAC5_ASYNCHRONOUS 0
uint16_t dac5_generic_read(dac5_t *ctx, uint8_t reg)
Generic read function.
Click configuration structure definition.
Definition: dac5.h:197
pin_name_t scl
Definition: dac5.h:200
Click ctx object definition.
Definition: dac5.h:176
void dac5_cfg_setup(dac5_cfg_t *cfg)
Config Object Initialization function.
uint8_t slave_address
Definition: dac5.h:188
void dac5_software_reset(dac5_t *ctx)
Function for software reset.
uint8_t dac5_set_ldac_pin(dac5_t *ctx, uint8_t status)
Function for setting LDAC pin status.
pin_name_t lda
Definition: dac5.h:206
uint8_t dac5_send_data(dac5_t *ctx, uint8_t data_reg, uint16_t data_buf)
Function for sending data to one output.
uint32_t i2c_speed
Definition: dac5.h:210
void dac5_generic_write(dac5_t *ctx, uint8_t reg, uint16_t data_buf)
Generic write function.
digital_out_t rst
Definition: dac5.h:179
DAC5_RETVAL dac5_init(dac5_t *ctx, dac5_cfg_t *cfg)
Initialization function.
uint8_t i2c_address
Definition: dac5.h:211
digital_out_t lda
Definition: dac5.h:180
#define DAC5_RETVAL
Definition: dac5.h:62
pin_name_t rst
Definition: dac5.h:205
pin_name_t sda
Definition: dac5.h:201
uint16_t dac5_get_device_id(dac5_t *ctx)
Function for reading device id.
i2c_master_t i2c
Definition: dac5.h:184
void dac5_clear(dac5_t *ctx)
Function for clearing sent data.
void dac5_config(dac5_t *ctx, uint16_t config_data)
Function for configurating click.
uint16_t vref
Definition: dac5.h:189