current14  2.1.0.0
Modules | Functions
Current 14 Click Driver

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

Modules

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

Functions

void current14_cfg_setup (current14_cfg_t *cfg)
 Current 14 configuration object setup function. More...
 
err_t current14_init (current14_t *ctx, current14_cfg_t *cfg)
 Current 14 initialization function. More...
 
err_t current14_default_cfg (current14_t *ctx)
 Current 14 default configuration function. More...
 
err_t current14_write_reg_byte (current14_t *ctx, uint8_t reg, uint8_t data_in)
 Current 14 write reg byte function. More...
 
err_t current14_write_reg_word (current14_t *ctx, uint8_t reg, uint16_t data_in)
 Current 14 write reg word function. More...
 
err_t current14_read_reg_byte (current14_t *ctx, uint8_t reg, uint8_t *data_out)
 Current 14 read reg byte function. More...
 
uint8_t current14_get_alert_pin (current14_t *ctx)
 Current 14 get alert pin function. More...
 
err_t current14_set_odr (current14_t *ctx, uint8_t odr)
 Current 14 set odr function. More...
 
err_t current14_read_data (current14_t *ctx, int16_t *data_out)
 Current 14 read data function. More...
 
err_t current14_calib_offset (current14_t *ctx)
 Current 14 calib offset function. More...
 
err_t current14_calib_resolution (current14_t *ctx, float calib_current)
 Current 14 calib resolution function. More...
 
err_t current14_get_current (current14_t *ctx, float *current)
 Current 14 get current function. More...
 

Detailed Description

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

◆ current14_calib_offset()

err_t current14_calib_offset ( current14_t ctx)

Current 14 calib offset function.

This function calibrates the zero current offset value.

Parameters
[in]ctx: Click context object. See current14_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.

◆ current14_calib_resolution()

err_t current14_calib_resolution ( current14_t ctx,
float  calib_current 
)

Current 14 calib resolution function.

This function calibrates the data resolution at the known load current.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[in]calib_current: The known load current used for calibrating data resolution.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function should only be called when a known amount of load current flows through the sensor and after calibrating zero current offset using current14_calib_offset function.

◆ current14_cfg_setup()

void current14_cfg_setup ( current14_cfg_t cfg)

Current 14 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ current14_default_cfg()

err_t current14_default_cfg ( current14_t ctx)

Current 14 default configuration function.

This function executes a default configuration of Current 14 Click board.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ current14_get_alert_pin()

uint8_t current14_get_alert_pin ( current14_t ctx)

Current 14 get alert pin function.

This function returns the alert pin logic state.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ current14_get_current()

err_t current14_get_current ( current14_t ctx,
float *  current 
)

Current 14 get current function.

This function reads the input current level [A].

Parameters
[in]ctx: Click context object. See current14_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
This function relies on calibrated zero current offset and data resolution. Refer to current14_calib_offset and current14_calib_resolution functions.

◆ current14_init()

err_t current14_init ( current14_t ctx,
current14_cfg_t cfg 
)

Current 14 initialization function.

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

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

◆ current14_read_data()

err_t current14_read_data ( current14_t ctx,
int16_t *  data_out 
)

Current 14 read data function.

This function reads the sensor raw data measurement.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[out]data_out: 16-bit signed RAW data output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current14_read_reg_byte()

err_t current14_read_reg_byte ( current14_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Current 14 read reg byte function.

This function reads a data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current14_set_odr()

err_t current14_set_odr ( current14_t ctx,
uint8_t  odr 
)

Current 14 set odr function.

This function sets the sensor output data rate.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[in]odr:
  • 0 - 20 Hz,
  • 1 - 100 Hz,
  • 2 - 200 Hz,
  • 3 - 1000 Hz.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current14_write_reg_byte()

err_t current14_write_reg_byte ( current14_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Current 14 write reg byte function.

This function writes a data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ current14_write_reg_word()

err_t current14_write_reg_word ( current14_t ctx,
uint8_t  reg,
uint16_t  data_in 
)

Current 14 write reg word function.

This function writes a data word starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See current14_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: 16-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.