pwrmeter2 2.0.0.0

Functions

void pwrmeter2_cfg_setup (pwrmeter2_cfg_t *cfg)
 Config Object Initialization function.
 
err_t pwrmeter2_init (pwrmeter2_t *ctx, pwrmeter2_cfg_t *cfg)
 Initialization function.
 
err_t pwrmeter2_default_cfg (pwrmeter2_t *ctx)
 Click Default Configuration function.
 
err_t pwrmeter2_write_reg (pwrmeter2_t *ctx, uint8_t reg, uint32_t data_in)
 Generic Write function.
 
err_t pwrmeter2_read_reg (pwrmeter2_t *ctx, uint8_t reg, uint32_t *data_out, uint8_t len)
 Generic Read function.
 
err_t pwrmeter2_read_conv_data (pwrmeter2_t *ctx, uint32_t *data_ch_0, uint32_t *data_ch_1)
 Read Converted Data function.
 
err_t pwrmeter2_get_data (pwrmeter2_t *ctx, float *voltage, float *current, float *power)
 Data Get function.
 
void pwrmeter2_reset (pwrmeter2_t *ctx)
 Reset function.
 
uint8_t pwrmeter2_get_modulator_1 (pwrmeter2_t *ctx)
 Modulator 1 Get function.
 
uint8_t pwrmeter2_get_modulator_0 (pwrmeter2_t *ctx)
 Modulator 0 Get function.
 
uint8_t pwrmeter2_check_ready_pin (pwrmeter2_t *ctx)
 Ready Pin Check function.
 

Detailed Description

Function Documentation

◆ pwrmeter2_cfg_setup()

void pwrmeter2_cfg_setup ( pwrmeter2_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pwrmeter2_check_ready_pin()

uint8_t pwrmeter2_check_ready_pin ( pwrmeter2_t * ctx)

Ready Pin Check function.

Parameters
ctxClick object.

This function returns the state of the Data Ready ( DR ) pin.

◆ pwrmeter2_default_cfg()

err_t pwrmeter2_default_cfg ( pwrmeter2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function executes default configuration for PWR Meter 2 click.

◆ pwrmeter2_get_data()

err_t pwrmeter2_get_data ( pwrmeter2_t * ctx,
float * voltage,
float * current,
float * power )

Data Get function.

Parameters
ctxClick object.
voltageStores the voltage data in V.
currentStores the current data in A.
powerStores the power data in W.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function gets the calculated voltage( V ), current( A ) and power( W ) data.

◆ pwrmeter2_get_modulator_0()

uint8_t pwrmeter2_get_modulator_0 ( pwrmeter2_t * ctx)

Modulator 0 Get function.

Parameters
ctxClick object.

This function returns the state of the modulator output for the channel 0.

◆ pwrmeter2_get_modulator_1()

uint8_t pwrmeter2_get_modulator_1 ( pwrmeter2_t * ctx)

Modulator 1 Get function.

Parameters
ctxClick object.

This function returns the state of the modulator output for the channel 1.

◆ pwrmeter2_init()

err_t pwrmeter2_init ( pwrmeter2_t * ctx,
pwrmeter2_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function initializes all necessary pins and peripherals used for this click.

◆ pwrmeter2_read_conv_data()

err_t pwrmeter2_read_conv_data ( pwrmeter2_t * ctx,
uint32_t * data_ch_0,
uint32_t * data_ch_1 )

Read Converted Data function.

Parameters
ctxClick object.
data_ch_0Buffer where the converted data from channel 0 register be stored.
data_ch_1Buffer where the converted data from channel 1 register be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function reads the converted data from both channels when conversion is finished.

◆ pwrmeter2_read_reg()

err_t pwrmeter2_read_reg ( pwrmeter2_t * ctx,
uint8_t reg,
uint32_t * data_out,
uint8_t len )

Generic Read function.

Parameters
ctxClick object.
regAddress which from data be read.
data_outBuffer where data be stored.
lenNumber of data to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function reads the desired number of 24-bit data from the register/registers.

◆ pwrmeter2_reset()

void pwrmeter2_reset ( pwrmeter2_t * ctx)

Reset function.

Parameters
ctxClick object.

This function performs the hardware reset and puts the device back to the normal operation mode after 1.2 seconds.

◆ pwrmeter2_write_reg()

err_t pwrmeter2_write_reg ( pwrmeter2_t * ctx,
uint8_t reg,
uint32_t data_in )

Generic Write function.

Parameters
ctxClick object.
regAddress where data be written.
data_inData to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function writes 24-bit data to the register.