42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define MIC24045_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define MIC24045_RETVAL uint8_t
79#define MIC24045_OK 0x00
80#define MIC24045_INIT_ERROR 0xFF
87#define MIC24045_I2C_ADDRESS 0x50
95#define MIC24045_REG_STATUS 0x00
96#define MIC24045_REG_SETTINGS1 0x01
97#define MIC24045_REG_SETTINGS2 0x02
98#define MIC24045_REG_VOUT 0x03
99#define MIC24045_REG_COMMAND 0x04
106#define MIC24045_BIT_PGS 0x01
107#define MIC24045_BIT_ENS 0x08
108#define MIC24045_BIT_THWRNF 0x20
109#define MIC24045_BIT_THSDF 0x40
110#define MIC24045_BIT_OCF 0x80
111#define MIC24045_BIT_CIFF 0x01
118#define MIC24045_SETTING_CURRENT_NORMAL_LOAD_2_A 0x00
119#define MIC24045_SETTING_CURRENT_NORMAL_LOAD_3_A 0x40
120#define MIC24045_SETTING_CURRENT_NORMAL_LOAD_4_A 0x80
121#define MIC24045_SETTING_CURRENT_NORMAL_LOAD_5_A 0xC0
128#define MIC24045_SETTING_FREQUENCY_310_kHz 0x00
129#define MIC24045_SETTING_FREQUENCY_400_kHz 0x08
130#define MIC24045_SETTING_FREQUENCY_500_kHz 0x10
131#define MIC24045_SETTING_FREQUENCY_570_kHz 0x18
132#define MIC24045_SETTING_FREQUENCY_660_kHz 0x20
133#define MIC24045_SETTING_FREQUENCY_780_kHz 0x28
134#define MIC24045_SETTING_FREQUENCY_970_kHz 0x30
135#define MIC24045_SETTING_FREQUENCY_1200_kHz 0x38
142#define MIC24045_SETTING_START_UP_DELAY_0_ms 0x00
143#define MIC24045_SETTING_START_UP_DELAY_0_5_ms 0x10
144#define MIC24045_SETTING_START_UP_DELAY_1_ms 0x20
145#define MIC24045_SETTING_START_UP_DELAY_2_ms 0x30
146#define MIC24045_SETTING_START_UP_DELAY_4_ms 0x40
147#define MIC24045_SETTING_START_UP_DELAY_6_ms 0x50
148#define MIC24045_SETTING_START_UP_DELAY_8_ms 0x60
149#define MIC24045_SETTING_START_UP_DELAY_10_ms 0x70
156#define MIC24045_SETTING_CHANGE_NOMINAL_0_PERC 0x00
157#define MIC24045_SETTING_CHANGE_NOMINAL_NEG_5_PERC 0x04
158#define MIC24045_SETTING_CHANGE_NOMINAL_POS_5_PERC 0x08
159#define MIC24045_SETTING_CHANGE_NOMINAL_POS_5_0_PERC 0x0C
166#define MIC24045_SETTING_SOFT_START_SLOPE_0_16_Vms 0x00
167#define MIC24045_SETTING_SOFT_START_SLOPE_0_38_Vms 0x01
168#define MIC24045_SETTING_SOFT_START_SLOPE_0_76_Vms 0x02
169#define MIC24045_SETTING_SOFT_START_SLOPE_1_50_Vms 0x03
176#define MIC24045_MAX_VOUT 5.250
177#define MIC24045_MIN_VOUT 0.640
178#define MIC24045_MAX_VOUT_DEC 0xFF
179#define MIC24045_MIN_VOUT_DEC 0x00
#define MIC24045_RETVAL
Definition mic24045.h:77
uint8_t mic24045_get_status(mic24045_t *ctx)
Get status function.
MIC24045_RETVAL mic24045_init(mic24045_t *ctx, mic24045_cfg_t *cfg)
Initialization function.
void mic24045_disable(mic24045_t *ctx)
Disable voltage output.
void mic24045_set_vout(mic24045_t *ctx, float v_out)
Set voltage.
void mic24045_cfg_setup(mic24045_cfg_t *cfg)
Config Object Initialization function.
void mic24045_set_vout_decimal(mic24045_t *ctx, uint8_t dec)
Set voltage decimal.
void mic24045_generic_read(mic24045_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
float mic24045_get_vout(mic24045_t *ctx)
Get voltage.
void mic24045_enable(mic24045_t *ctx)
Enable voltage output.
void mic24045_generic_write(mic24045_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t mic24045_get_power_good_state(mic24045_t *ctx)
Get power good state.
Click configuration structure definition.
Definition mic24045.h:216
uint32_t i2c_speed
Definition mic24045.h:229
pin_name_t scl
Definition mic24045.h:219
pin_name_t en
Definition mic24045.h:224
pin_name_t sda
Definition mic24045.h:220
pin_name_t pg
Definition mic24045.h:225
uint8_t i2c_address
Definition mic24045.h:230
Click ctx object definition.
Definition mic24045.h:193
i2c_master_t i2c
Definition mic24045.h:204
digital_out_t en
Definition mic24045.h:196
uint8_t slave_address
Definition mic24045.h:208
digital_in_t pg
Definition mic24045.h:200