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 BUCK23_REG_ID 0x00
74#define BUCK23_REG_VIDMAX 0x02
75#define BUCK23_REG_STATUS 0x04
76#define BUCK23_REG_CONFIG 0x05
77#define BUCK23_REG_SLEW 0x06
78#define BUCK23_REG_VID 0x07
96#define BUCK23_DEVICE_ID 0x03
102#define BUCK23_VIDMAX_UNCAPPED 0x4E
108#define BUCK23_CONFIG_VSTEP_10 0x00
109#define BUCK23_CONFIG_VSTEP_12_5 0x80
110#define BUCK23_CONFIG_VSTEP_MASK 0x80
111#define BUCK23_CONFIG_MODE_SYNC 0x00
112#define BUCK23_CONFIG_MODE_FPWM 0x08
113#define BUCK23_CONFIG_MODE_MASK 0x08
114#define BUCK23_CONFIG_SS_DIS 0x00
115#define BUCK23_CONFIG_SS_3_PCT_SPREAD 0x04
116#define BUCK23_CONFIG_SS_MASK 0x04
117#define BUCK23_CONFIG_SYNC_IO_IN_RISE 0x00
118#define BUCK23_CONFIG_SYNC_IO_IN_FALL 0x01
119#define BUCK23_CONFIG_SYNC_IO_OUT_FALL 0x02
120#define BUCK23_CONFIG_SYNC_IO_MASK 0x03
126#define BUCK23_STATUS_INTERR 0x80
127#define BUCK23_STATUS_VRHOT 0x20
128#define BUCK23_STATUS_UV 0x10
129#define BUCK23_STATUS_OV 0x08
130#define BUCK23_STATUS_OC 0x04
131#define BUCK23_STATUS_VMERR 0x02
137#define BUCK23_SLEW_SS_22_DVS_22 0x00
138#define BUCK23_SLEW_SS_11_DVS_22 0x01
139#define BUCK23_SLEW_SS_5_5_DVS_22 0x02
140#define BUCK23_SLEW_SS_11_DVS_11 0x03
141#define BUCK23_SLEW_SS_5_5_DVS_11 0x04
142#define BUCK23_SLEW_SS_44_DVS_44 0x05
143#define BUCK23_SLEW_SS_22_DVS_44 0x06
144#define BUCK23_SLEW_SS_11_DVS_44 0x07
145#define BUCK23_SLEW_SS_5_5_DVS_44 0x08
146#define BUCK23_SLEW_SS_5_5_DVS_5_5 0x09
147#define BUCK23_SLEW_MASK 0x0F
153#define BUCK23_VSTEP_10 0
154#define BUCK23_VSTEP_12_5 1
160#define BUCK23_VID_MIN 0x01
161#define BUCK23_VID_MAX 0x4E
162#define BUCK23_VOUT_MIN_VSTEP_10 500u
163#define BUCK23_VOUT_MAX_VSTEP_10 1270u
164#define BUCK23_VOUT_MIN_VSTEP_12_5 625u
165#define BUCK23_VOUT_MAX_VSTEP_12_5 1587u
166#define BUCK23_VOUT_RES_VSTEP_10 10.0f
167#define BUCK23_VOUT_RES_VSTEP_12_5 12.5f
174#define BUCK23_DEVICE_ADDRESS_0 0x38
175#define BUCK23_DEVICE_ADDRESS_1 0x39
193#define BUCK23_MAP_MIKROBUS( cfg, mikrobus ) \
194 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
195 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
196 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
197 cfg.sync = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
198 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
buck23_return_value_t
Buck 23 Click return value data.
Definition buck23.h:249
@ BUCK23_OK
Definition buck23.h:250
@ BUCK23_ERROR
Definition buck23.h:251
err_t buck23_default_cfg(buck23_t *ctx)
Buck 23 default configuration function.
err_t buck23_write_register(buck23_t *ctx, uint8_t reg, uint8_t data_in)
Buck 23 write register function.
void buck23_restart_device(buck23_t *ctx)
Buck 23 restart device function.
void buck23_set_sync_pin(buck23_t *ctx, uint8_t state)
Buck 23 set sync pin function.
err_t buck23_init(buck23_t *ctx, buck23_cfg_t *cfg)
Buck 23 initialization function.
void buck23_enable_device(buck23_t *ctx)
Buck 23 enable device function.
uint8_t buck23_get_pg_pin(buck23_t *ctx)
Buck 23 get pg pin function.
void buck23_cfg_setup(buck23_cfg_t *cfg)
Buck 23 configuration object setup function.
err_t buck23_set_vout(buck23_t *ctx, uint16_t vout_mv)
Buck 23 set vout function.
void buck23_disable_device(buck23_t *ctx)
Buck 23 disable device function.
err_t buck23_check_communication(buck23_t *ctx)
Buck 23 check communication function.
err_t buck23_set_vstep(buck23_t *ctx, uint8_t vstep)
Buck 23 set vstep function.
err_t buck23_read_register(buck23_t *ctx, uint8_t reg, uint8_t *data_out)
Buck 23 read register function.
Buck 23 Click configuration object.
Definition buck23.h:231
pin_name_t sync
Definition buck23.h:236
uint32_t i2c_speed
Definition buck23.h:239
pin_name_t scl
Definition buck23.h:232
pin_name_t en
Definition buck23.h:235
pin_name_t sda
Definition buck23.h:233
pin_name_t pg
Definition buck23.h:237
uint8_t i2c_address
Definition buck23.h:240
Buck 23 Click context object.
Definition buck23.h:208
digital_out_t sync
Definition buck23.h:211
uint8_t vstep
Definition buck23.h:222
i2c_master_t i2c
Definition buck23.h:217
digital_out_t en
Definition buck23.h:210
uint8_t slave_address
Definition buck23.h:220
digital_in_t pg
Definition buck23.h:214