current11  2.1.0.0
Modules | Functions
Current 11 Click Driver

API for configuring and manipulating Current 11 Click driver. More...

Modules

 Current 11 Registers Settings
 Settings for registers of Current 11 Click driver.
 
 Current 11 MikroBUS Map
 MikroBUS pin mapping of Current 11 Click driver.
 

Functions

void current11_cfg_setup (current11_cfg_t *cfg)
 Current 11 configuration object setup function. More...
 
void current11_drv_interface_sel (current11_cfg_t *cfg, current11_drv_t drv_sel)
 Current 11 driver interface setup function. More...
 
err_t current11_init (current11_t *ctx, current11_cfg_t *cfg)
 Current 11 initialization function. More...
 
err_t current11_read_raw_adc (current11_t *ctx, uint16_t *raw_adc)
 Current 11 read raw ADC value function. More...
 
err_t current11_read_voltage (current11_t *ctx, float *voltage)
 Current 11 read voltage level function. More...
 
err_t current11_set_vref (current11_t *ctx, float vref)
 Current 11 set vref function. More...
 
err_t current11_calibrate_offset (current11_t *ctx)
 Current 11 calibrate offset function. More...
 
err_t current11_read_current (current11_t *ctx, float *current)
 Current 11 read current function. More...
 

Detailed Description

API for configuring and manipulating Current 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

◆ current11_calibrate_offset()

err_t current11_calibrate_offset ( current11_t ctx)

Current 11 calibrate offset function.

This function calibrates the zero current offset value.

Parameters
[in]ctx: Click context object. See current11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function should only be called when no current flows through the sensor.

◆ current11_cfg_setup()

void current11_cfg_setup ( current11_cfg_t cfg)

Current 11 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ current11_drv_interface_sel()

void current11_drv_interface_sel ( current11_cfg_t cfg,
current11_drv_t  drv_sel 
)

Current 11 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See current11_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See current11_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ current11_init()

err_t current11_init ( current11_t ctx,
current11_cfg_t cfg 
)

Current 11 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See current11_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See current11_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current11_read_current()

err_t current11_read_current ( current11_t ctx,
float *  current 
)

Current 11 read current function.

This function reads the input current level [A] based on CURRENT11_NUM_CONVERSIONS of voltage measurements.

Parameters
[in]ctx: Click context object. See current11_t object definition for detailed explanation.
[out]current: Input current level [A].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
For better accuracy, set the voltage reference by using the current11_set_vref function, increase the number of conversions by modifying the CURRENT11_NUM_CONVERSIONS macro, and adjust the CURRENT11_COUPLING_FACTOR_G_A value.

◆ current11_read_raw_adc()

err_t current11_read_raw_adc ( current11_t ctx,
uint16_t *  raw_adc 
)

Current 11 read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See current11_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current11_read_voltage()

err_t current11_read_voltage ( current11_t ctx,
float *  voltage 
)

Current 11 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See current11_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ current11_set_vref()

err_t current11_set_vref ( current11_t ctx,
float  vref 
)

Current 11 set vref function.

This function sets the voltage reference for Current 11 click driver.

Parameters
[in]ctx: Click context object. See current11_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with current11_init is 3.3V.