charger11 2.0.0.0
Charger 11 Click Driver

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.
 

Detailed Description

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.

Function Documentation

◆ charger11_cfg_setup()

void charger11_cfg_setup ( charger11_cfg_t * cfg)

Charger 11 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See charger11_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ charger11_get_int()

uint8_t charger11_get_int ( charger11_t * ctx)

Charger 11 getting INT pin state.

This function returns INT pin state.

Parameters
[in]ctx: Click context object. See charger11_t object definition for detailed explanation.
Returns
INT pin state.

◆ charger11_i2c_get_raw_data()

uint16_t charger11_i2c_get_raw_data ( charger11_t * ctx)

Charger 11 getting raw ADC data.

This function returns raw ADC data.

Parameters
[in]ctx: Click context object. See charger11_t object definition for detailed explanation.
Returns
ADC data.

◆ charger11_i2c_get_volt()

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.

Parameters
[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.
Returns
Output voltage in [V] or [mV].
Note
This function returns value in [V] if reference voltage is in [V].

◆ charger11_i2c_read()

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.

Parameters
[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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ charger11_i2c_write()

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.

Parameters
[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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ charger11_init()

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.

Parameters
[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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ charger11_lg_set()

void charger11_lg_set ( charger11_t * ctx,
uint8_t pin_state )

Charger 11 Setting PWM pin state.

This function sets PWM pin state

Parameters
[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).
Returns
Nothing.

◆ charger11_lr_set()

void charger11_lr_set ( charger11_t * ctx,
uint8_t pin_state )

Charger 11 setting AN pin state.

This function sets AN pin state.

Parameters
[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).
Returns
Nothing.

◆ charger11_spi_decrement_wiper()

void charger11_spi_decrement_wiper ( charger11_t * ctx)

Charger 11 decrementing wiper position.

This function decrements wiper position by sending 8bit decrement wiper command.

Parameters
[in]ctx: Click context object. See charger11_t object definition for detailed explanation.
Returns
Nothing.

◆ charger11_spi_get_register()

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.

Parameters
[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.
Returns
Nothing.

◆ charger11_spi_get_wiper_position()

uint8_t charger11_spi_get_wiper_position ( charger11_t * ctx)

Charger 11 getting wiper position.

This function returns wiper position.

Parameters
[in]ctx: Click context object. See charger11_t object definition for detailed explanation.
Returns
Wiper position.

◆ charger11_spi_increment_wiper()

void charger11_spi_increment_wiper ( charger11_t * ctx)

Charger 11 incrementing wiper position.

This function increments wiper position by sending 8bit increment wiper command.

Parameters
[in]ctx: Click context object. See charger11_t object definition for detailed explanation.
Returns
Nothing.

◆ charger11_spi_read()

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.

Parameters
[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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ charger11_spi_set_register()

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.

Parameters
[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.
Returns
Nothing.

◆ charger11_spi_transfer()

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.

Parameters
[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.
Returns
Nothing.

◆ charger11_spi_write()

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.

Parameters
[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.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.