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 LEM_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 LEM_RETVAL uint8_t
81#define LEM_INIT_ERROR 0xFF
87#define LEM_USEFULL_DATA 0xFFF
88#define LEM_CALC_COEF 2266
89#define LEM_AMP_COEF 0.0103
90#define LEM_MILIAMP_COEF 10.3
#define LEM_RETVAL
Definition lem.h:78
float lem_get_current(lem_t *ctx, float coef)
Get current in milliamperes function.
void lem_cfg_setup(lem_cfg_t *cfg)
Config Object Initialization function.
LEM_RETVAL lem_init(lem_t *ctx, lem_cfg_t *cfg)
Initialization function.
int16_t lem_data_read(lem_t *ctx)
Data read function.
Click configuration structure definition.
Definition lem.h:118
spi_master_chip_select_polarity_t cs_polarity
Definition lem.h:130
pin_name_t sck
Definition lem.h:123
spi_master_mode_t spi_mode
Definition lem.h:129
pin_name_t mosi
Definition lem.h:122
uint32_t spi_speed
Definition lem.h:128
pin_name_t miso
Definition lem.h:121
pin_name_t cs
Definition lem.h:124
Click ctx object definition.
Definition lem.h:104
digital_out_t cs
Definition lem.h:105
spi_master_t spi
Definition lem.h:109
pin_name_t chip_select
Definition lem.h:110