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 STEPDOWN11_ADDR_BIT_READ_INPUT_REG 0x00
74#define STEPDOWN11_ADDR_BIT_READ_EEPROM 0x01
75#define STEPDOWN11_ADDR_BIT_READ_CTRL_REG 0x02
76#define STEPDOWN11_ADDR_BIT_READ_RDAC 0x03
77#define STEPDOWN11_ADDR_BIT_RDAC_DECR 0x00
78#define STEPDOWN11_ADDR_BIT_RDAC_INCR 0x01
79#define STEPDOWN11_ADDR_BIT_COPY_TO_RDAC 0x00
80#define STEPDOWN11_ADDR_BIT_COPY_TO_EEPROM 0x01
81#define STEPDOWN11_ADDR_BIT_SCALE_MODE_NORMAL 0x80
82#define STEPDOWN11_ADDR_BIT_SCALE_MODE_SHDN 0x81
83#define STEPDOWN11_ADDR_BIT_SCALE_EXIT 0x00
84#define STEPDOWN11_ADDR_BIT_SCALE_ENTER 0x01
85#define STEPDOWN11_ADDR_BIT_SW_SHDN_MODE_NORMAL 0x00
86#define STEPDOWN11_ADDR_BIT_SW_SHDN_MODE_SHDN 0x01
104#define STEPDOWN11_CTRL_BIT_NOP 0x00
105#define STEPDOWN11_CTRL_BIT_WRITE_RDAC 0x10
106#define STEPDOWN11_CTRL_BIT_WRITE_SHIFT_REG 0x20
107#define STEPDOWN11_CTRL_BIT_READ 0x30
108#define STEPDOWN11_CTRL_BIT_LIN_RDAC 0x40
109#define STEPDOWN11_CTRL_BIT_6_DB_RDAC 0x50
110#define STEPDOWN11_CTRL_BIT_COPY_LRDAC 0x60
111#define STEPDOWN11_CTRL_BIT_COPY_RDAC_EEPROM 0x70
112#define STEPDOWN11_CTRL_BIT_WRITE_EEPROM 0x80
113#define STEPDOWN11_CTRL_BIT_SCALE 0x90
114#define STEPDOWN11_CTRL_BIT_SW_RST 0xB0
115#define STEPDOWN11_CTRL_BIT_SW_SHDN 0xC0
116#define STEPDOWN11_CTRL_BIT_REG_CTRL 0xD0
117#define STEPDOWN11_CTRL_BIT_MASK 0xF0
123#define STEPDOWN11_WIPER_SEL_1 0x00
124#define STEPDOWN11_WIPER_SEL_2 0x01
125#define STEPDOWN11_WIPER_SEL_BOTH 0x08
131#define STEPDOWN11_S_CONF_1MHZ_SPREAD_OFF 0
132#define STEPDOWN11_S_CONF_2_2MHZ_SPREAD_OFF 4870
133#define STEPDOWN11_S_CONF_2_2MHZ_SPREAD_TRIANGLE 6040
134#define STEPDOWN11_S_CONF_2_2MHZ_SPREAD_RANDOM 7500
140#define STEPDOWN11_WIPER_POS_MAX 255
141#define STEPDOWN11_WIPER_POS_MIN 0
142#define STEPDOWN11_WIPER_POS_MIDDLE 127
143#define STEPDOWN11_RES_10_KOHM 10000
144#define STEPDOWN11_RES_0_KOHM 0
145#define STEPDOWN11_R_5_RESISTANCE 2700
146#define STEPDOWN11_R_9_RESISTANCE 10
147#define STEPDOWN11_VFB_VALUE 0.8f
153#define STEPDOWN11_ENABLE_OUTPUT 0x01
154#define STEPDOWN11_DISABLE_OUTPUT 0x00
161#define STEPDOWN11_DEVICE_ADDRESS_0 0x2F
162#define STEPDOWN11_DEVICE_ADDRESS_1 0x2C
163#define STEPDOWN11_DEVICE_ADDRESS_2 0x23
164#define STEPDOWN11_DEVICE_ADDRESS_3 0x20
182#define STEPDOWN11_MAP_MIKROBUS( cfg, mikrobus ) \
183 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
184 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
185 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
186 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
187 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t stepdown11_init(stepdown11_t *ctx, stepdown11_cfg_t *cfg)
Step Down 11 initialization function.
err_t stepdown11_write_rdac(stepdown11_t *ctx, uint8_t addr, uint8_t data_in)
Step Down 11 write the RDAC function.
uint8_t stepdown11_get_pg_pin(stepdown11_t *ctx)
Step Down 11 get PG pin state function.
err_t stepdown11_generic_write(stepdown11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Step Down 11 I2C writing function.
err_t stepdown11_set_mode(stepdown11_t *ctx, float sconf_mode)
Step Down 11 set S-CONF device configuration mode function.
void stepdown11_cfg_setup(stepdown11_cfg_t *cfg)
Step Down 11 configuration object setup function.
void stepdown11_reset_digi_pot(stepdown11_t *ctx)
Step Down 11 reset digi pot function.
err_t stepdown11_get_resistance(stepdown11_t *ctx, uint8_t wiper_sel, float *res_kohm)
Step Down 11 get the resistance function.
err_t stepdown11_write_data(stepdown11_t *ctx, uint8_t ctrl, uint8_t addr, uint8_t data_in)
Step Down 11 I2C writing function.
err_t stepdown11_read_data(stepdown11_t *ctx, uint8_t addr, uint8_t mask, uint8_t *data_out)
Step Down 11 I2C reading function.
err_t stepdown11_default_cfg(stepdown11_t *ctx)
Step Down 11 default configuration function.
err_t stepdown11_set_resistance(stepdown11_t *ctx, uint8_t wiper_sel, float res_kohm)
Step Down 11 set the resistance function.
void stepdown11_set_en_pin(stepdown11_t *ctx, uint8_t pin_state)
Step Down 11 set EN pin state function.
err_t stepdown11_generic_read(stepdown11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Step Down 11 I2C reading function.
err_t stepdown11_set_voltage(stepdown11_t *ctx, float v_out)
Step Down 11 set voltage output function.
err_t stepdown11_read_rdac(stepdown11_t *ctx, uint8_t addr, uint8_t *data_out)
Step Down 11 read the RDAC function.
stepdown11_return_value_t
Step Down 11 Click return value data.
Definition stepdown11.h:236
@ STEPDOWN11_OK
Definition stepdown11.h:237
@ STEPDOWN11_ERROR
Definition stepdown11.h:238
Step Down 11 Click configuration object.
Definition stepdown11.h:218
uint32_t i2c_speed
Definition stepdown11.h:226
pin_name_t scl
Definition stepdown11.h:219
pin_name_t en
Definition stepdown11.h:223
pin_name_t sda
Definition stepdown11.h:220
pin_name_t pg
Definition stepdown11.h:224
pin_name_t rst
Definition stepdown11.h:222
uint8_t i2c_address
Definition stepdown11.h:227
Step Down 11 Click context object.
Definition stepdown11.h:197
i2c_master_t i2c
Definition stepdown11.h:206
digital_out_t en
Definition stepdown11.h:200
digital_out_t rst
Definition stepdown11.h:199
uint8_t slave_address
Definition stepdown11.h:209
digital_in_t pg
Definition stepdown11.h:203