Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define VCTMONITOR_REG_STATUS 0x00
70 #define VCTMONITOR_REG_CONTROL 0x01
71 #define VCTMONITOR_REG_TRIGGER 0x02
72 #define VCTMONITOR_REG_AMB_TEMP_MSB 0x04
73 #define VCTMONITOR_REG_AMB_TEMP_LSB 0x05
74 #define VCTMONITOR_REG_V1_MSB 0x06
75 #define VCTMONITOR_REG_V1_LSB 0x07
76 #define VCTMONITOR_REG_V2_MSB 0x08
77 #define VCTMONITOR_REG_V2_LSB 0x09
78 #define VCTMONITOR_REG_V3_MSB 0x0A
79 #define VCTMONITOR_REG_V3_LSB 0x0B
80 #define VCTMONITOR_REG_V4_MSB 0x0C
81 #define VCTMONITOR_REG_V4_LSB 0x0D
82 #define VCTMONITOR_REG_VCC_MSB 0x0E
83 #define VCTMONITOR_REG_VCC_LSB 0x0F
101 #define VCTMONITOR_CTRL_TEMP_FORMAT_C 0x00
102 #define VCTMONITOR_CTRL_TEMP_FORMAT_K 0x80
103 #define VCTMONITOR_CTRL_REPEATED_MEAS 0x00
104 #define VCTMONITOR_CTRL_SINGLE_MEAS 0x40
105 #define VCTMONITOR_CTRL_MODE1_INT_TEMP 0x00
106 #define VCTMONITOR_CTRL_MODE1_V12 0x08
107 #define VCTMONITOR_CTRL_MODE1_V34 0x10
108 #define VCTMONITOR_CTRL_MODE1_ALL 0x18
110 #define VCTMONITOR_CTRL_MODE2_V12_TR2 0x00
111 #define VCTMONITOR_CTRL_MODE2_V1_2_TR2 0x01
112 #define VCTMONITOR_CTRL_MODE2_V1_2_V34 0x02
113 #define VCTMONITOR_CTRL_MODE2_V34_TR1 0x03
114 #define VCTMONITOR_CTRL_MODE2_V3_4_TR1 0x04
115 #define VCTMONITOR_CTRL_MODE2_TR2_TR1 0x05
116 #define VCTMONITOR_CTRL_MODE2_V1_2_V3_4 0x06
117 #define VCTMONITOR_CTRL_MODE2_V1234 0x07
119 #define VCTMONITOR_STATUS_VCC_READY 0x40
120 #define VCTMONITOR_STATUS_V4_READY 0x20
121 #define VCTMONITOR_STATUS_V3_READY 0x10
122 #define VCTMONITOR_STATUS_V2_READY 0x08
123 #define VCTMONITOR_STATUS_V1_READY 0x04
124 #define VCTMONITOR_STATUS_TINT_READY 0x02
125 #define VCTMONITOR_STATUS_BUSY 0x01
133 #define VCTMONITOR_SLAVE_ADDR_GND_GND 0x4C
134 #define VCTMONITOR_SLAVE_ADDR_GND_VCC 0x4D
135 #define VCTMONITOR_SLAVE_ADDR_VCC_VCC 0x4F
136 #define VCTMONITOR_SLAVE_ADDR_VCC_GND 0x4E
154 #define VCTMONITOR_MAP_MIKROBUS( cfg, mikrobus ) \
155 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
156 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
345 #endif // VCTMONITOR_H
uint8_t i2c_address
Definition: vctmonitor.h:185
float vctmonitor_read_voltage_differential(vctmonitor_t *ctx)
Differential voltage function.
uint32_t i2c_speed
Definition: vctmonitor.h:184
pin_name_t scl
Definition: vctmonitor.h:181
err_t vctmonitor_generic_write(vctmonitor_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
VCT Monitor I2C writing function.
i2c_master_t i2c
Definition: vctmonitor.h:168
float vctmonitor_read_current(vctmonitor_t *ctx)
Current function.
float vctmonitor_read_temperature(vctmonitor_t *ctx)
Get temperature function.
vctmonitor_return_value_t
VCT Monitor Click return value data.
Definition: vctmonitor.h:194
err_t vctmonitor_default_cfg(vctmonitor_t *ctx)
VCT Monitor default configuration function.
@ VCTMONITOR_OK
Definition: vctmonitor.h:195
@ VCTMONITOR_ERROR
Definition: vctmonitor.h:196
void vctmonitor_cfg_setup(vctmonitor_cfg_t *cfg)
VCT Monitor configuration object setup function.
VCT Monitor Click context object.
Definition: vctmonitor.h:166
VCT Monitor Click configuration object.
Definition: vctmonitor.h:180
err_t vctmonitor_init(vctmonitor_t *ctx, vctmonitor_cfg_t *cfg)
VCT Monitor initialization function.
float vctmonitor_read_voltage_single(vctmonitor_t *ctx, uint8_t channel)
Single voltage function.
uint8_t slave_address
Definition: vctmonitor.h:171
uint8_t vctmonitor_get_status(vctmonitor_t *ctx)
Gets status value.
void vctmonitor_configuration(vctmonitor_t *ctx, uint8_t cfg)
Configuration function.
pin_name_t sda
Definition: vctmonitor.h:182
err_t vctmonitor_generic_read(vctmonitor_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
VCT Monitor I2C reading function.