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"
69#define CHARGER3_COMMAND_NOP 0x00
70#define CHARGER3_COMMAND_WRITE_RDAC 0x04
71#define CHARGER3_COMMAND_READ_RDAC 0x08
72#define CHARGER3_COMMAND_STORE_WIPER 0x0C
73#define CHARGER3_COMMAND_SW_RESET 0x10
74#define CHARGER3_COMMAND_READ_50TP 0x14
75#define CHARGER3_COMMAND_READ_MEMORY 0x18
76#define CHARGER3_COMMAND_WRITE_MEMORY 0x1C
77#define CHARGER3_COMMAND_READ_CONTROL 0x20
78#define CHARGER3_COMMAND_SW_SHUTDOWN 0x24
97#define CHARGER3_CTRL_REG_BIT_MASK 0x0B
98#define CHARGER3_FUSE_PROGRAM_SUCCESSFUL 0x00
99#define CHARGER3_FUSE_PROGRAM_UNSUCCESSFUL 0x08
100#define CHARGER3_WIPER_POS_FROZEN 0x00
101#define CHARGER3_UPDATE_WIPER_POS 0x02
102#define CHARGER3_50T_PROGRAM_DISABLED 0x00
103#define CHARGER3_50T_PROGRAM_ENABLE 0x01
111#define CHARGER3_SET_DEV_ADDR 0x2F
125#define CHARGER3_ENABLE_CHARGING 0x00
126#define CHARGER3_DISABLE_CHARGING 0x01
140#define CHARGER3_STATUS_ERROR_SUCCESS 0x00
141#define CHARGER3_STATUS_ERROR_FAILURE 0x01
155#define CHARGER3_DUMMY 0x00
173#define CHARGER3_MAP_MIKROBUS( cfg, mikrobus ) \
174 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
175 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
uint16_t charger3_read_rdac(charger3_t *ctx)
Charger 3 read rdac function.
err_t charger3_init(charger3_t *ctx, charger3_cfg_t *cfg)
Charger 3 initialization function.
void charger3_operating_mode(charger3_t *ctx, uint8_t mode)
Charger 3 set operating mode function.
float charger3_calc_digipot_res(charger3_t *ctx)
Charger 3 calculate digipot resistance function.
void charger3_cfg_setup(charger3_cfg_t *cfg)
Charger 3 configuration object setup function.
err_t charger3_generic_write(charger3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Charger 3 I2C writing function.
uint8_t charger3_set_digipot_res(charger3_t *ctx, uint16_t res_ohm)
Charger 3 set digital potentiometer resistance function.
void charger3_enable_write(charger3_t *ctx)
Charger 3 enable write function.
void charger3_write_rdac(charger3_t *ctx, uint16_t rdac_data)
Charger 3 write to rdac function.
uint8_t charger3_set_current(charger3_t *ctx, float curr_value)
Charger 3 set current function.
err_t charger3_generic_read(charger3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Charger 3 I2C reading function.
void charger3_default_cfg(charger3_t *ctx)
Charger 3 default configuration function.
Charger 3 Click configuration object.
Definition charger3.h:201
uint32_t i2c_speed
Definition charger3.h:205
pin_name_t scl
Definition charger3.h:202
pin_name_t sda
Definition charger3.h:203
uint8_t i2c_address
Definition charger3.h:206
Charger 3 Click context object.
Definition charger3.h:185
i2c_master_t i2c
Definition charger3.h:188
uint8_t slave_address
Definition charger3.h:192