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"
74 #define DIGIPOT7_COMMAND_NOP 0x00
75 #define DIGIPOT7_COMMAND_WRITE_RDAC 0x04
76 #define DIGIPOT7_COMMAND_READ_RDAC 0x08
77 #define DIGIPOT7_COMMAND_STORE_WIPER 0x0C
78 #define DIGIPOT7_COMMAND_SW_RESET 0x10
79 #define DIGIPOT7_COMMAND_READ_50TP 0x14
80 #define DIGIPOT7_COMMAND_READ_MEMORY 0x18
81 #define DIGIPOT7_COMMAND_WRITE_MEMORY 0x1C
82 #define DIGIPOT7_COMMAND_READ_CONTROL 0x20
83 #define DIGIPOT7_COMMAND_SW_SHUTDOWN 0x24
89 #define DIGIPOT7_SHUTDOWN_BIT_MASK 0x01
90 #define DIGIPOT7_NORMAL_MODE 0x00
91 #define DIGIPOT7_SHUTDOWN_MODE 0x01
97 #define DIGIPOT7_CTRL_REG_BIT_MASK 0x0B
98 #define DIGIPOT7_FUSE_PROGRAM_SUCCESSFUL 0x00
99 #define DIGIPOT7_FUSE_PROGRAM_UNSUCCESSFUL 0x08
100 #define DIGIPOT7_WIPER_POS_FROZEN 0x00
101 #define DIGIPOT7_UPDATE_WIPER_POS 0x02
102 #define DIGIPOT7_50T_PROGRAM_DISABLED 0x00
103 #define DIGIPOT7_50T_PROGRAM_ENABLE 0x01
109 #define DIGIPOT7_10_BIT 0x03FF
110 #define DIGIPOT7_DUMMY 0x0000
117 #define DIGIPOT7_I2C_SLAVE_ADDRESS_GND 0x2F
118 #define DIGIPOT7_I2C_SLAVE_ADDRESS_VCC 0x2C
119 #define DIGIPOT7_I2C_SLAVE_ADDRESS_NC 0x2E
137 #define DIGIPOT7_MAP_MIKROBUS( cfg, mikrobus ) \
138 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
139 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
140 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
void digipot7_hw_reset(digipot7_t *ctx)
Hardware reset function.
uint32_t i2c_speed
Definition: digipot7.h:173
uint16_t digipot7_next_frame_read(digipot7_t *ctx, uint8_t wiper_location)
Next frame read function.
void digipot7_cfg_setup(digipot7_cfg_t *cfg)
DIGI POT 7 configuration object setup function.
pin_name_t rst
Definition: digipot7.h:171
void digipot7_sw_reset(digipot7_t *ctx)
Software reset function.
uint8_t digipot7_read_control(digipot7_t *ctx)
Read control register function.
void digipot7_enable_write(digipot7_t *ctx)
Enable write function.
DIGI POT 7 Click configuration object.
Definition: digipot7.h:167
void digipot7_generic_write(digipot7_t *ctx, uint8_t cmd, uint16_t data_byte)
DIGI POT 7 I2C writing function.
DIGI POT 7 Click context object.
Definition: digipot7.h:150
i2c_master_t i2c
Definition: digipot7.h:155
pin_name_t sda
Definition: digipot7.h:169
err_t digipot7_init(digipot7_t *ctx, digipot7_cfg_t *cfg)
DIGI POT 7 initialization function.
@ DIGIPOT7_OK
Definition: digipot7.h:184
void digipot7_operating_mode(digipot7_t *ctx, uint8_t mode)
Set operating mode function.
void digipot7_write_rdac(digipot7_t *ctx, uint16_t rdac_data)
Write RDAC function.
digital_out_t rst
Definition: digipot7.h:152
@ DIGIPOT7_ERROR
Definition: digipot7.h:185
digipot7_return_value_t
DIGI POT 7 Click return value data.
Definition: digipot7.h:183
uint16_t digipot7_read_rdac(digipot7_t *ctx)
Read RDAC function.
err_t digipot7_set_resistance(digipot7_t *ctx, uint16_t res_ohm)
Set resistance function.
uint8_t slave_address
Definition: digipot7.h:158
uint16_t digipot7_generic_read(digipot7_t *ctx, uint8_t cmd, uint8_t wiper_pos)
DIGI POT 7 I2C reading function.
void digipot7_store_wiper(digipot7_t *ctx)
Store wiper setting function.
uint8_t i2c_address
Definition: digipot7.h:174
pin_name_t scl
Definition: digipot7.h:168
uint16_t digipot7_read_memory(digipot7_t *ctx)
Read memory function.