pac1944 2.0.0.0
|
API for configuring and manipulating PAC1944 Click driver. More...
Topics | |
PAC1944 Registers List | |
List of registers of PAC1944 Click driver. | |
PAC1944 Registers Settings | |
Settings for registers of PAC1944 Click driver. | |
PAC1944 MikroBUS Map | |
MikroBUS pin mapping of PAC1944 Click driver. | |
Meas_sel | |
Ch_sel | |
Avg_sel | |
Meas_mode | |
State | |
Functions | |
void | pac1944_cfg_setup (pac1944_cfg_t *cfg) |
PAC1944 configuration object setup function. | |
err_t | pac1944_init (pac1944_t *ctx, pac1944_cfg_t *cfg) |
PAC1944 initialization function. | |
void | pac1944_default_cfg (pac1944_t *ctx) |
PAC1944 default configuration function. | |
void | pac1944_set_slow_state (pac1944_t *ctx, uint8_t state) |
PAC1944 set slow state function. | |
void | pac1944_device_state (pac1944_t *ctx, uint8_t state) |
PAC1944 set device state function. | |
uint8_t | pac1944_get_alert_state (pac1944_t *ctx) |
PAC1944 get alert state function. | |
err_t | pac1944_generic_write (pac1944_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
PAC1944 I2C writing function. | |
err_t | pac1944_generic_read (pac1944_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
PAC1944 I2C reading function. | |
void | pac1944_setup_config (pac1944_t *ctx, pac1944_setup_t cfg_data) |
PAC1944 setup config function. | |
void | pac1944_set_address_pointer (pac1944_t *ctx, uint8_t reg_addr) |
PAC1944 set address pointer function. | |
uint8_t | pac1944_read_last_accessed_register (pac1944_t *ctx) |
PAC1944 last accessed register read function. | |
void | pac1944_general_refresh_cmd (pac1944_t *ctx) |
PAC1944 general refresh command. | |
void | pac1944_refresh_cmd (pac1944_t *ctx) |
PAC1944 refresh command. | |
void | pac1944_volatile_refresh_cmd (pac1944_t *ctx) |
PAC1944 volatile refresh command. | |
uint32_t | pac1944_get_accumulator_count (pac1944_t *ctx) |
PAC1944 accumulator count function. | |
void | pac1944_get_accumulator_output (pac1944_t *ctx, uint8_t ch_sel, uint8_t *acc_out) |
PAC1944 get accumulator output function. | |
uint32_t | pac1944_get_measurement (pac1944_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel) |
PAC1944 get measurement function. | |
float | pac1944_get_calc_measurement (pac1944_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint8_t meas_mode) |
PAC1944 get calculated measurement function. | |
API for configuring and manipulating PAC1944 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void pac1944_cfg_setup | ( | pac1944_cfg_t * | cfg | ) |
PAC1944 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See pac1944_cfg_t object definition for detailed explanation. |
void pac1944_default_cfg | ( | pac1944_t * | ctx | ) |
PAC1944 default configuration function.
This function executes a default configuration of PAC1944 click board.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
void pac1944_device_state | ( | pac1944_t * | ctx, |
uint8_t | state ) |
PAC1944 set device state function.
This function sets the state of en pin.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | state | : Pin state.
|
void pac1944_general_refresh_cmd | ( | pac1944_t * | ctx | ) |
PAC1944 general refresh command.
This function result is identical to the REFRESH command, but it is used with the I2C General Call address (0000 000).
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
err_t pac1944_generic_read | ( | pac1944_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
PAC1944 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 pac1944_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 pac1944_generic_write | ( | pac1944_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
PAC1944 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 pac1944_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.uint32_t pac1944_get_accumulator_count | ( | pac1944_t * | ctx | ) |
PAC1944 accumulator count function.
This function can be used to acquire the accumulator count value.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
void pac1944_get_accumulator_output | ( | pac1944_t * | ctx, |
uint8_t | ch_sel, | ||
uint8_t * | acc_out ) |
PAC1944 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 pac1944_t object definition for detailed explanation. |
[in] | ch_sel | : Channel selection.
|
[out] | acc_out | : Pointer to accumulator output data store. |
uint8_t pac1944_get_alert_state | ( | pac1944_t * | ctx | ) |
PAC1944 get alert state function.
This function checks the state of int pin.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
0
( PAC1944_ALERT_ACTIVE ) - Alert triggered, 1
( PAC1944_ALERT_INACTIVE ) - Alert on standby.float pac1944_get_calc_measurement | ( | pac1944_t * | ctx, |
uint8_t | meas_sel, | ||
uint8_t | ch_sel, | ||
uint8_t | avg_sel, | ||
uint8_t | meas_mode ) |
PAC1944 get calculated measurement function.
This function returns calculated measurement depending on the settings.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | meas_sel | : Measurement selection.
|
[in] | ch_sel | : Channel selection.
|
[in] | avg_sel | : Sets the averaging mode of measurements.
|
[in] | meas_mode | : Measure mode selection.
|
uint32_t pac1944_get_measurement | ( | pac1944_t * | ctx, |
uint8_t | meas_sel, | ||
uint8_t | ch_sel, | ||
uint8_t | avg_sel ) |
PAC1944 get measurement function.
This function can be used to get the target measurement raw data for the desired channel.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | meas_sel | : Measurement selection.
|
[in] | ch_sel | : Channel selection.
|
[in] | avg_sel | : Sets the averaging mode of measurements.
|
err_t pac1944_init | ( | pac1944_t * | ctx, |
pac1944_cfg_t * | cfg ) |
PAC1944 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See pac1944_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t pac1944_read_last_accessed_register | ( | pac1944_t * | ctx | ) |
PAC1944 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 pac1944_t object definition for detailed explanation. |
void pac1944_refresh_cmd | ( | pac1944_t * | ctx | ) |
PAC1944 refresh command.
The readable registers for the VBUS, VSENSE, Power, accumulator outputs and accumulator count are updated by the REFRESH command and the values will be static until the next REFRESH command.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
void pac1944_set_address_pointer | ( | pac1944_t * | ctx, |
uint8_t | reg_addr ) |
PAC1944 set address pointer function.
This function allows user to set the internal address pointer on the desired register.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | reg_addr | : Targeted register address. |
void pac1944_set_slow_state | ( | pac1944_t * | ctx, |
uint8_t | state ) |
PAC1944 set slow state function.
This function sets the state of slw pin.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | state | : Pin state.
|
void pac1944_setup_config | ( | pac1944_t * | ctx, |
pac1944_setup_t | cfg_data ) |
PAC1944 setup config function.
This function checks the state of int pin.
[in] | ctx | : Click context object. See pac1944_t object definition for detailed explanation. |
[in] | cfg_data | : Configuration for setup of the device. |
void pac1944_volatile_refresh_cmd | ( | pac1944_t * | ctx | ) |
PAC1944 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 pac1944_t object definition for detailed explanation. |