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 BUCK22_REG_VOUT 0x01
74#define BUCK22_REG_CONTROL 0x03
75#define BUCK22_REG_STATUS 0x05
93#define BUCK22_VOUT_MIN 800
94#define BUCK22_VOUT_MAX 3350
95#define BUCK22_VOLTAGE_FACTOR 2
96#define BUCK22_VOUT_RESOLUTION ( 5 * BUCK22_VOLTAGE_FACTOR )
102#define BUCK22_CONTROL_RESET 0x80
103#define BUCK22_CONTROL_FPWM_VOUT_CHANGE 0x40
104#define BUCK22_CONTROL_SOFT_EN 0x20
105#define BUCK22_CONTROL_FPWM_EN 0x10
106#define BUCK22_CONTROL_DISCHARGE_EN 0x08
107#define BUCK22_CONTROL_HICCUP_EN 0x04
108#define BUCK22_CONTROL_VRAMP_SPEED_20 0x00
109#define BUCK22_CONTROL_VRAMP_SPEED_10 0x01
110#define BUCK22_CONTROL_VRAMP_SPEED_5 0x02
111#define BUCK22_CONTROL_VRAMP_SPEED_1 0x03
112#define BUCK22_CONTROL_VRAMP_SPEED_MASK 0x03
113#define BUCK22_CONTROL_DEFAULT_SETTING ( BUCK22_CONTROL_FPWM_VOUT_CHANGE | \
114 BUCK22_CONTROL_SOFT_EN | \
115 BUCK22_CONTROL_DISCHARGE_EN | \
116 BUCK22_CONTROL_HICCUP_EN | \
117 BUCK22_CONTROL_VRAMP_SPEED_1 )
123#define BUCK22_STATUS_THERMAL_WARNING 0x10
124#define BUCK22_STATUS_HICCUP 0x08
125#define BUCK22_STATUS_UVLO 0x01
132#define BUCK22_DEVICE_ADDRESS 0x42
150#define BUCK22_MAP_MIKROBUS( cfg, mikrobus ) \
151 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
152 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
153 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
buck22_return_value_t
Buck 22 Click return value data.
Definition buck22.h:196
@ BUCK22_OK
Definition buck22.h:197
@ BUCK22_ERROR
Definition buck22.h:198
err_t buck22_set_control(buck22_t *ctx, uint8_t control)
Buck 22 set control function.
void buck22_cfg_setup(buck22_cfg_t *cfg)
Buck 22 configuration object setup function.
uint8_t buck22_get_pg_pin(buck22_t *ctx)
Buck 22 get pg pin function.
err_t buck22_read_status(buck22_t *ctx, uint8_t *status)
Buck 22 read status function.
err_t buck22_init(buck22_t *ctx, buck22_cfg_t *cfg)
Buck 22 initialization function.
err_t buck22_read_vout(buck22_t *ctx, uint16_t *vout_mv)
Buck 22 read vout function.
err_t buck22_set_vout(buck22_t *ctx, uint16_t vout_mv)
Buck 22 set vout function.
Buck 22 Click configuration object.
Definition buck22.h:180
uint32_t i2c_speed
Definition buck22.h:186
pin_name_t scl
Definition buck22.h:181
pin_name_t sda
Definition buck22.h:182
pin_name_t pg
Definition buck22.h:184
uint8_t i2c_address
Definition buck22.h:187
Buck 22 Click context object.
Definition buck22.h:163
i2c_master_t i2c
Definition buck22.h:168
uint8_t slave_address
Definition buck22.h:171
digital_in_t pg
Definition buck22.h:165