currentsens2 2.1.0.0
Current Sens 2 Click Driver

API for configuring and manipulating Current Sens 2 Click driver. More...

Topics

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

Functions

void currentsens2_cfg_setup (currentsens2_cfg_t *cfg)
 Current Sens 2 configuration object setup function.
 
err_t currentsens2_init (currentsens2_t *ctx, currentsens2_cfg_t *cfg)
 Current Sens 2 initialization function.
 
err_t currentsens2_read_an_pin_value (currentsens2_t *ctx, uint16_t *data_out)
 Current Sens 2 read AN pin value function.
 
err_t currentsens2_read_an_pin_vol (currentsens2_t *ctx, float *data_out)
 Current Sens 2 read AN pin voltage level function.
 
uint8_t currentsens2_get_int_pin (currentsens2_t *ctx)
 Current Sens 2 get int pin state function.
 
void currentsens2_set_prim_turn_no (currentsens2_t *ctx, uint8_t turns)
 Current Sens 2 set number of primary coil turns function.
 
err_t currentsens2_tare (currentsens2_t *ctx)
 Current Sens 2 tare function.
 
err_t currentsens2_get_current (currentsens2_t *ctx, float *current)
 Current Sens 2 read current function.
 

Detailed Description

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

◆ currentsens2_cfg_setup()

void currentsens2_cfg_setup ( currentsens2_cfg_t * cfg)

Current Sens 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ currentsens2_get_current()

err_t currentsens2_get_current ( currentsens2_t * ctx,
float * current )

Current Sens 2 read current function.

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

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

◆ currentsens2_get_int_pin()

uint8_t currentsens2_get_int_pin ( currentsens2_t * ctx)

Current Sens 2 get int pin state function.

This function is used to read int pin state.

Parameters
[in]ctx: Click context object. See currentsens2_t object definition for detailed explanation.
Returns
  • 0 - Pin state low,
  • -1 - Pin state high.
Note
None.

◆ currentsens2_init()

err_t currentsens2_init ( currentsens2_t * ctx,
currentsens2_cfg_t * cfg )

Current Sens 2 initialization function.

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

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

◆ currentsens2_read_an_pin_value()

err_t currentsens2_read_an_pin_value ( currentsens2_t * ctx,
uint16_t * data_out )

Current Sens 2 read AN pin value function.

This function reads results of AD conversion of the AN pin.

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

◆ currentsens2_read_an_pin_vol()

err_t currentsens2_read_an_pin_vol ( currentsens2_t * ctx,
float * data_out )

Current Sens 2 read AN pin voltage level function.

This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See currentsens2_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ currentsens2_set_prim_turn_no()

void currentsens2_set_prim_turn_no ( currentsens2_t * ctx,
uint8_t turns )

Current Sens 2 set number of primary coil turns function.

This function is used to set number of primary coil turns function.

Parameters
[in]ctx: Click context object. See currentsens2_t object definition for detailed explanation.
[in]turns: Number of primary coil turns.
Returns
Nothing.
Note
None.

◆ currentsens2_tare()

err_t currentsens2_tare ( currentsens2_t * ctx)

Current Sens 2 tare function.

This function is used to set zero ampere reference.

Parameters
[in]ctx: Click context object. See currentsens2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.