39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define EFUSE2_AD5175_SHUTDOWN_BIT_MASK 0x01
74#define EFUSE2_AD5175_NORMAL_MODE 0x00
75#define EFUSE2_AD5175_SHUTDOWN_MODE 0x01
81#define EFUSE2_AD5175_CTRL_REG_BIT_MASK 0x0B
82#define EFUSE2_AD5175_FUSE_PROGRAM_SUCCESSFUL 0x00
83#define EFUSE2_AD5175_FUSE_PROGRAM_UNSUCCESSFUL 0x08
84#define EFUSE2_AD5175_WIPER_POS_FROZEN 0x00
85#define EFUSE2_AD5175_UPDATE_WIPER_POS 0x02
86#define EFUSE2_AD5175_50T_PROGRAM_DISABLED 0x00
87#define EFUSE2_AD5175_50T_PROGRAM_ENABLE 0x01
93#define EFUSE2_AD5175_COMMAND_NOP 0x00
94#define EFUSE2_AD5175_COMMAND_WRITE_RDAC 0x04
95#define EFUSE2_AD5175_COMMAND_READ_RDAC 0x08
96#define EFUSE2_AD5175_COMMAND_STORE_WIPER 0x0C
97#define EFUSE2_AD5175_COMMAND_SW_RESET 0x10
98#define EFUSE2_AD5175_COMMAND_READ_50TP 0x14
99#define EFUSE2_AD5175_COMMAND_READ_MEMORY 0x18
100#define EFUSE2_AD5175_COMMAND_WRITE_MEMORY 0x1C
101#define EFUSE2_AD5175_COMMAND_READ_CONTROL 0x20
102#define EFUSE2_AD5175_COMMAND_SW_SHUTDOWN 0x24
104#define EFUSE2_AD5241_RDAC0 0x00
105#define EFUSE2_AD5241_RDAC1 0x80
106#define EFUSE2_AD5241_NO_RESET 0x00
107#define EFUSE2_AD5241_RESET 0x40
108#define EFUSE2_AD5241_NO_SHUTDOWN 0x00
109#define EFUSE2_AD5241_SHUTDOWN 0x20
110#define EFUSE2_AD5241_O1_LOW 0x00
111#define EFUSE2_AD5241_O1_HIGH 0x10
112#define EFUSE2_AD5241_O2_LOW 0x00
113#define EFUSE2_AD5241_O2_HIGH 0x08
120#define EFUSE2_I2C_SLAVE_ADDRESS_AD5241_0 0x2C
121#define EFUSE2_I2C_SLAVE_ADDRESS_AD5241_1 0x2D
122#define EFUSE2_I2C_SLAVE_ADDRESS_AD5241_2 0x2E
123#define EFUSE2_I2C_SLAVE_ADDRESS_AD5241_3 0x2F
124#define EFUSE2_I2C_SLAVE_ADDRESS_AD5175_GND 0x2F
125#define EFUSE2_I2C_SLAVE_ADDRESS_AD5175_VCC 0x2C
126#define EFUSE2_I2C_SLAVE_ADDRESS_AD5175_NC 0x2E
132#define EFUSE2_FAULT 0x00
133#define EFUSE2_NO_FAULT 0x01
139#define EFUSE2_10_BIT 0x03FF
140#define EFUSE2_DUMMY 0x0000
159#define EFUSE2_MAP_MIKROBUS( cfg, mikrobus ) \
160 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
161 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
162 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
163 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT )
efuse2_return_value_t
eFuse 2 Click return value data.
Definition efuse2.h:226
@ EFUSE2_OK
Definition efuse2.h:227
@ EFUSE2_ERROR
Definition efuse2.h:228
void efuse2_hw_reset(efuse2_t *ctx)
Hardware reset function.
err_t efuse2_set_current_limit(efuse2_t *ctx, float current)
Set operating current function.
err_t efuse2_write_rdac(efuse2_t *ctx, uint16_t data_byte)
Write RDAC function.
err_t efuse2_set_operating_voltage(efuse2_t *ctx, float voltage, float *min_voltage, float *max_voltage)
Set operating voltage function.
uint16_t efuse2_read_rdac(efuse2_t *ctx)
Read RDAC function.
err_t efuse2_sw_reset(efuse2_t *ctx)
Software reset function.
err_t efuse2_init(efuse2_t *ctx, efuse2_cfg_t *cfg)
eFuse 2 initialization function.
uint16_t efuse2_read_memory(efuse2_t *ctx)
Read memory function.
uint16_t efuse2_read_ad5175(efuse2_t *ctx, uint8_t cmd, uint8_t wiper_location)
Generic read data from the AD5175 function.
err_t efuse2_store_wiper(efuse2_t *ctx)
Store wiper setting function.
uint8_t efuse2_read_ad5241(efuse2_t *ctx)
Generic read data from the AD5241 function.
uint16_t efuse2_next_frame_read(efuse2_t *ctx, uint8_t wiper_location)
Next frame read function.
void efuse2_cfg_setup(efuse2_cfg_t *cfg)
eFuse 2 configuration object setup function.
uint8_t efuse2_get_fault(efuse2_t *ctx)
Get fault function.
err_t efuse2_write_ad5241(efuse2_t *ctx, ad5241_instru_t cmd, uint8_t data_byte)
Generic write data to the AD5241 function.
err_t efuse2_default_cfg(efuse2_t *ctx)
eFuse 2 default configuration function.
err_t efuse2_enable_write(efuse2_t *ctx)
Enable write function.
uint8_t efuse2_read_control(efuse2_t *ctx)
Read control register function.
err_t efuse2_operating_mode(efuse2_t *ctx, uint8_t mode)
Set operating mode function.
err_t efuse2_write_ad5175(efuse2_t *ctx, uint8_t cmd, uint16_t data_byte)
Generic write data to the AD5175 function.
float max_voltage
Definition main.c:41
float min_voltage
Definition main.c:40
eFuse 2 Click instruction object.
Definition efuse2.h:212
uint8_t output_logic_pin_2
Definition efuse2.h:217
uint8_t midscale_reset
Definition efuse2.h:214
uint8_t active_shutdown
Definition efuse2.h:215
uint8_t select_rdac
Definition efuse2.h:213
uint8_t output_logic_pin_1
Definition efuse2.h:216
eFuse 2 Click configuration object.
Definition efuse2.h:194
uint8_t i2c_address_ad5175
Definition efuse2.h:202
uint32_t i2c_speed
Definition efuse2.h:201
uint8_t i2c_address_ad5241
Definition efuse2.h:203
pin_name_t flt
Definition efuse2.h:199
pin_name_t scl
Definition efuse2.h:195
pin_name_t sda
Definition efuse2.h:196
pin_name_t rst
Definition efuse2.h:198
eFuse 2 Click context object.
Definition efuse2.h:173
digital_in_t flt
Definition efuse2.h:178
uint8_t slave_address_ad5241
Definition efuse2.h:185
uint8_t slave_address_ad5175
Definition efuse2.h:184
i2c_master_t i2c
Definition efuse2.h:181
digital_out_t rst
Definition efuse2.h:175