38#ifndef DRIVER_MCP4725_H
39#define DRIVER_MCP4725_H
140#define DRIVER_MCP4725_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
148#define DRIVER_MCP4725_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
156#define DRIVER_MCP4725_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
164#define DRIVER_MCP4725_LINK_IIC_READ_COMMAND(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC
172#define DRIVER_MCP4725_LINK_IIC_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC
180#define DRIVER_MCP4725_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
188#define DRIVER_MCP4725_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
struct mcp4725_handle_s mcp4725_handle_t
mcp4725 handle structure definition
uint8_t mcp4725_get_reference_voltage(mcp4725_handle_t *handle, float *ref_voltage)
get the chip reference voltage
mcp4725_power_down_mode_t
mcp4725 power down enumeration definition
uint8_t mcp4725_convert_to_data(mcp4725_handle_t *handle, uint16_t reg, float *s)
convert the register data to the dac value
uint8_t mcp4725_deinit(mcp4725_handle_t *handle)
close the chip
uint8_t mcp4725_info(mcp4725_info_t *info)
get chip's information
uint8_t mcp4725_read(mcp4725_handle_t *handle, uint16_t *value)
read the dac value
uint8_t mcp4725_set_power_mode(mcp4725_handle_t *handle, mcp4725_power_down_mode_t mode)
set the chip power mode
uint8_t mcp4725_get_power_mode(mcp4725_handle_t *handle, mcp4725_power_down_mode_t *mode)
get the chip power mode
mcp4725_address_t
mcp4725 address enumeration definition
struct mcp4725_info_s mcp4725_info_t
mcp4725 information structure definition
uint8_t mcp4725_write(mcp4725_handle_t *handle, uint16_t value)
write the dac value
uint8_t mcp4725_convert_to_register(mcp4725_handle_t *handle, float s, uint16_t *reg)
convert the dac value to the register data
uint8_t mcp4725_get_addr_pin(mcp4725_handle_t *handle, mcp4725_address_t *addr_pin)
get the chip address pin
uint8_t mcp4725_init(mcp4725_handle_t *handle)
initialize the chip
uint8_t mcp4725_set_reference_voltage(mcp4725_handle_t *handle, float ref_voltage)
set the chip reference voltage
uint8_t mcp4725_set_mode(mcp4725_handle_t *handle, mcp4725_mode_t mode)
set the chip mode
mcp4725_mode_t
mcp4725 mode enumeration definition
uint8_t mcp4725_get_mode(mcp4725_handle_t *handle, mcp4725_mode_t *mode)
get the chip mode
uint8_t mcp4725_set_addr_pin(mcp4725_handle_t *handle, mcp4725_address_t addr_pin)
set the chip address pin
@ MCP4725_POWER_DOWN_MODE_NORMAL
@ MCP4725_POWER_DOWN_MODE_500K_GND
@ MCP4725_POWER_DOWN_MODE_1K_GND
@ MCP4725_POWER_DOWN_MODE_100K_GND
uint8_t mcp4725_set_reg(mcp4725_handle_t *handle, uint8_t *buf, uint16_t len)
set the chip register
uint8_t mcp4725_get_reg(mcp4725_handle_t *handle, uint8_t *buf, uint16_t len)
get the chip register
mcp4725 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
uint8_t(* iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
mcp4725 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v