28#ifndef HALLCURRENT16_H
29#define HALLCURRENT16_H
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 HALLCURRENT16_ADDR_IN_CH_SEL_1 0x00
75#define HALLCURRENT16_ADDR_IN_CH_SEL_2 0x08
81#define HALLCURRENT16_RESOLUTION_12BIT 0x0FFFu
82#define HALLCURRENT16_VREF_3V3 3.3f
83#define HALLCURRENT16_VREF_5V 5.0f
89#define HALLCURRENT16_SENS_CALC_GAIN_0 26.4f
90#define HALLCURRENT16_SENS_CALC_GAIN_1 33.0f
91#define HALLCURRENT16_SENS_CALC_GAIN_2 39.6f
92#define HALLCURRENT16_SENS_CALC_GAIN_3 19.8f
98#define HALLCURRENT16_ADC_NUM_OF_MEASURE 1000u
99#define HALLCURRENT16_CONV_TO_MILI 1000.0f
109#define HALLCURRENT16_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
110#define HALLCURRENT16_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
128#define HALLCURRENT16_MAP_MIKROBUS( cfg, mikrobus ) \
129 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
130 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
131 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
132 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
133 cfg.ocf = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t hallcurrent16_get_ovc_fault(hallcurrent16_t *ctx)
Hall Current 16 get overcurrent fault function.
err_t hallcurrent16_get_current(hallcurrent16_t *ctx, float *current)
Hall Current 16 get current function.
err_t hallcurrent16_get_vout(hallcurrent16_t *ctx, float *adc_vout)
Hall Current 16 get vout function.
err_t hallcurrent16_init(hallcurrent16_t *ctx, hallcurrent16_cfg_t *cfg)
Hall Current 16 initialization function.
void hallcurrent16_cfg_setup(hallcurrent16_cfg_t *cfg)
Hall Current 16 configuration object setup function.
err_t hallcurrent16_default_cfg(hallcurrent16_t *ctx)
Hall Current 16 default configuration function.
void hallcurrent16_set_vref(hallcurrent16_t *ctx, float vref)
Hall Current 16 set vref function.
err_t hallcurrent16_get_vref(hallcurrent16_t *ctx, float *adc_vref)
Hall Current 16 get vout function.
void hallcurrent16_set_sens(hallcurrent16_t *ctx)
Hall Current 16 set sens function.
err_t hallcurrent16_get_voltage(hallcurrent16_t *ctx, float *voltage)
Hall Current 16 get voltage function.
hallcurrent16_gain_t
Hall Current 16 Click gain value data.
Definition hallcurrent16.h:143
@ HALLCURRENT16_GAIN_3
Definition hallcurrent16.h:147
@ HALLCURRENT16_GAIN_2
Definition hallcurrent16.h:146
@ HALLCURRENT16_GAIN_0
Definition hallcurrent16.h:144
@ HALLCURRENT16_GAIN_1
Definition hallcurrent16.h:145
hallcurrent16_return_value_t
Hall Current 16 Click return value data.
Definition hallcurrent16.h:201
@ HALLCURRENT16_OK
Definition hallcurrent16.h:202
@ HALLCURRENT16_ERROR
Definition hallcurrent16.h:203
This file contains SPI specific macros, functions, etc.
Hall Current 16 Click configuration object.
Definition hallcurrent16.h:176
pin_name_t ocf
Definition hallcurrent16.h:184
hallcurrent16_gain_t gain
Definition hallcurrent16.h:192
float vref
Definition hallcurrent16.h:191
spi_master_chip_select_polarity_t cs_polarity
Definition hallcurrent16.h:189
pin_name_t sck
Definition hallcurrent16.h:180
spi_master_mode_t spi_mode
Definition hallcurrent16.h:188
pin_name_t mosi
Definition hallcurrent16.h:179
uint32_t spi_speed
Definition hallcurrent16.h:187
pin_name_t miso
Definition hallcurrent16.h:178
pin_name_t cs
Definition hallcurrent16.h:181
Hall Current 16 Click context object.
Definition hallcurrent16.h:156
hallcurrent16_gain_t gain
Definition hallcurrent16.h:166
spi_master_t spi
Definition hallcurrent16.h:161
digital_in_t ocf
Definition hallcurrent16.h:158
float vref
Definition hallcurrent16.h:165
float sens
Definition hallcurrent16.h:167
pin_name_t chip_select
Definition hallcurrent16.h:163