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 DIGIPOT14_VOLATILE_REG_WRA 0x00
70 #define DIGIPOT14_VOLATILE_REG_WRB 0x01
71 #define DIGIPOT14_VOLATILE_REG_ACR 0x10
72 #define DIGIPOT14_NON_VOLATILE_REG_IVRA 0x00
73 #define DIGIPOT14_NON_VOLATILE_REG_IVRB 0x01
91 #define DIGIPOT14_VOLATILE_REG_WRITE 0x80
92 #define DIGIPOT14_NON_VOLATILE_REG_WRITE 0x00
93 #define DIGIPOT14_DISABLE_SHUT_DOWN 0x40
94 #define DIGIPOT14_ENABLE_SHUT_DOWN 0x00
95 #define DIGIPOT14_NON_VOLATILE_WR_IN_PROGRESS 0x20
96 #define DIGIPOT14_NON_VOLATILE_WR_NOT_IN_PROGRESS 0x00
98 #define DIGIPOT14_MAX_RESISTANCE_KOHM 100.0
99 #define DIGIPOT14_MAX_POSITION 255
100 #define DIGIPOT14_MAX_POSITION_NUM 256.0
101 #define DIGIPOT14_MIN_POSITION 0
108 #define DIGIPOT14_DEVICE_ADDRESS_000 0x50
109 #define DIGIPOT14_DEVICE_ADDRESS_001 0x51
110 #define DIGIPOT14_DEVICE_ADDRESS_010 0x52
111 #define DIGIPOT14_DEVICE_ADDRESS_011 0x53
112 #define DIGIPOT14_DEVICE_ADDRESS_100 0x54
113 #define DIGIPOT14_DEVICE_ADDRESS_101 0x55
114 #define DIGIPOT14_DEVICE_ADDRESS_110 0x56
115 #define DIGIPOT14_DEVICE_ADDRESS_111 0x57
133 #define DIGIPOT14_MAP_MIKROBUS( cfg, mikrobus ) \
134 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
135 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
320 #endif // DIGIPOT14_H
void digipot14_cfg_setup(digipot14_cfg_t *cfg)
DIGI POT 14 configuration object setup function.
err_t digipot14_generic_read(digipot14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
DIGI POT 14 I2C reading function.
digipot14_return_value_t
DIGI POT 14 Click return value data.
Definition: digipot14.h:173
uint32_t i2c_speed
Definition: digipot14.h:163
err_t digipot14_generic_write(digipot14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
DIGI POT 14 I2C writing function.
err_t digipot14_default_cfg(digipot14_t *ctx)
DIGI POT 14 default configuration function.
DIGI POT 14 Click context object.
Definition: digipot14.h:145
uint8_t i2c_address
Definition: digipot14.h:164
i2c_master_t i2c
Definition: digipot14.h:147
pin_name_t scl
Definition: digipot14.h:160
err_t digipot14_set_pot_b_wiper(digipot14_t *ctx, uint8_t wiper_pos)
DIGI POT 14 set the wiper position of potentiometer B function.
uint8_t slave_address
Definition: digipot14.h:150
err_t digipot14_set_pot_a_wiper(digipot14_t *ctx, uint8_t wiper_pos)
DIGI POT 14 set the wiper position of potentiometer A function.
pin_name_t sda
Definition: digipot14.h:161
err_t digipot14_reg_write(digipot14_t *ctx, uint8_t reg, uint8_t data_in)
DIGI POT 14 register write function.
err_t digipot14_reg_read(digipot14_t *ctx, uint8_t reg, uint8_t *data_out)
DIGI POT 14 register reading function.
DIGI POT 14 Click configuration object.
Definition: digipot14.h:159
@ DIGIPOT14_OK
Definition: digipot14.h:174
err_t digipot14_init(digipot14_t *ctx, digipot14_cfg_t *cfg)
DIGI POT 14 initialization function.
@ DIGIPOT14_ERROR
Definition: digipot14.h:175