smartbuck2 2.1.0.0
smartbuck2.h File Reference

This file contains API for Smart Buck 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  smartbuck2_t
 Smart Buck 2 Click context object. More...
 
struct  smartbuck2_cfg_t
 Smart Buck 2 Click configuration object. More...
 

Macros

#define SMARTBUCK2_REG_SET0   0x00
 Smart Buck 2 description register.
 
#define SMARTBUCK2_REG_SET1   0x01
 
#define SMARTBUCK2_REG_SET2   0x02
 
#define SMARTBUCK2_REG_SET3   0x03
 
#define SMARTBUCK2_REG_CTRL   0x04
 
#define SMARTBUCK2_REG_TEMP   0x05
 
#define SMARTBUCK2_REG_RMPCTRL   0x06
 
#define SMARTBUCK2_REG_CHIP_ID_0   0x08
 
#define SMARTBUCK2_REG_CHIP_ID_1   0x09
 
#define SMARTBUCK2_OP_MOD_BIT_MASK   0x80
 Smart Buck 2 description of operation mode values.
 
#define SMARTBUCK2_OP_MODE_FORCED_PWM   0x80
 
#define SMARTBUCK2_OP_MODE_PFM   0x00
 
#define SMARTBUCK2_CTRL_BIT_MASK   0xE0
 Smart Buck 2 description of control register values.
 
#define SMARTBUCK2_CTRL_PD_EN   0x80
 
#define SMARTBUCK2_CTRL_PD_DIS   0x00
 
#define SMARTBUCK2_CTRL_PD_VSEL0_EN   0x40
 
#define SMARTBUCK2_CTRL_PD_VSEL0_DIS   0x00
 
#define SMARTBUCK2_CTRL_PD_VSEL1_EN   0x20
 
#define SMARTBUCK2_CTRL_PD_VSEL1_DIS   0x00
 
#define SMARTBUCK2_CTRL_PD_VSEL   0x40
 
#define SMARTBUCK2_TEMP_DIS_BIT_MASK   0xFB
 Smart Buck 2 description of temp register values.
 
#define SMARTBUCK2_TEMP_TS_ENABLE   0x00
 
#define SMARTBUCK2_TEMP_TS_DISABLE   0x04
 
#define SMARTBUCK2_TEMP_TJEW   0x02
 
#define SMARTBUCK2_TEMP_TJEW_BIT_MASK   0xFD
 
#define SMARTBUCK2_TEMP_LT_120_C   0x00
 
#define SMARTBUCK2_TEMP_GT_120_C   0x01
 
#define SMARTBUCK2_TEMP_ERROR   0x02
 
#define SMARTBUCK2_TEMP_TJTS   0x01
 
#define SMARTBUCK2_RMP_VTG_T_BIT_MASK   0xE0
 Smart Buck 2 description of ramp temp register values.
 
#define SMARTBUCK2_RMP_SET   0xE0
 
#define SMARTBUCK2_RMP_EN_DISC   0x04
 
#define SMARTBUCK2_RMP_PFM   0x02
 
#define SMARTBUCK2_RMP_VTG_T_32MVNS   0x00
 
#define SMARTBUCK2_RMP_VTG_T_16MVNS   0x01
 
#define SMARTBUCK2_RMP_VTG_T_8MVNS   0x02
 
#define SMARTBUCK2_RMP_VTG_T_4MVNS   0x03
 
#define SMARTBUCK2_RMP_VTG_T_2MVNS   0x04
 
#define SMARTBUCK2_RMP_VTG_T_1MVNS   0x05
 
#define SMARTBUCK2_RMP_VTG_T_0_5MVNS   0x06
 
#define SMARTBUCK2_RMP_VTG_T_0_25MVNS   0x07
 
#define SMARTBUCK2_VENDOR_ID_BIT_MASK   0xF0
 Smart Buck 2 description of device ID values.
 
#define SMARTBUCK2_ID_VENDOR   0x80
 
#define SMARTBUCK2_PART_NUM_ID_BIT_MASK   0x0C
 
#define SMARTBUCK2_ID_PART_NUM   0x03
 
#define SMARTBUCK2_CHIP_REV_ID_BIT_MASK   0x03
 
#define SMARTBUCK2_VOUT_MIN   500u
 Smart Buck 2 description of Vout calculation values.
 
#define SMARTBUCK2_VOUT_MAX   1770u
 
#define SMARTBUCK2_VOUT_STEP_10MV   10u
 
#define SMARTBUCK2_VOUT_START_500MV   500u
 
#define SMARTBUCK2_DEVICE_ADDRESS   0x60
 Smart Buck 2 device address setting.
 
#define SMARTBUCK2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  smartbuck2_return_value_t { SMARTBUCK2_OK = 0 , SMARTBUCK2_ERROR = -1 }
 Smart Buck 2 Click return value data. More...
 

Functions

void smartbuck2_cfg_setup (smartbuck2_cfg_t *cfg)
 Smart Buck 2 configuration object setup function.
 
err_t smartbuck2_init (smartbuck2_t *ctx, smartbuck2_cfg_t *cfg)
 Smart Buck 2 initialization function.
 
err_t smartbuck2_default_cfg (smartbuck2_t *ctx)
 Smart Buck 2 default configuration 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_generic_read (smartbuck2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smart Buck 2 I2C reading function.
 
err_t smartbuck2_set_voltage (smartbuck2_t *ctx, uint16_t vout_mv)
 Smart Buck 2 set voltage function.
 
err_t smartbuck2_get_voltage (smartbuck2_t *ctx, uint16_t *vout_mv)
 Smart Buck 2 get voltage function.
 
err_t smartbuck2_set_op_mode (smartbuck2_t *ctx, uint8_t op_mode)
 Smart Buck 2 set operation mode 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_ctrl (smartbuck2_t *ctx, uint8_t ctrl)
 Smart Buck 2 set control function.
 
err_t smartbuck2_set_temp_shd (smartbuck2_t *ctx, uint8_t temp_enable)
 Smart Buck 2 set temperature shutdown function.
 
uint8_t smartbuck2_check_temp_warning (smartbuck2_t *ctx)
 Smart Buck 2 check temperature warning 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_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.
 

Detailed Description

This file contains API for Smart Buck 2 Click Driver.

Enumeration Type Documentation

◆ smartbuck2_return_value_t

Smart Buck 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
SMARTBUCK2_OK 
SMARTBUCK2_ERROR