pac1720 2.0.0.0
|
API for configuring and manipulating PAC1720 Click driver. More...
Topics | |
PAC1720 Registers List | |
List of registers of PAC1720 Click driver. | |
PAC1720 Registers Settings | |
Settings for registers of PAC1720 Click driver. | |
PAC1720 MikroBUS Map | |
MikroBUS pin mapping of PAC1720 Click driver. | |
Functions | |
void | pac1720_cfg_setup (pac1720_cfg_t *cfg) |
PAC1720 configuration object setup function. | |
err_t | pac1720_init (pac1720_t *ctx, pac1720_cfg_t *cfg) |
PAC1720 initialization function. | |
err_t | pac1720_default_cfg (pac1720_t *ctx) |
PAC1720 default configuration function. | |
err_t | pac1720_write_block (pac1720_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
PAC1720 write block function. | |
err_t | pac1720_read_block (pac1720_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
PAC1720 read block function. | |
err_t | pac1720_write_byte (pac1720_t *ctx, uint8_t reg, uint8_t data_in) |
PAC1720 write byte function. | |
err_t | pac1720_read_byte (pac1720_t *ctx, uint8_t reg, uint8_t *data_out) |
PAC1720 read byte function. | |
err_t | pac1720_set_address_pointer (pac1720_t *ctx, uint8_t reg) |
PAC1720 set address pointer function. | |
err_t | pac1720_read_last_accessed_register (pac1720_t *ctx, uint8_t *data_out) |
PAC1720 read last accessed register function. | |
err_t | pac1720_set_slave_address (pac1720_t *ctx, uint8_t slave_address) |
PAC1720 set slave address function. | |
uint8_t | pac1720_get_int_pin (pac1720_t *ctx) |
PAC1720 get int pin function. | |
err_t | pac1720_check_communication (pac1720_t *ctx) |
PAC1720 check communication function. | |
err_t | pac1720_set_vsource_config (pac1720_t *ctx, pac1720_ch_sel_t ch, pac1720_sample_time_t stime, pac1720_avg_t avg) |
PAC1720 set vsource config function. | |
err_t | pac1720_set_vsense_config (pac1720_t *ctx, pac1720_ch_sel_t ch, pac1720_sample_time_t stime, pac1720_avg_t avg, pac1720_cs_rng_t cs_rng) |
PAC1720 set vsense config function. | |
err_t | pac1720_get_measurements (pac1720_t *ctx, pac1720_ch_sel_t ch, float *voltage, float *current, float *power) |
PAC1720 get measurements function. | |
API for configuring and manipulating PAC1720 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void pac1720_cfg_setup | ( | pac1720_cfg_t * | cfg | ) |
PAC1720 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See pac1720_cfg_t object definition for detailed explanation. |
err_t pac1720_check_communication | ( | pac1720_t * | ctx | ) |
PAC1720 check communication function.
This function checks the communication by reading and verifying the product ID.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1720_default_cfg | ( | pac1720_t * | ctx | ) |
PAC1720 default configuration function.
This function executes a default configuration of PAC1720 click board.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t pac1720_get_int_pin | ( | pac1720_t * | ctx | ) |
PAC1720 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
err_t pac1720_get_measurements | ( | pac1720_t * | ctx, |
pac1720_ch_sel_t | ch, | ||
float * | voltage, | ||
float * | current, | ||
float * | power ) |
PAC1720 get measurements function.
This function reads voltage, current, and power from the selected channel.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | ch | : Channel selection. See pac1720_ch_sel_t enum definition for detailed explanation. |
[out] | voltage | : Voltage [V]. |
[out] | current | : Current [A]. |
[out] | power | : Power [W]. |
0
- Success, -1
- Error.err_t pac1720_init | ( | pac1720_t * | ctx, |
pac1720_cfg_t * | cfg ) |
PAC1720 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See pac1720_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1720_read_block | ( | pac1720_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
PAC1720 read block function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t pac1720_read_byte | ( | pac1720_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
PAC1720 read byte function.
This function reads single data byte from the selected register.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t pac1720_read_last_accessed_register | ( | pac1720_t * | ctx, |
uint8_t * | data_out ) |
PAC1720 read last accessed register function.
This function allows user to read the last accessed register address, on which the internal address pointer is currently set.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t pac1720_set_address_pointer | ( | pac1720_t * | ctx, |
uint8_t | reg ) |
PAC1720 set address pointer function.
This function allows user to set the internal address pointer on the desired register.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | reg | : Register address. |
0
- Success, -1
- Error.err_t pac1720_set_slave_address | ( | pac1720_t * | ctx, |
uint8_t | slave_address ) |
PAC1720 set slave address function.
This function sets the slave address for I2C communication.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | slave_address | : Slave address. |
0
- Success, -1
- Error.err_t pac1720_set_vsense_config | ( | pac1720_t * | ctx, |
pac1720_ch_sel_t | ch, | ||
pac1720_sample_time_t | stime, | ||
pac1720_avg_t | avg, | ||
pac1720_cs_rng_t | cs_rng ) |
PAC1720 set vsense config function.
This function sets the Voltage Sense configuration (sample time, average samples, and sampling range) for the selected channel.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | ch | : Channel selection. See pac1720_ch_sel_t enum definition for detailed explanation. |
[in] | stime | : Sample time selection. See pac1720_sample_time_t enum definition for detailed explanation. |
[in] | avg | : Average samples selection. See pac1720_avg_t enum definition for detailed explanation. |
[in] | cs_rng | : Current sampling range selection. See pac1720_cs_rng_t enum definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1720_set_vsource_config | ( | pac1720_t * | ctx, |
pac1720_ch_sel_t | ch, | ||
pac1720_sample_time_t | stime, | ||
pac1720_avg_t | avg ) |
PAC1720 set vsource config function.
This function sets the Voltage Source configuration (sample time and average samples) for the selected channel.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | ch | : Channel selection. See pac1720_ch_sel_t enum definition for detailed explanation. |
[in] | stime | : Sample time selection. See pac1720_sample_time_t enum definition for detailed explanation. |
[in] | avg | : Average samples selection. See pac1720_avg_t enum definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1720_write_block | ( | pac1720_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
PAC1720 write block function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error.err_t pac1720_write_byte | ( | pac1720_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
PAC1720 write byte function.
This function writes single data byte to the selected register.
[in] | ctx | : Click context object. See pac1720_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.