pac1934 2.0.0.0
|
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. | |
float pac1934_calc_power | ( | pac1934_t * | ctx, |
float | voltage, | ||
float | amperage ) |
Calculate Power function.
ctx | Click object. |
voltage | Float value representing the voltage. |
amperage | Float value representing the amperage. |
@description This function is used to calculate power by multiplying voltage and amperage.
void pac1934_cfg_setup | ( | pac1934_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
uint8_t pac1934_check_interrupt | ( | pac1934_t * | ctx | ) |
Check Interrupt function.
ctx | Click object. |
@description This function is used to check the state of INT pin.
void pac1934_dev_disable | ( | pac1934_t * | ctx | ) |
Disable device function.
ctx | Click object. |
@description This function is used to disable the device.
void pac1934_dev_enable | ( | pac1934_t * | ctx | ) |
Enable device function.
ctx | Click object. |
@description This function is used to disable the device.
void pac1934_dev_reset | ( | pac1934_t * | ctx | ) |
Reset device function.
ctx | Click object. |
@description This function is used to reset the device.
void pac1934_generic_read | ( | pac1934_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic read function.
ctx | Click object. |
reg | Register address. |
data_buf | Output data buf |
len | Number of the bytes to be read |
@description This function reads data from the desired register.
void pac1934_generic_write | ( | pac1934_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic write function.
ctx | Click object. |
reg | Register address. |
data_buf | Data buf to be written. |
len | Number of the bytes in data buf. |
@description This function writes data to the desired register.
PAC1934_RETVAL pac1934_init | ( | pac1934_t * | ctx, |
pac1934_cfg_t * | cfg ) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
float pac1934_measure_current | ( | pac1934_t * | ctx, |
uint8_t | channel ) |
Measure Current function.
ctx | Click object. |
channel | Channel from which to read. |
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.
@description This function measure Current function
float pac1934_measure_energy | ( | pac1934_t * | ctx, |
uint8_t | chann, | ||
uint16_t | samp_rate ) |
Measure Energy function.
ctx | Click object. |
chann | channel Channel from which to read. |
samp_rate | 16-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.
@description This function measure Energy function.
float pac1934_measure_power | ( | pac1934_t * | ctx, |
uint8_t | channel ) |
Measure Power function.
ctx | Click object. |
channel | Channel from which to read. |
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.
@description This function measure Power function.
float pac1934_measure_voltage | ( | pac1934_t * | ctx, |
uint8_t | channel ) |
Measure Voltage function.
ctx | Click object. |
channel | Channel from which to read. |
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.
@description This function measure Voltage function.
uint8_t pac1934_read_byte | ( | pac1934_t * | ctx, |
uint8_t | rd_addr ) |
Read one byte function.
ctx | Click object. |
rd_addr | 8-bit register address. |
@description Tunction reads single byte of data from specified register.
uint32_t pac1934_read_four_byte | ( | pac1934_t * | ctx, |
uint8_t | rd_addr ) |
Read four bytes function.
ctx | Click object. |
rd_addr | 8-bit register address. |
@description This function reads 4 bytes of data from specified, registers.
void pac1934_read_reg | ( | pac1934_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t * | output_data, | ||
uint8_t | cnt ) |
Read chosen number of bytes function.
ctx | Click object. |
reg_addr | 8-bit register address. |
output_data | outputData data from address specified registers. |
cnt | 8-bit register address. |
@description This function reads user defined number bytes of data from specified, registers.
uint16_t pac1934_read_two_byte | ( | pac1934_t * | ctx, |
uint8_t | rd_addr ) |
Read two bytes function.
ctx | Click object. |
rd_addr | 8-bit register address. |
@description This function reads 2 bytes of data from specified, registers.
void pac1934_send_command | ( | pac1934_t * | ctx, |
uint8_t | wr_cmd ) |
Send Command.
ctx | Click object. |
wr_cmd | 8-bit command to execute. |
@description This function Executes refresh commands.
void pac1934_write_byte | ( | pac1934_t * | ctx, |
uint8_t | wr_addr, | ||
uint8_t | wr_data ) |
Write one byte function.
ctx | Click object. |
wr_addr | 8-bit register address. |
wr_data | 8-bit data to be written into register. |
@description Tunction writes single byte of data into specified register..