42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_spi_master.h"
67#define CURRENT_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
78#define CURRENT_RETVAL uint8_t
80#define CURRENT_OK 0x00
81#define CURRENT_INIT_ERROR 0xFF
88#define CURRENT_FILTER_USEFULL_DATA 0x0FFF
89#define CURRENT_SAMPLE_NUM 10
96#define CURRENT_RSHUNT_0_05 0.05
97#define CURRENT_RSHUNT_0_2 0.2
98#define CURRENT_RSHUNT_1 1.0
99#define CURRENT_RSHUNT_10 10.0
100#define CURRENT_CAL_COEF 0.025
107#define RFMETER_DEF_LIMIT_HIGH 4096
108#define RFMETER_DEF_LIMIT_LOW 800
109#define CURRENT_OUT_OF_RANGE -1.0
162 // End constants group
170 // End variable group
#define CURRENT_RETVAL
Definition current.h:78
void current_cfg_setup(current_cfg_t *cfg)
Config Object Initialization function.
uint16_t current_get_raw_data(current_t *ctx)
Get raw data function.
float current_avg_rata(current_t *ctx)
Calculate average data function.
uint16_t current_data_read(current_t *ctx)
Data read function.
float current_get_current_data(current_t *ctx, float r_hunt)
Get current value function.
CURRENT_RETVAL current_init(current_t *ctx, current_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition current.h:137
spi_master_chip_select_polarity_t cs_polarity
Definition current.h:149
pin_name_t sck
Definition current.h:142
spi_master_mode_t spi_mode
Definition current.h:148
pin_name_t mosi
Definition current.h:141
uint32_t spi_speed
Definition current.h:147
pin_name_t miso
Definition current.h:140
pin_name_t cs
Definition current.h:143
Click ctx object definition.
Definition current.h:123
digital_out_t cs
Definition current.h:124
spi_master_t spi
Definition current.h:128
pin_name_t chip_select
Definition current.h:129