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_spi_master.h"
74#define CURRENTLIMIT_ENABLE 1
75#define CURRENTLIMIT_DISABLE 0
77#define CURRENTLIMIT_LSB_VAL 392.2
78#define CURRENTLIMIT_R_BASE 1200.0
79#define CURRENTLIMIT_I_MAX 1.2
80#define CURRENTLIMIT_CALC_COEF 1380.0
82#define CURRENTLIMIT_CUR_LIM_VAL_0_1 224
83#define CURRENTLIMIT_CUR_LIM_VAL_0_2 241
84#define CURRENTLIMIT_CUR_LIM_VAL_0_3 247
85#define CURRENTLIMIT_CUR_LIM_VAL_0_4 250
86#define CURRENTLIMIT_CUR_LIM_VAL_0_5 252
87#define CURRENTLIMIT_CUR_LIM_VAL_0_6 253
88#define CURRENTLIMIT_CUR_LIM_VAL_0_7 254
89#define CURRENTLIMIT_CUR_LIM_VAL_0_867 255
99#define CURRENTLIMIT_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
100#define CURRENTLIMIT_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
118#define CURRENTLIMIT_MAP_MIKROBUS( cfg, mikrobus ) \
119 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
120 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
121 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
122 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
123 cfg.en = MIKROBUS( mikrobus, MIKROBUS_AN )
currentlimit_return_value_t
Current Limit Click return value data.
Definition currentlimit.h:171
@ CURRENTLIMIT_OK
Definition currentlimit.h:172
@ CURRENTLIMIT_ERROR
Definition currentlimit.h:173
void currentlimit_set_limit(currentlimit_t *ctx, uint8_t lim_val)
Set Current With Predefined Values Limit function.
void currentlimit_dev_enable(currentlimit_t *ctx, uint8_t state)
Device enable function.
void currentlimit_set_limit_calc(currentlimit_t *ctx, float lim_val)
Set Calculated Current Limit function.
err_t currentlimit_init(currentlimit_t *ctx, currentlimit_cfg_t *cfg)
Current Limit initialization function.
void currentlimit_cfg_setup(currentlimit_cfg_t *cfg)
Current Limit configuration object setup function.
err_t currentlimit_generic_read(currentlimit_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Current Limit data reading function.
err_t currentlimit_generic_write(currentlimit_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Current Limit data writing function.
const uint8_t lim_val[8]
Definition main.c:29
This file contains SPI specific macros, functions, etc.
Current Limit Click configuration object.
Definition currentlimit.h:149
spi_master_chip_select_polarity_t cs_polarity
Definition currentlimit.h:162
pin_name_t sck
Definition currentlimit.h:153
spi_master_mode_t spi_mode
Definition currentlimit.h:161
pin_name_t mosi
Definition currentlimit.h:152
uint32_t spi_speed
Definition currentlimit.h:160
pin_name_t en
Definition currentlimit.h:157
pin_name_t miso
Definition currentlimit.h:151
pin_name_t cs
Definition currentlimit.h:154
Current Limit Click context object.
Definition currentlimit.h:133
spi_master_t spi
Definition currentlimit.h:138
digital_out_t en
Definition currentlimit.h:135
pin_name_t chip_select
Definition currentlimit.h:140