Go to the documentation of this file.
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 SMARTBUCK2_REG_SET0 0x00
74 #define SMARTBUCK2_REG_SET1 0x01
75 #define SMARTBUCK2_REG_SET2 0x02
76 #define SMARTBUCK2_REG_SET3 0x03
77 #define SMARTBUCK2_REG_CTRL 0x04
78 #define SMARTBUCK2_REG_TEMP 0x05
79 #define SMARTBUCK2_REG_RMPCTRL 0x06
80 #define SMARTBUCK2_REG_CHIP_ID_0 0x08
81 #define SMARTBUCK2_REG_CHIP_ID_1 0x09
99 #define SMARTBUCK2_OP_MOD_BIT_MASK 0x80
100 #define SMARTBUCK2_OP_MODE_FORCED_PWM 0x80
101 #define SMARTBUCK2_OP_MODE_PFM 0x00
107 #define SMARTBUCK2_CTRL_BIT_MASK 0xE0
108 #define SMARTBUCK2_CTRL_PD_EN 0x80
109 #define SMARTBUCK2_CTRL_PD_DIS 0x00
110 #define SMARTBUCK2_CTRL_PD_VSEL0_EN 0x40
111 #define SMARTBUCK2_CTRL_PD_VSEL0_DIS 0x00
112 #define SMARTBUCK2_CTRL_PD_VSEL1_EN 0x20
113 #define SMARTBUCK2_CTRL_PD_VSEL1_DIS 0x00
114 #define SMARTBUCK2_CTRL_PD_VSEL 0x40
120 #define SMARTBUCK2_TEMP_DIS_BIT_MASK 0xFB
121 #define SMARTBUCK2_TEMP_TS_ENABLE 0x00
122 #define SMARTBUCK2_TEMP_TS_DISABLE 0x04
123 #define SMARTBUCK2_TEMP_TJEW 0x02
124 #define SMARTBUCK2_TEMP_TJEW_BIT_MASK 0xFD
125 #define SMARTBUCK2_TEMP_LT_120_C 0x00
126 #define SMARTBUCK2_TEMP_GT_120_C 0x01
127 #define SMARTBUCK2_TEMP_ERROR 0x02
128 #define SMARTBUCK2_TEMP_TJTS 0x01
134 #define SMARTBUCK2_RMP_VTG_T_BIT_MASK 0xE0
135 #define SMARTBUCK2_RMP_SET 0xE0
136 #define SMARTBUCK2_RMP_EN_DISC 0x04
137 #define SMARTBUCK2_RMP_PFM 0x02
138 #define SMARTBUCK2_RMP_VTG_T_32MVNS 0x00
139 #define SMARTBUCK2_RMP_VTG_T_16MVNS 0x01
140 #define SMARTBUCK2_RMP_VTG_T_8MVNS 0x02
141 #define SMARTBUCK2_RMP_VTG_T_4MVNS 0x03
142 #define SMARTBUCK2_RMP_VTG_T_2MVNS 0x04
143 #define SMARTBUCK2_RMP_VTG_T_1MVNS 0x05
144 #define SMARTBUCK2_RMP_VTG_T_0_5MVNS 0x06
145 #define SMARTBUCK2_RMP_VTG_T_0_25MVNS 0x07
151 #define SMARTBUCK2_VENDOR_ID_BIT_MASK 0xF0
152 #define SMARTBUCK2_ID_VENDOR 0x80
153 #define SMARTBUCK2_PART_NUM_ID_BIT_MASK 0x0C
154 #define SMARTBUCK2_ID_PART_NUM 0x03
155 #define SMARTBUCK2_CHIP_REV_ID_BIT_MASK 0x03
161 #define SMARTBUCK2_VOUT_MIN 500u
162 #define SMARTBUCK2_VOUT_MAX 1770u
163 #define SMARTBUCK2_VOUT_STEP_10MV 10u
164 #define SMARTBUCK2_VOUT_START_500MV 500u
171 #define SMARTBUCK2_DEVICE_ADDRESS 0x60
189 #define SMARTBUCK2_MAP_MIKROBUS( cfg, mikrobus ) \
190 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
191 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
463 #endif // SMARTBUCK2_H
@ SMARTBUCK2_ERROR
Definition: smartbuck2.h:231
err_t smartbuck2_set_ctrl(smartbuck2_t *ctx, uint8_t ctrl)
Smart Buck 2 set control function.
pin_name_t scl
Definition: smartbuck2.h:216
Smart Buck 2 Click configuration object.
Definition: smartbuck2.h:215
smartbuck2_return_value_t
Smart Buck 2 Click return value data.
Definition: smartbuck2.h:229
uint8_t smartbuck2_check_temp_warning(smartbuck2_t *ctx)
Smart Buck 2 check temperature warning function.
uint8_t slave_address
Definition: smartbuck2.h:206
uint8_t i2c_address
Definition: smartbuck2.h:220
err_t smartbuck2_get_voltage(smartbuck2_t *ctx, uint16_t *vout_mv)
Smart Buck 2 get voltage function.
err_t smartbuck2_get_op_mode(smartbuck2_t *ctx, uint8_t *op_mode)
Smart Buck 2 get operation mode function.
err_t smartbuck2_set_op_mode(smartbuck2_t *ctx, uint8_t op_mode)
Smart Buck 2 set operation mode function.
err_t smartbuck2_set_voltage(smartbuck2_t *ctx, uint16_t vout_mv)
Smart Buck 2 set voltage function.
Smart Buck 2 Click context object.
Definition: smartbuck2.h:201
pin_name_t sda
Definition: smartbuck2.h:217
i2c_master_t i2c
Definition: smartbuck2.h:203
uint32_t i2c_speed
Definition: smartbuck2.h:219
@ SMARTBUCK2_OK
Definition: smartbuck2.h:230
err_t smartbuck2_set_temp_shd(smartbuck2_t *ctx, uint8_t temp_enable)
Smart Buck 2 set temperature shutdown function.
void smartbuck2_cfg_setup(smartbuck2_cfg_t *cfg)
Smart Buck 2 configuration object setup function.
err_t smartbuck2_generic_write(smartbuck2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Smart Buck 2 I2C writing function.
err_t smartbuck2_set_vtg_ramp_timing(smartbuck2_t *ctx, uint8_t slope)
Smart Buck 2 set voltage ramp timing function.
err_t smartbuck2_init(smartbuck2_t *ctx, smartbuck2_cfg_t *cfg)
Smart Buck 2 initialization function.
err_t smartbuck2_generic_read(smartbuck2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Smart Buck 2 I2C reading function.
err_t smartbuck2_default_cfg(smartbuck2_t *ctx)
Smart Buck 2 default configuration function.
err_t smartbuck2_get_device_id(smartbuck2_t *ctx, uint8_t *ven_id, uint8_t *part_num_id, uint8_t *chip_id)
Smart Buck 2 get device ID function.