pwrmeter3 2.1.0.0
|
API for configuring and manipulating PWR Meter 3 Click driver. More...
Topics | |
PWR Meter 3 Registers List | |
List of registers of PWR Meter 3 Click driver. | |
PWR Meter 3 Registers Settings | |
Settings for registers of PWR Meter 3 Click driver. | |
PWR Meter 3 MikroBUS Map | |
MikroBUS pin mapping of PWR Meter 3 Click driver. | |
Functions | |
void | pwrmeter3_cfg_setup (pwrmeter3_cfg_t *cfg) |
PWR Meter 3 configuration object setup function. | |
err_t | pwrmeter3_init (pwrmeter3_t *ctx, pwrmeter3_cfg_t *cfg) |
PWR Meter 3 initialization function. | |
err_t | pwrmeter3_default_cfg (pwrmeter3_t *ctx) |
PWR Meter 3 default configuration function. | |
err_t | pwrmeter3_write_register (pwrmeter3_t *ctx, uint8_t reg, uint32_t data_in) |
PWR Meter 3 write register function. | |
err_t | pwrmeter3_read_register (pwrmeter3_t *ctx, uint8_t reg, uint32_t *data_out) |
PWR Meter 3 read register function. | |
uint8_t | pwrmeter3_get_dio0_pin (pwrmeter3_t *ctx) |
PWR Meter 3 get dio0 pin function. | |
uint8_t | pwrmeter3_get_dio1_pin (pwrmeter3_t *ctx) |
PWR Meter 3 get dio1 pin function. | |
void | pwrmeter3_enable_device (pwrmeter3_t *ctx) |
PWR Meter 3 enable device function. | |
void | pwrmeter3_disable_device (pwrmeter3_t *ctx) |
PWR Meter 3 disable device function. | |
err_t | pwrmeter3_allow_write_access (pwrmeter3_t *ctx) |
PWR Meter 3 allow write access function. | |
err_t | pwrmeter3_deny_write_access (pwrmeter3_t *ctx) |
PWR Meter 3 deny write access function. | |
err_t | pwrmeter3_set_bypass_n_state (pwrmeter3_t *ctx, uint8_t state) |
PWR Meter 3 set bypass n state function. | |
err_t | pwrmeter3_set_num_samples (pwrmeter3_t *ctx, uint16_t num_samples) |
PWR Meter 3 set num samples function. | |
err_t | pwrmeter3_set_dio0_sel (pwrmeter3_t *ctx, uint8_t dio_sel) |
PWR Meter 3 set dio0 sel function. | |
err_t | pwrmeter3_set_dio1_sel (pwrmeter3_t *ctx, uint8_t dio_sel) |
PWR Meter 3 set dio1 sel function. | |
err_t | pwrmeter3_set_ovrms_threshold (pwrmeter3_t *ctx, uint8_t ovrms) |
PWR Meter 3 set ovrms threshold function. | |
err_t | pwrmeter3_set_uvrms_threshold (pwrmeter3_t *ctx, uint8_t uvrms) |
PWR Meter 3 set uvrms threshold function. | |
err_t | pwrmeter3_read_rms (pwrmeter3_t *ctx, float *v_rms, float *i_rms) |
PWR Meter 3 read rms function. | |
err_t | pwrmeter3_read_average_rms (pwrmeter3_t *ctx, float *v_rms, float *i_rms, uint16_t num_avg) |
PWR Meter 3 read average rms function. | |
API for configuring and manipulating PWR Meter 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
err_t pwrmeter3_allow_write_access | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 allow write access function.
This function allows writing to registers by setting the correct write access code.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void pwrmeter3_cfg_setup | ( | pwrmeter3_cfg_t * | cfg | ) |
PWR Meter 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See pwrmeter3_cfg_t object definition for detailed explanation. |
err_t pwrmeter3_default_cfg | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 default configuration function.
This function executes a default configuration of PWR Meter 3 click board.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_deny_write_access | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 deny write access function.
This function denies writing to registers by setting the wrong write access code.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void pwrmeter3_disable_device | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 disable device function.
This function disables device by setting the EN pin to HIGH logic state.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
void pwrmeter3_enable_device | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 enable device function.
This function enables device by setting the EN pin to LOW logic state.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
uint8_t pwrmeter3_get_dio0_pin | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 get dio0 pin function.
This function returns the DIO0 pin logic state.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
uint8_t pwrmeter3_get_dio1_pin | ( | pwrmeter3_t * | ctx | ) |
PWR Meter 3 get dio1 pin function.
This function returns the DIO1 pin logic state.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
err_t pwrmeter3_init | ( | pwrmeter3_t * | ctx, |
pwrmeter3_cfg_t * | cfg ) |
PWR Meter 3 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See pwrmeter3_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_read_average_rms | ( | pwrmeter3_t * | ctx, |
float * | v_rms, | ||
float * | i_rms, | ||
uint16_t | num_avg ) |
PWR Meter 3 read average rms function.
This function reads the voltage and current RMS measurements averaged from a specified number of samples.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[out] | v_rms | : Averaged voltage RMS measurement in Volts. |
[out] | i_rms | : Averaged current RMS measurement in Ampers. |
[in] | num_avg | : Number of samples for averaging RMS measurements. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_read_register | ( | pwrmeter3_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out ) |
PWR Meter 3 read register function.
This function reads a 32-bit data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_read_rms | ( | pwrmeter3_t * | ctx, |
float * | v_rms, | ||
float * | i_rms ) |
PWR Meter 3 read rms function.
This function reads the voltage and current RMS measurements.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[out] | v_rms | : Voltage RMS measurement in Volts. |
[out] | i_rms | : Current RMS measurement in Ampers. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_bypass_n_state | ( | pwrmeter3_t * | ctx, |
uint8_t | state ) |
PWR Meter 3 set bypass n state function.
This function sets whether RMS is calculated based on voltage zero crossing (AC measurement) or predefined num samples (DC measurement).
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | state | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_dio0_sel | ( | pwrmeter3_t * | ctx, |
uint8_t | dio_sel ) |
PWR Meter 3 set dio0 sel function.
This function sets the DIO0 selection. Determines which flags are output on the DIO0 pin.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | dio_sel | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_dio1_sel | ( | pwrmeter3_t * | ctx, |
uint8_t | dio_sel ) |
PWR Meter 3 set dio1 sel function.
This function sets the DIO1 selection. Determines which flags are output on the DIO1 pin.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | dio_sel | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_num_samples | ( | pwrmeter3_t * | ctx, |
uint16_t | num_samples ) |
PWR Meter 3 set num samples function.
This function sets the number of samples for RMS calculations. Bypass N state must be set/true for this to have effect.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | num_samples | : 0-1023 samples, |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_ovrms_threshold | ( | pwrmeter3_t * | ctx, |
uint8_t | ovrms ) |
PWR Meter 3 set ovrms threshold function.
This function sets the overvoltage RMS threshold.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | ovrms | : 0-63 steps, a single step represents about 9.3V, |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_set_uvrms_threshold | ( | pwrmeter3_t * | ctx, |
uint8_t | uvrms ) |
PWR Meter 3 set uvrms threshold function.
This function sets the undervoltage RMS threshold.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | uvrms | : 0-63 steps, a single step represents about 9.3V, |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t pwrmeter3_write_register | ( | pwrmeter3_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in ) |
PWR Meter 3 write register function.
This function writes a desired 32-bit data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See pwrmeter3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 32-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.