28#ifndef CURRENTLIMIT7_H
29#define CURRENTLIMIT7_H
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 CURRENTLIMIT7_CMD_NOP 0x00
74#define CURRENTLIMIT7_CMD_WRITE_RDAC 0x04
75#define CURRENTLIMIT7_CMD_READ_RDAC 0x08
76#define CURRENTLIMIT7_CMD_STORE_WIPER 0x0C
77#define CURRENTLIMIT7_CMD_SW_RESET 0x10
78#define CURRENTLIMIT7_CMD_READ_CONTENTS 0x14
79#define CURRENTLIMIT7_CMD_READ_MEMORY 0x18
80#define CURRENTLIMIT7_CMD_WRITE_MEMORY 0x1C
81#define CURRENTLIMIT7_CMD_READ_CTRL 0x20
82#define CURRENTLIMIT7_CMD_SW_SHUTDOWN 0x24
100#define CURRENTLIMIT7_OP_0_CURRENT_LIMIT_260_mA 260
101#define CURRENTLIMIT7_OP_0_CURRENT_LIMIT_280_mA 280
102#define CURRENTLIMIT7_OP_0_CURRENT_LIMIT_330_mA 330
103#define CURRENTLIMIT7_OP_0_CURRENT_LIMIT_450_mA 450
104#define CURRENTLIMIT7_OP_0_CURRENT_LIMIT_510_mA 510
105#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_510_mA 510
106#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_625_mA 625
107#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_860_mA 860
108#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_1320_mA 1320
109#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_1450_mA 1450
110#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_1550_mA 1550
111#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_1750_mA 1750
112#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_2020_mA 2020
113#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_2260_mA 2260
114#define CURRENTLIMIT7_OP_1_CURRENT_LIMIT_2500_mA 2500
120#define CURRENTLIMIT7_SET_SHUTDOWN_BIT_MASK 0x01
121#define CURRENTLIMIT7_SET_NORMAL_MODE 0x00
122#define CURRENTLIMIT7_SET_SHUTDOWN_MODE 0x01
123#define CURRENTLIMIT7_SET_ENABLE_WRITE_MEMORY 0x0002
129#define CURRENTLIMIT7_OP_MODE_500_mA_2500_mA 0x00
130#define CURRENTLIMIT7_OP_MODE_250_mA_500_mA 0x01
137#define CURRENTLIMIT7_SET_DEV_ADDR_0 0x2E
138#define CURRENTLIMIT7_SET_DEV_ADDR_1 0x2C
156#define CURRENTLIMIT7_MAP_MIKROBUS( cfg, mikrobus ) \
157 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
158 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
159 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
160 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
161 cfg.flg = MIKROBUS( mikrobus, MIKROBUS_INT )
currentlimit7_return_value_t
Current Limit 7 Click return value data.
Definition currentlimit7.h:210
@ CURRENTLIMIT7_OK
Definition currentlimit7.h:211
@ CURRENTLIMIT7_ERROR
Definition currentlimit7.h:212
err_t currentlimit7_hw_reset(currentlimit7_t *ctx)
Current Limit 7 hardware reset function.
err_t currentlimit7_set_resistance(currentlimit7_t *ctx, uint32_t res_ohm)
Current Limit 7 set resistance function.
err_t currentlimit7_store_wiper(currentlimit7_t *ctx)
Current Limit 7 store wiper function.
err_t currentlimit7_enable_write(currentlimit7_t *ctx)
Current Limit 7 enable write function.
void currentlimit7_cfg_setup(currentlimit7_cfg_t *cfg)
Current Limit 7 configuration object setup function.
err_t currentlimit7_set_digi_pot(currentlimit7_t *ctx, uint16_t wiper_pos)
Current Limit 7 set DIGI POT function.
uint8_t currentlimit7_get_fault(currentlimit7_t *ctx)
Current Limit 7 get fault function.
err_t currentlimit7_set_current_limit(currentlimit7_t *ctx, uint8_t op_mode, uint16_t current_limit_ma)
Current Limit 7 set current limit function.
err_t currentlimit7_sw_reset(currentlimit7_t *ctx)
Current Limit 7 software reset function.
err_t currentlimit7_write_rdac(currentlimit7_t *ctx, uint16_t data_in)
Current Limit 7 write RDAC function.
err_t currentlimit7_default_cfg(currentlimit7_t *ctx)
Current Limit 7 default configuration function.
err_t currentlimit7_operating_mode(currentlimit7_t *ctx, uint8_t mode)
Current Limit 7 set operating mode function.
err_t currentlimit7_next_frame_read(currentlimit7_t *ctx, uint8_t wiper_location, uint16_t *data_out)
Current Limit 7 next frame read function.
err_t currentlimit7_set_disable(currentlimit7_t *ctx)
Current Limit 7 disable the device function.
err_t currentlimit7_read_rdac(currentlimit7_t *ctx, uint16_t *data_out)
Current Limit 7 read RDAC function.
err_t currentlimit7_init(currentlimit7_t *ctx, currentlimit7_cfg_t *cfg)
Current Limit 7 initialization function.
err_t currentlimit7_set_enable(currentlimit7_t *ctx)
Current Limit 7 enable the device function.
err_t currentlimit7_generic_write(currentlimit7_t *ctx, uint8_t cmd, uint16_t data_byte)
Current Limit 7 I2C writing function.
err_t currentlimit7_generic_read(currentlimit7_t *ctx, uint8_t cmd, uint16_t data_byte, uint16_t *data_out)
Current Limit 7 I2C reading function.
err_t currentlimit7_set_slave_address(currentlimit7_t *ctx, uint16_t slave_address)
Current Limit 7 set I2C Slave address.
err_t currentlimit7_read_memory(currentlimit7_t *ctx, uint8_t wiper_location, uint16_t *data_out)
Current Limit 7 read memory function.
Current Limit 7 Click configuration object.
Definition currentlimit7.h:192
pin_name_t flg
Definition currentlimit7.h:198
uint32_t i2c_speed
Definition currentlimit7.h:200
pin_name_t scl
Definition currentlimit7.h:193
pin_name_t en
Definition currentlimit7.h:196
pin_name_t sda
Definition currentlimit7.h:194
pin_name_t rst
Definition currentlimit7.h:197
uint8_t i2c_address
Definition currentlimit7.h:201
Current Limit 7 Click context object.
Definition currentlimit7.h:171
digital_in_t flg
Definition currentlimit7.h:177
i2c_master_t i2c
Definition currentlimit7.h:180
digital_out_t en
Definition currentlimit7.h:173
digital_out_t rst
Definition currentlimit7.h:174
uint8_t slave_address
Definition currentlimit7.h:183