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_spi_master.h"
67#define ACCURRENT_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 ); \
72 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
80#define ACCURRENT_ERROR -1
87#define ACCURRENT_ADC_ITERATIONS 10
88#define ACCURRENT_ADC_RESOLUTION 0x0FFF
89#define ACCURRENT_AC_TO_DC_V_SCALE 1.8f
90#define ACCURRENT_SENSOR_RESOLUTION 30.0f
91#define ACCURRENT_A_TO_MA_SCALE 1000.0f
182 uint8_t *rd_buf, uint16_t rd_len );
void accurrent_generic_transfer(accurrent_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void accurrent_cfg_setup(accurrent_cfg_t *cfg)
Config Object Initialization function.
err_t accurrent_init(accurrent_t *ctx, accurrent_cfg_t *cfg)
Initialization function.
float accurrent_get_ma(accurrent_t *ctx)
Gets current value of AC Current in mA.
float accurrent_get_a(accurrent_t *ctx)
Gets current value of AC Current in A.
Click configuration structure definition.
Definition accurrent.h:122
spi_master_chip_select_polarity_t cs_polarity
Definition accurrent.h:135
pin_name_t sck
Definition accurrent.h:126
spi_master_mode_t spi_mode
Definition accurrent.h:134
pin_name_t mosi
Definition accurrent.h:125
uint32_t spi_speed
Definition accurrent.h:133
pin_name_t miso
Definition accurrent.h:124
pin_name_t an
Definition accurrent.h:130
pin_name_t cs
Definition accurrent.h:127
Click ctx object definition.
Definition accurrent.h:106
digital_out_t cs
Definition accurrent.h:107
spi_master_t spi
Definition accurrent.h:113
digital_in_t an
Definition accurrent.h:110
pin_name_t chip_select
Definition accurrent.h:114