pac1934 2.0.0.0
Public function

Functions

void pac1934_cfg_setup (pac1934_cfg_t *cfg)
 Config Object Initialization function.
 
PAC1934_RETVAL pac1934_init (pac1934_t *ctx, pac1934_cfg_t *cfg)
 Initialization function.
 
void pac1934_generic_write (pac1934_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pac1934_generic_read (pac1934_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void pac1934_write_byte (pac1934_t *ctx, uint8_t wr_addr, uint8_t wr_data)
 Write one byte function.
 
uint8_t pac1934_read_byte (pac1934_t *ctx, uint8_t rd_addr)
 Read one byte function.
 
uint16_t pac1934_read_two_byte (pac1934_t *ctx, uint8_t rd_addr)
 Read two bytes function.
 
uint32_t pac1934_read_four_byte (pac1934_t *ctx, uint8_t rd_addr)
 Read four bytes function.
 
void pac1934_read_reg (pac1934_t *ctx, uint8_t reg_addr, uint8_t *output_data, uint8_t cnt)
 Read chosen number of bytes function.
 
void pac1934_send_command (pac1934_t *ctx, uint8_t wr_cmd)
 Send Command.
 
float pac1934_measure_voltage (pac1934_t *ctx, uint8_t channel)
 Measure Voltage function.
 
float pac1934_measure_current (pac1934_t *ctx, uint8_t channel)
 Measure Current function.
 
float pac1934_measure_power (pac1934_t *ctx, uint8_t channel)
 Measure Power function.
 
float pac1934_calc_power (pac1934_t *ctx, float voltage, float amperage)
 Calculate Power function.
 
float pac1934_measure_energy (pac1934_t *ctx, uint8_t chann, uint16_t samp_rate)
 Measure Energy function.
 
void pac1934_dev_enable (pac1934_t *ctx)
 Enable device function.
 
void pac1934_dev_disable (pac1934_t *ctx)
 Disable device function.
 
void pac1934_dev_reset (pac1934_t *ctx)
 Reset device function.
 
uint8_t pac1934_check_interrupt (pac1934_t *ctx)
 Check Interrupt function.
 

Detailed Description

Function Documentation

◆ pac1934_calc_power()

float pac1934_calc_power ( pac1934_t * ctx,
float voltage,
float amperage )

Calculate Power function.

Parameters
ctxClick object.
voltageFloat value representing the voltage.
amperageFloat value representing the amperage.
Note
Make sure that voltage and amperage are taken from the same channel.

@description This function is used to calculate power by multiplying voltage and amperage.

◆ pac1934_cfg_setup()

void pac1934_cfg_setup ( pac1934_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pac1934_check_interrupt()

uint8_t pac1934_check_interrupt ( pac1934_t * ctx)

Check Interrupt function.

Parameters
ctxClick object.
Returns
Result State of the INT pin

@description This function is used to check the state of INT pin.

◆ pac1934_dev_disable()

void pac1934_dev_disable ( pac1934_t * ctx)

Disable device function.

Parameters
ctxClick object.

@description This function is used to disable the device.

◆ pac1934_dev_enable()

void pac1934_dev_enable ( pac1934_t * ctx)

Enable device function.

Parameters
ctxClick object.

@description This function is used to disable the device.

◆ pac1934_dev_reset()

void pac1934_dev_reset ( pac1934_t * ctx)

Reset device function.

Parameters
ctxClick object.
Note
Function has a small 200 milisecond delay.

@description This function is used to reset the device.

◆ pac1934_generic_read()

void pac1934_generic_read ( pac1934_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ pac1934_generic_write()

void pac1934_generic_write ( pac1934_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ pac1934_init()

PAC1934_RETVAL pac1934_init ( pac1934_t * ctx,
pac1934_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ pac1934_measure_current()

float pac1934_measure_current ( pac1934_t * ctx,
uint8_t channel )

Measure Current function.

Parameters
ctxClick object.
channelChannel from which to read.
Returns
result float value that represents current

Reads the current data from one of the _PAC1934_VSENSE registers, depending on the selected channel and converts it into float value expressed in mA.

Note
This command reads current from the time of the most recent refresh command.

@description This function measure Current function

◆ pac1934_measure_energy()

float pac1934_measure_energy ( pac1934_t * ctx,
uint8_t chann,
uint16_t samp_rate )

Measure Energy function.

Parameters
ctxClick object.
channchannel Channel from which to read.
samp_rate16-but data representing sample rate.

Reads the energy data from one of the _PAC1934_VPOWER registers, depending on the selected channel and converts it into float value expressed in Joules.

Note
This command reads power from the time of the most recent refresh command.
This function is not available for: PIC, dsPic and AVR based boards.

@description This function measure Energy function.

◆ pac1934_measure_power()

float pac1934_measure_power ( pac1934_t * ctx,
uint8_t channel )

Measure Power function.

Parameters
ctxClick object.
channelChannel from which to read.
Returns
result float value that represents power.

Reads the power data from one of the _PAC1934_VPOWER registers, depending on the selected channel and converts it into float value expressed in Watts.

Note
This command reads power from the time of the most recent refresh command.

@description This function measure Power function.

◆ pac1934_measure_voltage()

float pac1934_measure_voltage ( pac1934_t * ctx,
uint8_t channel )

Measure Voltage function.

Parameters
ctxClick object.
channelChannel from which to read.
Returns
result float value that represents voltage

Reads the voltage data from one of the _PAC1934_VBUS registers, depending on the selected channel and converts it into float value expressed in Volts.

Note
This command reads voltage from the time of the most recent refresh command.

@description This function measure Voltage function.

◆ pac1934_read_byte()

uint8_t pac1934_read_byte ( pac1934_t * ctx,
uint8_t rd_addr )

Read one byte function.

Parameters
ctxClick object.
rd_addr8-bit register address.
Returns
8-bit data from address specified register

@description Tunction reads single byte of data from specified register.

◆ pac1934_read_four_byte()

uint32_t pac1934_read_four_byte ( pac1934_t * ctx,
uint8_t rd_addr )

Read four bytes function.

Parameters
ctxClick object.
rd_addr8-bit register address.
Returns
32-bit data from address specified registers

@description This function reads 4 bytes of data from specified, registers.

◆ pac1934_read_reg()

void pac1934_read_reg ( pac1934_t * ctx,
uint8_t reg_addr,
uint8_t * output_data,
uint8_t cnt )

Read chosen number of bytes function.

Parameters
ctxClick object.
reg_addr8-bit register address.
output_dataoutputData data from address specified registers.
cnt8-bit register address.

@description This function reads user defined number bytes of data from specified, registers.

◆ pac1934_read_two_byte()

uint16_t pac1934_read_two_byte ( pac1934_t * ctx,
uint8_t rd_addr )

Read two bytes function.

Parameters
ctxClick object.
rd_addr8-bit register address.
Returns
16-bit data from address specified registers

@description This function reads 2 bytes of data from specified, registers.

◆ pac1934_send_command()

void pac1934_send_command ( pac1934_t * ctx,
uint8_t wr_cmd )

Send Command.

Parameters
ctxClick object.
wr_cmd8-bit command to execute.
Note
Calling this function with '_PAC1934_REFRESH_G_CMD' parameter will issue a global command to all the devices on the bus.

@description This function Executes refresh commands.

◆ pac1934_write_byte()

void pac1934_write_byte ( pac1934_t * ctx,
uint8_t wr_addr,
uint8_t wr_data )

Write one byte function.

Parameters
ctxClick object.
wr_addr8-bit register address.
wr_data8-bit data to be written into register.

@description Tunction writes single byte of data into specified register..