powermonitor2
2.1.0.0
|
API for configuring and manipulating Power Monitor 2 Click driver. More...
Modules | |
Power Monitor 2 Registers List | |
List of registers of Power Monitor 2 Click driver. | |
Power Monitor 2 Registers Settings | |
Settings for registers of Power Monitor 2 Click driver. | |
Power Monitor 2 MikroBUS Map | |
MikroBUS pin mapping of Power Monitor 2 Click driver. | |
Functions | |
void | powermonitor2_cfg_setup (powermonitor2_cfg_t *cfg) |
Power Monitor 2 configuration object setup function. More... | |
err_t | powermonitor2_init (powermonitor2_t *ctx, powermonitor2_cfg_t *cfg) |
Power Monitor 2 initialization function. More... | |
err_t | powermonitor2_default_cfg (powermonitor2_t *ctx) |
Power Monitor 2 default configuration function. More... | |
err_t | powermonitor2_set_address (powermonitor2_t *ctx, uint8_t slave_address) |
Power Monitor 2 set slave address function. More... | |
err_t | powermonitor2_write_reg (powermonitor2_t *ctx, uint8_t reg, uint16_t data_in) |
Power Monitor 2 write reg function. More... | |
err_t | powermonitor2_read_reg (powermonitor2_t *ctx, uint8_t reg, uint16_t *data_out) |
Power Monitor 2 read reg function. More... | |
err_t | powermonitor2_read_data (powermonitor2_t *ctx, powermonitor2_data_t *data_out) |
Power Monitor 2 read data function. More... | |
err_t | powermonitor2_read_data_avg (powermonitor2_t *ctx, uint16_t num_conv, powermonitor2_data_t *data_out) |
Power Monitor 2 read data avg function. More... | |
API for configuring and manipulating Power Monitor 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void powermonitor2_cfg_setup | ( | powermonitor2_cfg_t * | cfg | ) |
Power Monitor 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See powermonitor2_cfg_t object definition for detailed explanation. |
err_t powermonitor2_default_cfg | ( | powermonitor2_t * | ctx | ) |
Power Monitor 2 default configuration function.
This function executes a default configuration of Power Monitor 2 Click board.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_init | ( | powermonitor2_t * | ctx, |
powermonitor2_cfg_t * | cfg | ||
) |
Power Monitor 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
[out] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See powermonitor2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_read_data | ( | powermonitor2_t * | ctx, |
powermonitor2_data_t * | data_out | ||
) |
Power Monitor 2 read data function.
This function reads the shunt voltage, bus voltage, current, and power data measurements.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[out] | data_out | : Power monitor data measurements. See powermonitor2_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_read_data_avg | ( | powermonitor2_t * | ctx, |
uint16_t | num_conv, | ||
powermonitor2_data_t * | data_out | ||
) |
Power Monitor 2 read data avg function.
This function reads the shunt voltage, bus voltage, current, and power data measurements averaged from num_conv samples.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[in] | num_conv | : Number of conversion samples. |
[out] | data_out | : Power monitor data measurements. See powermonitor2_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_read_reg | ( | powermonitor2_t * | ctx, |
uint8_t | reg, | ||
uint16_t * | data_out | ||
) |
Power Monitor 2 read reg function.
This function reads a data word from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : 16-bit output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_set_address | ( | powermonitor2_t * | ctx, |
uint8_t | slave_address | ||
) |
Power Monitor 2 set slave address function.
This function sets the device slave address.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[in] | slave_address | : I2C device slave address, should be ctx->address_3v3 or ctx->address_5v. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t powermonitor2_write_reg | ( | powermonitor2_t * | ctx, |
uint8_t | reg, | ||
uint16_t | data_in | ||
) |
Power Monitor 2 write reg function.
This function writes a data word to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See powermonitor2_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 16-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.