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 SMARTBUCK4_REG_R600A_PROGRAM 0x80
74#define SMARTBUCK4_REG_R400A_PROGRAM 0x40
75#define SMARTBUCK4_REG_R600B_PROGRAM 0x20
76#define SMARTBUCK4_REG_R400B_PROGRAM 0x10
77#define SMARTBUCK4_REG_PULSE_SKIP_MODE 0x00
78#define SMARTBUCK4_REG_LDO_MODE 0x01
79#define SMARTBUCK4_REG_FORCED_BURST_MODE 0x02
80#define SMARTBUCK4_REG_BURST_MODE 0x03
98#define SMARTBUCK4_PIN_STATE_LOW 0x00
99#define SMARTBUCK4_PIN_STATE_HIGH 0x01
105#define SMARTBUCK4_ENABLE_REGULATOR 0x80
106#define SMARTBUCK4_DISABLE_REGULATOR 0x00
113#define SMARTBUCK4_REGULATOR_A_FB_425_MV 0x00
114#define SMARTBUCK4_REGULATOR_A_FB_450_MV 0x01
115#define SMARTBUCK4_REGULATOR_A_FB_475_MV 0x02
116#define SMARTBUCK4_REGULATOR_A_FB_500_MV 0x03
117#define SMARTBUCK4_REGULATOR_A_FB_525_MV 0x04
118#define SMARTBUCK4_REGULATOR_A_FB_550_MV 0x05
119#define SMARTBUCK4_REGULATOR_A_FB_575_MV 0x06
120#define SMARTBUCK4_REGULATOR_A_FB_600_MV 0x07
121#define SMARTBUCK4_REGULATOR_A_FB_625_MV 0x08
122#define SMARTBUCK4_REGULATOR_A_FB_650_MV 0x09
123#define SMARTBUCK4_REGULATOR_A_FB_675_MV 0x0A
124#define SMARTBUCK4_REGULATOR_A_FB_700_MV 0x0B
125#define SMARTBUCK4_REGULATOR_A_FB_725_MV 0x0C
126#define SMARTBUCK4_REGULATOR_A_FB_750_MV 0x0D
127#define SMARTBUCK4_REGULATOR_A_FB_775_MV 0x0E
128#define SMARTBUCK4_REGULATOR_A_FB_800_MV 0x0F
135#define SMARTBUCK4_REGULATOR_B_600_MV 0x00
136#define SMARTBUCK4_REGULATOR_B_700_MV 0x04
137#define SMARTBUCK4_REGULATOR_B_800_MV 0x08
138#define SMARTBUCK4_REGULATOR_B_900_MV 0x0C
139#define SMARTBUCK4_REGULATOR_B_1000_MV 0x10
140#define SMARTBUCK4_REGULATOR_B_1100_MV 0x14
141#define SMARTBUCK4_REGULATOR_B_1200_MV 0x18
142#define SMARTBUCK4_REGULATOR_B_1300_MV 0x1C
143#define SMARTBUCK4_REGULATOR_B_1400_MV 0x20
144#define SMARTBUCK4_REGULATOR_B_1500_MV 0x24
145#define SMARTBUCK4_REGULATOR_B_1600_MV 0x28
146#define SMARTBUCK4_REGULATOR_B_1700_MV 0x2C
147#define SMARTBUCK4_REGULATOR_B_1800_MV 0x30
148#define SMARTBUCK4_REGULATOR_B_1900_MV 0x34
149#define SMARTBUCK4_REGULATOR_B_2000_MV 0x38
150#define SMARTBUCK4_REGULATOR_B_2100_MV 0x3C
151#define SMARTBUCK4_REGULATOR_B_2200_MV 0x40
152#define SMARTBUCK4_REGULATOR_B_2300_MV 0x44
153#define SMARTBUCK4_REGULATOR_B_2400_MV 0x48
154#define SMARTBUCK4_REGULATOR_B_2500_MV 0x4C
155#define SMARTBUCK4_REGULATOR_B_2600_MV 0x50
156#define SMARTBUCK4_REGULATOR_B_2700_MV 0x54
157#define SMARTBUCK4_REGULATOR_B_2800_MV 0x58
158#define SMARTBUCK4_REGULATOR_B_2900_MV 0x5C
159#define SMARTBUCK4_REGULATOR_B_3000_MV 0x60
160#define SMARTBUCK4_REGULATOR_B_3100_MV 0x64
161#define SMARTBUCK4_REGULATOR_B_3200_MV 0x68
162#define SMARTBUCK4_REGULATOR_B_3300_MV 0x6C
163#define SMARTBUCK4_REGULATOR_B_3400_MV 0x70
164#define SMARTBUCK4_REGULATOR_B_3500_MV 0x74
165#define SMARTBUCK4_REGULATOR_B_3600_MV 0x78
166#define SMARTBUCK4_REGULATOR_B_3700_MV 0x7C
173#define SMARTBUCK4_REGULATOR_B_INC_0_MV 0x00
174#define SMARTBUCK4_REGULATOR_B_INC_25_MV 0x01
175#define SMARTBUCK4_REGULATOR_B_INC_50_MV 0x02
176#define SMARTBUCK4_REGULATOR_B_INC_75_MV 0x03
183#define SMARTBUCK4_DEVICE_ADDRESS 0x65
201#define SMARTBUCK4_MAP_MIKROBUS( cfg, mikrobus ) \
202 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
203 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
204 cfg.r40 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
205 cfg.r60 = MIKROBUS( mikrobus, MIKROBUS_PWM )
err_t smartbuck4_disable_regulators(smartbuck4_t *ctx)
Smart Buck 4 disable regulators function.
err_t smartbuck4_send_command(smartbuck4_t *ctx, uint8_t addr, uint8_t data_in)
Smart Buck 4 send command function.
err_t smartbuck4_init(smartbuck4_t *ctx, smartbuck4_cfg_t *cfg)
Smart Buck 4 initialization function.
err_t smartbuck4_default_cfg(smartbuck4_t *ctx)
Smart Buck 4 default configuration function.
void smartbuck4_set_r60_out(smartbuck4_t *ctx, uint8_t out_level)
Smart Buck 4 set R60 pin state function.
void smartbuck4_en_r60_reg(smartbuck4_t *ctx)
Smart Buck 4 enable 600A regulator function.
void smartbuck4_dis_r60_reg(smartbuck4_t *ctx)
Smart Buck 4 disable 600A regulator function.
void smartbuck4_set_r40_out(smartbuck4_t *ctx, uint8_t out_level)
Smart Buck 4 set R40 pin state function.
void smartbuck4_en_r40_reg(smartbuck4_t *ctx)
Smart Buck 4 enable 400A regulator function.
void smartbuck4_cfg_setup(smartbuck4_cfg_t *cfg)
Smart Buck 4 configuration object setup function.
void smartbuck4_dis_r40_reg(smartbuck4_t *ctx)
Smart Buck 4 disable 400A regulator function.
smartbuck4_return_value_t
Smart Buck 4 Click return value data.
Definition smartbuck4.h:250
@ SMARTBUCK4_OK
Definition smartbuck4.h:251
@ SMARTBUCK4_ERROR
Definition smartbuck4.h:252
Smart Buck 4 Click configuration object.
Definition smartbuck4.h:233
uint32_t i2c_speed
Definition smartbuck4.h:240
pin_name_t r60
Definition smartbuck4.h:238
pin_name_t scl
Definition smartbuck4.h:234
pin_name_t sda
Definition smartbuck4.h:235
pin_name_t r40
Definition smartbuck4.h:237
uint8_t i2c_address
Definition smartbuck4.h:241
Smart Buck 4 Click context object.
Definition smartbuck4.h:215
digital_out_t r40
Definition smartbuck4.h:217
i2c_master_t i2c
Definition smartbuck4.h:221
digital_out_t r60
Definition smartbuck4.h:218
uint8_t slave_address
Definition smartbuck4.h:224