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 BUCK19_REG_VOUT 0x00
74#define BUCK19_REG_ILIMIT 0x01
75#define BUCK19_REG_INT_STATUS 0x02
76#define BUCK19_REG_INT_LATCH 0x03
77#define BUCK19_REG_INT_MASK 0x04
78#define BUCK19_REG_CONFIG_0 0x05
79#define BUCK19_REG_CONFIG_1 0x06
97#define BUCK19_VOUT_MIN 3.0f
98#define BUCK19_VOUT_MAX 20.0f
99#define BUCK19_VOUT_DEFAULT 5.0f
100#define BUCK19_VOUT_11V 11.0f
101#define BUCK19_VOUT_11V_STEP 0.2f
102#define BUCK19_VOUT_5p9V 5.9f
103#define BUCK19_VOUT_5p9V_STEP 0.1f
104#define BUCK19_VOUT_STEP 0.02f
105#define BUCK19_FLOAT_COMPARE_TOLERANCE 0.0001f
111#define BUCK19_ILIMIT_MIN 100
112#define BUCK19_ILIMIT_MAX 3000
113#define BUCK19_ILIMIT_STEP 100
114#define BUCK19_ILIMIT_DEFAULT 500
120#define BUCK19_INT_INDUCTOR_PCP 0x80
121#define BUCK19_INT_OT_WARNING 0x40
122#define BUCK19_INT_OT_PROTECT 0x20
123#define BUCK19_INT_WATCHDOG 0x10
124#define BUCK19_INT_POWER_ON 0x08
125#define BUCK19_INT_SHORT_PROTECT 0x04
126#define BUCK19_INT_CC_FUNCTION 0x02
127#define BUCK19_INT_OV_PROTECT 0x01
128#define BUCK19_INT_DISABLE_ALL 0x00
134#define BUCK19_CONFIG_0_WATCHDOG_100MS 0x00
135#define BUCK19_CONFIG_0_WATCHDOG_500MS 0x40
136#define BUCK19_CONFIG_0_WATCHDOG_1S 0x80
137#define BUCK19_CONFIG_0_WATCHDOG_5S 0xC0
138#define BUCK19_CONFIG_0_CDC_OFF 0x00
139#define BUCK19_CONFIG_0_CDC_FULL 0x10
140#define BUCK19_CONFIG_0_SW_FREQ_500KHZ 0x00
141#define BUCK19_CONFIG_0_SW_FREQ_750KHZ 0x04
142#define BUCK19_CONFIG_0_DITHERING_OFF 0x00
143#define BUCK19_CONFIG_0_DITHERING_ON 0x02
144#define BUCK19_CONFIG_0_DISCHARGE_OFF 0x00
145#define BUCK19_CONFIG_0_DISCHARGE_ON 0x01
151#define BUCK19_CONFIG_1_WATCHDOG_EN_OFF 0x00
152#define BUCK19_CONFIG_1_WATCHDOG_EN_ON 0x02
153#define BUCK19_CONFIG_1_DIG_EN_OFF 0x00
154#define BUCK19_CONFIG_1_DIG_EN_ON 0x01
161#define BUCK19_DEVICE_ADDRESS_VCC 0x04
162#define BUCK19_DEVICE_ADDRESS_GND 0x05
163#define BUCK19_DEVICE_ADDRESS_SDA 0x06
164#define BUCK19_DEVICE_ADDRESS_SCL 0x07
182#define BUCK19_MAP_MIKROBUS( cfg, mikrobus ) \
183 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
184 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
185 cfg.pon = MIKROBUS( mikrobus, MIKROBUS_AN ); \
186 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
187 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
buck19_return_value_t
Buck 19 Click return value data.
Definition buck19.h:236
@ BUCK19_ERROR
Definition buck19.h:238
@ BUCK19_OK
Definition buck19.h:237
void buck19_cfg_setup(buck19_cfg_t *cfg)
Buck 19 configuration object setup function.
uint8_t buck19_get_pon_pin(buck19_t *ctx)
Buck 19 get pon pin function.
err_t buck19_default_cfg(buck19_t *ctx)
Buck 19 default configuration function.
err_t buck19_write_register(buck19_t *ctx, uint8_t reg, uint8_t data_in)
Buck 19 write register function.
void buck19_enable_device(buck19_t *ctx)
Buck 19 enable device function.
err_t buck19_read_register(buck19_t *ctx, uint8_t reg, uint8_t *data_out)
Buck 19 read register function.
err_t buck19_set_vout(buck19_t *ctx, float vout)
Buck 19 set vout function.
err_t buck19_set_ilimit(buck19_t *ctx, uint16_t ilimit)
Buck 19 set ilimit function.
void buck19_disable_device(buck19_t *ctx)
Buck 19 disable device function.
err_t buck19_init(buck19_t *ctx, buck19_cfg_t *cfg)
Buck 19 initialization function.
uint8_t buck19_get_int_pin(buck19_t *ctx)
Buck 19 get int pin function.
Buck 19 Click configuration object.
Definition buck19.h:218
uint32_t i2c_speed
Definition buck19.h:226
pin_name_t pon
Definition buck19.h:222
pin_name_t scl
Definition buck19.h:219
pin_name_t en
Definition buck19.h:223
pin_name_t int_pin
Definition buck19.h:224
pin_name_t sda
Definition buck19.h:220
uint8_t i2c_address
Definition buck19.h:227
Buck 19 Click context object.
Definition buck19.h:197
digital_in_t int_pin
Definition buck19.h:203
i2c_master_t i2c
Definition buck19.h:206
digital_out_t en
Definition buck19.h:199
digital_in_t pon
Definition buck19.h:202
uint8_t slave_address
Definition buck19.h:209