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 VCPMONITOR4_REG_CONFIG 0x00
75#define VCPMONITOR4_REG_ADC_CONFIG 0x01
76#define VCPMONITOR4_REG_SHUNT_CAL 0x02
77#define VCPMONITOR4_REG_VSHUNT 0x04
78#define VCPMONITOR4_REG_VBUS 0x05
79#define VCPMONITOR4_REG_DIETEMP 0x06
80#define VCPMONITOR4_REG_CURRENT 0x07
81#define VCPMONITOR4_REG_POWER 0x08
82#define VCPMONITOR4_REG_DIAG_ALERT 0x0B
83#define VCPMONITOR4_REG_SOVL 0x0C
84#define VCPMONITOR4_REG_SUVL 0x0D
85#define VCPMONITOR4_REG_BOVL 0x0E
86#define VCPMONITOR4_REG_BUVL 0x0F
87#define VCPMONITOR4_REG_TEMP_LIMIT 0x10
88#define VCPMONITOR4_REG_PWR_LIMIT 0x11
89#define VCPMONITOR4_REG_MANUFACTURER_ID 0x3E
90#define VCPMONITOR4_REG_DEVICE_ID 0x3F
108#define VCPMONITOR4_CURRENT_LSB 0.000305
118#define VCPMONITOR4_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
119#define VCPMONITOR4_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
137#define VCPMONITOR4_MAP_MIKROBUS( cfg, mikrobus ) \
138 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
139 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
140 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
141 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
142 cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t vcpmonitor4_get_temperature(vcpmonitor4_t *ctx, float *temperature)
Get device temperature.
err_t vcpmonitor4_default_cfg(vcpmonitor4_t *ctx)
VCP Monitor 4 default configuration function.
err_t vcpmonitor4_generic_read(vcpmonitor4_t *ctx, uint8_t reg, uint32_t *data_out)
VCP Monitor 4 data reading function.
err_t vcpmonitor4_get_power(vcpmonitor4_t *ctx, float *power)
Get Shunt voltage.
void vcpmonitor4_cfg_setup(vcpmonitor4_cfg_t *cfg)
VCP Monitor 4 configuration object setup function.
err_t vcpmonitor4_generic_write(vcpmonitor4_t *ctx, uint8_t reg, uint16_t data_in)
VCP Monitor 4 data writing function.
uint8_t vcpmonitor4_get_alert(vcpmonitor4_t *ctx)
Get alert pin state.
err_t vcpmonitor4_get_vbus(vcpmonitor4_t *ctx, float *vbus)
Get BUS voltage.
err_t vcpmonitor4_get_current(vcpmonitor4_t *ctx, float *current)
Get Current.
err_t vcpmonitor4_init(vcpmonitor4_t *ctx, vcpmonitor4_cfg_t *cfg)
VCP Monitor 4 initialization function.
err_t vcpmonitor4_get_vshunt(vcpmonitor4_t *ctx, float *vshunt)
Get Shunt voltage.
This file contains SPI specific macros, functions, etc.
VCP Monitor 4 Click configuration object.
Definition vcpmonitor4.h:168
pin_name_t alr
Definition vcpmonitor4.h:176
spi_master_chip_select_polarity_t cs_polarity
Definition vcpmonitor4.h:181
pin_name_t sck
Definition vcpmonitor4.h:172
spi_master_mode_t spi_mode
Definition vcpmonitor4.h:180
pin_name_t mosi
Definition vcpmonitor4.h:171
uint32_t spi_speed
Definition vcpmonitor4.h:179
pin_name_t miso
Definition vcpmonitor4.h:170
pin_name_t cs
Definition vcpmonitor4.h:173
VCP Monitor 4 Click context object.
Definition vcpmonitor4.h:152
spi_master_t spi
Definition vcpmonitor4.h:157
digital_in_t alr
Definition vcpmonitor4.h:154
pin_name_t chip_select
Definition vcpmonitor4.h:159
vcpmonitor4_return_value_t
VCP Monitor 4 Click return value data.
Definition vcpmonitor4.h:190
@ vcpmonitor4_OK
Definition vcpmonitor4.h:191
@ vcpmonitor4_ERROR
Definition vcpmonitor4.h:192