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 CURRENT5_VOLTAGE_GAIN 200.0
75#define CURRENT5_VREF_mV 3300.0
76#define CURRENT5_RESOLUTION 4096.0
77#define CURRENT5_RSHUNT_mOHM 2.0
78#define CURRENT5_GAIN_ERROR_PERCENTS 6.0
88#define CURRENT5_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
89#define CURRENT5_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
107#define CURRENT5_MAP_MIKROBUS( cfg, mikrobus ) \
108 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
109 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
110 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
111 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
112 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
113 cfg.alert = MIKROBUS( mikrobus, MIKROBUS_INT )
current5_return_value_t
Current 5 Click return value data.
Definition current5.h:165
@ CURRENT5_ERROR
Definition current5.h:167
@ CURRENT5_OK
Definition current5.h:166
err_t current5_init(current5_t *ctx, current5_cfg_t *cfg)
Current 5 initialization function.
void current5_set_rst(current5_t *ctx, uint8_t state)
Mode selection.
err_t current5_generic_read(current5_t *ctx, uint8_t *data_out, uint8_t len)
Current 5 data reading function.
uint8_t current5_get_alert(current5_t *ctx)
Get alert pin state.
err_t current5_default_cfg(current5_t *ctx)
Current 5 default configuration function.
err_t current5_get_voltage(current5_t *ctx, float *vout)
Get voltage.
err_t current5_get_current(current5_t *ctx, float *current)
Get current.
void current5_cfg_setup(current5_cfg_t *cfg)
Current 5 configuration object setup function.
err_t current5_get_adc(current5_t *ctx, uint16_t *adc_data)
Read raw adc value.
This file contains SPI specific macros, functions, etc.
Current 5 Click configuration object.
Definition current5.h:142
pin_name_t alert
Definition current5.h:151
spi_master_chip_select_polarity_t cs_polarity
Definition current5.h:156
pin_name_t sck
Definition current5.h:146
spi_master_mode_t spi_mode
Definition current5.h:155
pin_name_t mosi
Definition current5.h:145
uint32_t spi_speed
Definition current5.h:154
pin_name_t miso
Definition current5.h:144
pin_name_t rst
Definition current5.h:150
pin_name_t cs
Definition current5.h:147
Current 5 Click context object.
Definition current5.h:123
spi_master_t spi
Definition current5.h:131
digital_in_t alert
Definition current5.h:128
digital_out_t rst
Definition current5.h:125
pin_name_t chip_select
Definition current5.h:133