charger11 2.0.0.0
|
API for configuring and manipulating Charger 11 Click driver. More...
Topics | |
Charger 11 Registers List | |
List of registers of Charger 11 Click driver. | |
Charger 11 Registers Settings | |
Settings for registers of Charger 11 Click driver. | |
Charger 11 MikroBUS Map | |
MikroBUS pin mapping of Charger 11 Click driver. | |
Functions | |
void | charger11_cfg_setup (charger11_cfg_t *cfg) |
Charger 11 configuration object setup function. | |
err_t | charger11_init (charger11_t *ctx, charger11_cfg_t *cfg) |
Charger 11 initialization function. | |
err_t | charger11_i2c_write (charger11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Charger 11 I2C writing function. | |
err_t | charger11_i2c_read (charger11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Charger 11 I2C reading function. | |
err_t | charger11_spi_write (charger11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Charger 11 SPI writing function. | |
err_t | charger11_spi_read (charger11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Charger 11 SPI reading function. | |
uint8_t | charger11_get_int (charger11_t *ctx) |
Charger 11 getting INT pin state. | |
void | charger11_lr_set (charger11_t *ctx, uint8_t pin_state) |
Charger 11 setting AN pin state. | |
void | charger11_lg_set (charger11_t *ctx, uint8_t pin_state) |
Charger 11 Setting PWM pin state. | |
void | charger11_spi_transfer (charger11_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len) |
Charger 11 transfering bytes via SPI. | |
void | charger11_spi_set_register (charger11_t *ctx, uint8_t register_address, uint16_t register_value) |
Charger 11 setting register. | |
void | charger11_spi_get_register (charger11_t *ctx, uint8_t register_address, uint16_t *register_value) |
Charger 11 getting register value. | |
void | charger11_spi_increment_wiper (charger11_t *ctx) |
Charger 11 incrementing wiper position. | |
void | charger11_spi_decrement_wiper (charger11_t *ctx) |
Charger 11 decrementing wiper position. | |
uint8_t | charger11_spi_get_wiper_position (charger11_t *ctx) |
Charger 11 getting wiper position. | |
uint16_t | charger11_i2c_get_raw_data (charger11_t *ctx) |
Charger 11 getting raw ADC data. | |
float | charger11_i2c_get_volt (charger11_t *ctx, float reference_voltage) |
Charger 11 getting output voltage. | |
API for configuring and manipulating Charger 11 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void charger11_cfg_setup | ( | charger11_cfg_t * | cfg | ) |
Charger 11 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See charger11_cfg_t object definition for detailed explanation. |
uint8_t charger11_get_int | ( | charger11_t * | ctx | ) |
Charger 11 getting INT pin state.
This function returns INT pin state.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
uint16_t charger11_i2c_get_raw_data | ( | charger11_t * | ctx | ) |
Charger 11 getting raw ADC data.
This function returns raw ADC data.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
float charger11_i2c_get_volt | ( | charger11_t * | ctx, |
float | reference_voltage ) |
Charger 11 getting output voltage.
This function gets raw ADC data and converts it to voltage based on reference voltage.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | reference_voltage | : Voltage measured on 12bit ADC converter (MCP3221A5T) VDD pin. |
err_t charger11_i2c_read | ( | charger11_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Charger 11 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 charger11_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t charger11_i2c_write | ( | charger11_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Charger 11 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 charger11_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.err_t charger11_init | ( | charger11_t * | ctx, |
charger11_cfg_t * | cfg ) |
Charger 11 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See charger11_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.void charger11_lg_set | ( | charger11_t * | ctx, |
uint8_t | pin_state ) |
Charger 11 Setting PWM pin state.
This function sets PWM pin state
[out] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | pin_state | : PWM pin state (0 for LOW or 1 for HIGH). |
void charger11_lr_set | ( | charger11_t * | ctx, |
uint8_t | pin_state ) |
Charger 11 setting AN pin state.
This function sets AN pin state.
[out] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | pin_state | : AN pin state (0 for LOW or 1 for HIGH). |
void charger11_spi_decrement_wiper | ( | charger11_t * | ctx | ) |
Charger 11 decrementing wiper position.
This function decrements wiper position by sending 8bit decrement wiper command.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
void charger11_spi_get_register | ( | charger11_t * | ctx, |
uint8_t | register_address, | ||
uint16_t * | register_value ) |
Charger 11 getting register value.
This function gets register value of MCP4161 device.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | register_address | : Register address. |
[out] | register_value | : Address of a variable to store register value. |
uint8_t charger11_spi_get_wiper_position | ( | charger11_t * | ctx | ) |
Charger 11 getting wiper position.
This function returns wiper position.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
void charger11_spi_increment_wiper | ( | charger11_t * | ctx | ) |
Charger 11 incrementing wiper position.
This function increments wiper position by sending 8bit increment wiper command.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
err_t charger11_spi_read | ( | charger11_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Charger 11 SPI reading function.
This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.void charger11_spi_set_register | ( | charger11_t * | ctx, |
uint8_t | register_address, | ||
uint16_t | register_value ) |
Charger 11 setting register.
This function sets register value, and sends commands to MCP4161 device.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | register_address | : Register address. |
[in] | register_value | : Data to be written. |
void charger11_spi_transfer | ( | charger11_t * | ctx, |
uint8_t * | data_in, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Charger 11 transfering bytes via SPI.
This function transfers bytes via SPI to MCP4161 device.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to transfer. |
err_t charger11_spi_write | ( | charger11_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Charger 11 SPI writing function.
This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See charger11_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.