pac1954 2.0.0.0
|
API for configuring and manipulating PAC1954 Click driver. More...
Topics | |
PAC1954 Registers List | |
List of registers of PAC1954 Click driver. | |
PAC1954 Registers Settings | |
Settings for registers of PAC1954 Click driver. | |
PAC1954 MikroBUS Map | |
MikroBUS pin mapping of PAC1954 Click driver. | |
Functions | |
void | pac1954_cfg_setup (pac1954_cfg_t *cfg) |
PAC1954 configuration object setup function. | |
err_t | pac1954_init (pac1954_t *ctx, pac1954_cfg_t *cfg) |
PAC1954 initialization function. | |
err_t | pac1954_default_cfg (pac1954_t *ctx) |
PAC1954 default configuration function. | |
err_t | pac1954_generic_write (pac1954_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
PAC1954 I2C writing function. | |
err_t | pac1954_generic_read (pac1954_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
PAC1954 I2C reading function. | |
err_t | pac1954_single_write (pac1954_t *ctx, uint8_t reg, uint8_t data_in) |
PAC1954 Single Byte Write Function. | |
err_t | pac1954_single_read (pac1954_t *ctx, uint8_t reg, uint8_t *data_out) |
PAC1954 Single Byte Read Function. | |
err_t | pac1954_set_address_pointer (pac1954_t *ctx, uint8_t reg) |
PAC1954 Set Address Pointer Function. | |
err_t | pac1954_read_last_access_reg (pac1954_t *ctx, uint8_t *data_out) |
PAC1954 Last Accessed Register Read Function. | |
err_t | pac1954_refresh_cmd (pac1954_t *ctx) |
PAC1954 Refresh Command. | |
err_t | pac1954_vol_refresh_cmd (pac1954_t *ctx) |
PAC1954 Volatile Refresh Command. | |
err_t | pac1954_get_measurement (pac1954_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint32_t *data_out) |
PAC1954 Get Measurement Function. | |
err_t | pac1954_get_acc_count (pac1954_t *ctx, uint32_t *data_out) |
PAC1954 Get Accumulator Count Function. | |
err_t | pac1954_get_acc_output (pac1954_t *ctx, uint8_t ch_sel, uint8_t *data_out) |
PAC1954 Get Accumulator Output Function. | |
err_t | pac1954_get_calc_measurement (pac1954_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint8_t meas_mode, float *data_out) |
PAC1954 Get Calculated Measurement Function. | |
void | pac1954_set_ch_8_sps (pac1954_t *ctx, uint8_t state) |
PAC1954 Slow Down Sampling Freq Of All Channels Function. | |
void | pac1954_enable (pac1954_t *ctx, uint8_t state) |
PAC1954 Power Control Function. | |
uint8_t | pac1954_get_alert2_status (pac1954_t *ctx) |
PAC1954 Get INT Pin State Function. | |
API for configuring and manipulating PAC1954 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void pac1954_cfg_setup | ( | pac1954_cfg_t * | cfg | ) |
PAC1954 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See pac1954_cfg_t object definition for detailed explanation. |
err_t pac1954_default_cfg | ( | pac1954_t * | ctx | ) |
PAC1954 default configuration function.
This function executes a default configuration of PAC1954 click board.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
0
- Success, -1
- Error.void pac1954_enable | ( | pac1954_t * | ctx, |
uint8_t | state ) |
PAC1954 Power Control Function.
This function executes a power control of the PAC1954 click using EN pin.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | state | : EN pin logic state. |
err_t pac1954_generic_read | ( | pac1954_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
PAC1954 I2C reading 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 pac1954_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 pac1954_generic_write | ( | pac1954_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
PAC1954 I2C writing 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 pac1954_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 pac1954_get_acc_count | ( | pac1954_t * | ctx, |
uint32_t * | data_out ) |
PAC1954 Get Accumulator Count Function.
This function can be used to get the accumulator count value.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[out] | data_out | : The accumulator count value. |
0
- Success, -1
- Error.err_t pac1954_get_acc_output | ( | pac1954_t * | ctx, |
uint8_t | ch_sel, | ||
uint8_t * | data_out ) |
PAC1954 Get Accumulator Output Function.
This function can be used to get the accumulator output value for the selected channel.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | ch_sel | : Channel selector. |
[out] | data_out | : The accumulator output values [7 bytes]. |
0
- Success, -1
- Error.uint8_t pac1954_get_alert2_status | ( | pac1954_t * | ctx | ) |
PAC1954 Get INT Pin State Function.
This function checks the state of the INT pin which has role as Alert2 pin by default.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
err_t pac1954_get_calc_measurement | ( | pac1954_t * | ctx, |
uint8_t | meas_sel, | ||
uint8_t | ch_sel, | ||
uint8_t | avg_sel, | ||
uint8_t | meas_mode, | ||
float * | data_out ) |
PAC1954 Get Calculated Measurement Function.
This function calls the function for getting the selected measurement data and performs all the necessary calculations to get the measurement value in standard unit.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | meas_sel | : Measurement data selector. |
[in] | ch_sel | : Channel selector. |
[in] | avg_sel | : Selector for using averaged or one sample data. This parameter will be ignored for reading Power measurement. |
[in] | meas_mode | : Measurement type of data selector. |
[out] | data_out | : The calculated measurement data. |
0
- Success, -1
- Error.err_t pac1954_get_measurement | ( | pac1954_t * | ctx, |
uint8_t | meas_sel, | ||
uint8_t | ch_sel, | ||
uint8_t | avg_sel, | ||
uint32_t * | data_out ) |
PAC1954 Get Measurement Function.
This function can be used to get the target measurement data for the desired channel.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | meas_sel | : Measurement data selector. |
[in] | ch_sel | : Channel selector. |
[in] | avg_sel | : Selector for using averaged or one sample data. This parameter will be ignored for reading Power measurement. |
[out] | data_out | : The target measurement data. |
0
- Success, -1
- Error.err_t pac1954_init | ( | pac1954_t * | ctx, |
pac1954_cfg_t * | cfg ) |
PAC1954 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See pac1954_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1954_read_last_access_reg | ( | pac1954_t * | ctx, |
uint8_t * | data_out ) |
PAC1954 Last Accessed Register Read 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 pac1954_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t pac1954_refresh_cmd | ( | pac1954_t * | ctx | ) |
PAC1954 Refresh Command.
This function updates the readable registers for the VBUS, VSENSE, Power, accumulator outputs and accumulator count by issuing the REFRESH command. The values will be static until the next REFRESH command.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t pac1954_set_address_pointer | ( | pac1954_t * | ctx, |
uint8_t | reg ) |
PAC1954 Set Address Pointer Function.
This function allows user to set the internal address pointer on the desired register.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | reg | : Register address. |
0
- Success, -1
- Error.void pac1954_set_ch_8_sps | ( | pac1954_t * | ctx, |
uint8_t | state ) |
PAC1954 Slow Down Sampling Freq Of All Channels Function.
This function sets sampling frequency at 8 SPS for all channels using SLW pin.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | state | : SLW pin logic state. |
err_t pac1954_single_read | ( | pac1954_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
PAC1954 Single Byte Read Function.
This function reads single data byte from the selected register.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t pac1954_single_write | ( | pac1954_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
PAC1954 Single Byte Write Function.
This function writes single data byte to the selected register.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.err_t pac1954_vol_refresh_cmd | ( | pac1954_t * | ctx | ) |
PAC1954 Volatile Refresh Command.
If the user wants to read VSENSE and VBUS results, the most recent Power calculation, and/or the accumulator values and count without resetting the accumulators, this command may be sent.
[in] | ctx | : Click context object. See pac1954_t object definition for detailed explanation. |
0
- Success, -1
- Error.