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_analog_in.h"
52#include "drv_i2c_master.h"
75#define RMSTODC2_RMS_VOLTAGE_COEF 1.045f
81#define RMSTODC2_ADC_RESOLUTION 0x0FFF
82#define RMSTODC2_VREF_3V3 3.3
83#define RMSTODC2_VREF_5V 5.0
90#define RMSTODC2_SET_DEV_ADDR 0x4D
108#define RMSTODC2_MAP_MIKROBUS( cfg, mikrobus ) \
109 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
110 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
111 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
void rmstodc2_cfg_setup(rmstodc2_cfg_t *cfg)
RMS to DC 2 configuration object setup function.
err_t rmstodc2_read_voltage(rmstodc2_t *ctx, float *voltage)
RMS to DC 2 read voltage level function.
err_t rmstodc2_read_raw_adc(rmstodc2_t *ctx, uint16_t *raw_adc)
RMS to DC 2 read raw ADC value function.
void rmstodc2_drv_interface_sel(rmstodc2_cfg_t *cfg, rmstodc2_drv_t drv_sel)
RMS to DC 2 driver interface setup function.
err_t rmstodc2_set_vref(rmstodc2_t *ctx, float vref)
RMS to DC 2 set vref function.
err_t rmstodc2_init(rmstodc2_t *ctx, rmstodc2_cfg_t *cfg)
RMS to DC 2 initialization function.
rmstodc2_drv_t
RMS to DC 2 Click driver selector.
Definition rmstodc2.h:121
@ RMSTODC2_DRV_SEL_ADC
Definition rmstodc2.h:122
@ RMSTODC2_DRV_SEL_I2C
Definition rmstodc2.h:123
rmstodc2_return_value_t
RMS to DC 2 Click return value data.
Definition rmstodc2.h:167
@ RMSTODC2_ERROR
Definition rmstodc2.h:169
@ RMSTODC2_OK
Definition rmstodc2.h:168
RMS to DC 2 Click configuration object.
Definition rmstodc2.h:147
analog_in_resolution_t resolution
Definition rmstodc2.h:152
rmstodc2_drv_t drv_sel
Definition rmstodc2.h:158
float vref
Definition rmstodc2.h:153
uint32_t i2c_speed
Definition rmstodc2.h:155
pin_name_t scl
Definition rmstodc2.h:149
pin_name_t sda
Definition rmstodc2.h:150
pin_name_t an
Definition rmstodc2.h:148
uint8_t i2c_address
Definition rmstodc2.h:156
RMS to DC 2 Click context object.
Definition rmstodc2.h:132
rmstodc2_drv_t drv_sel
Definition rmstodc2.h:138
float vref
Definition rmstodc2.h:137
i2c_master_t i2c
Definition rmstodc2.h:134
uint8_t slave_address
Definition rmstodc2.h:136
analog_in_t adc
Definition rmstodc2.h:133