rmstodc2 2.1.0.0
rmstodc2.h File Reference

This file contains API for RMS to DC 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  rmstodc2_t
 RMS to DC 2 Click context object. More...
 
struct  rmstodc2_cfg_t
 RMS to DC 2 Click configuration object. More...
 

Macros

#define RMSTODC2_RMS_VOLTAGE_COEF   1.045f
 RMS to DC 2 RMS voltage calculation setting.
 
#define RMSTODC2_ADC_RESOLUTION   0x0FFF
 RMS to DC 2 ADC setting.
 
#define RMSTODC2_VREF_3V3   3.3
 
#define RMSTODC2_VREF_5V   5.0
 
#define RMSTODC2_SET_DEV_ADDR   0x4D
 RMS to DC 2 device address setting.
 
#define RMSTODC2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  rmstodc2_drv_t { RMSTODC2_DRV_SEL_ADC , RMSTODC2_DRV_SEL_I2C }
 RMS to DC 2 Click driver selector. More...
 
enum  rmstodc2_return_value_t { RMSTODC2_OK = 0 , RMSTODC2_ERROR = -1 }
 RMS to DC 2 Click return value data. More...
 

Functions

void rmstodc2_cfg_setup (rmstodc2_cfg_t *cfg)
 RMS to DC 2 configuration object setup 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_init (rmstodc2_t *ctx, rmstodc2_cfg_t *cfg)
 RMS to DC 2 initialization function.
 
err_t rmstodc2_read_raw_adc (rmstodc2_t *ctx, uint16_t *raw_adc)
 RMS to DC 2 read raw ADC value function.
 
err_t rmstodc2_read_voltage (rmstodc2_t *ctx, float *voltage)
 RMS to DC 2 read voltage level function.
 
err_t rmstodc2_set_vref (rmstodc2_t *ctx, float vref)
 RMS to DC 2 set vref function.
 

Detailed Description

This file contains API for RMS to DC 2 Click Driver.

Enumeration Type Documentation

◆ rmstodc2_drv_t

RMS to DC 2 Click driver selector.

Selects target driver interface of RMS to DC 2 Click driver.

Enumerator
RMSTODC2_DRV_SEL_ADC 

ADC driver descriptor.

RMSTODC2_DRV_SEL_I2C 

I2C driver descriptor.

◆ rmstodc2_return_value_t

RMS to DC 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
RMSTODC2_OK 
RMSTODC2_ERROR