current5  2.0.0.0
Modules | Functions
Current 5 Click Driver

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

Modules

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

Functions

void current5_cfg_setup (current5_cfg_t *cfg)
 Current 5 configuration object setup function. More...
 
err_t current5_init (current5_t *ctx, current5_cfg_t *cfg)
 Current 5 initialization function. More...
 
err_t current5_default_cfg (current5_t *ctx)
 Current 5 default configuration function. More...
 
err_t current5_generic_read (current5_t *ctx, uint8_t *data_out, uint8_t len)
 Current 5 data reading function. More...
 
uint8_t current5_get_alert (current5_t *ctx)
 Get alert pin state. More...
 
void current5_set_rst (current5_t *ctx, uint8_t state)
 Mode selection. More...
 
err_t current5_get_adc (current5_t *ctx, uint16_t *adc_data)
 Read raw adc value. More...
 
err_t current5_get_voltage (current5_t *ctx, float *vout)
 Get voltage. More...
 
err_t current5_get_current (current5_t *ctx, float *current)
 Get current. More...
 

Detailed Description

API for configuring and manipulating Current 5 Click driver.

Function Documentation

◆ current5_cfg_setup()

void current5_cfg_setup ( current5_cfg_t cfg)

Current 5 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ current5_default_cfg()

err_t current5_default_cfg ( current5_t ctx)

Current 5 default configuration function.

This function executes a default configuration of Current 5 click board.

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

◆ current5_generic_read()

err_t current5_generic_read ( current5_t ctx,
uint8_t *  data_out,
uint8_t  len 
)

Current 5 data reading function.

This function reads a desired number of data bytes.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
[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.
Note
None.

◆ current5_get_adc()

err_t current5_get_adc ( current5_t ctx,
uint16_t *  adc_data 
)

Read raw adc value.

This function reads raw adc data.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
[out]adc_data: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ current5_get_alert()

uint8_t current5_get_alert ( current5_t ctx)

Get alert pin state.

This function reads a state of alert(int) pin.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
Returns
Alert pin state
Note
Active low.

◆ current5_get_current()

err_t current5_get_current ( current5_t ctx,
float *  current 
)

Get current.

This function gets voltage data from VOUT and calculates input current from it.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
[out]current: Output current data in A.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ current5_get_voltage()

err_t current5_get_voltage ( current5_t ctx,
float *  vout 
)

Get voltage.

This function reads adc data on VOUT pin and converts it to voltage.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
[out]vout: Output voltage data in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ current5_init()

err_t current5_init ( current5_t ctx,
current5_cfg_t cfg 
)

Current 5 initialization function.

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

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

◆ current5_set_rst()

void current5_set_rst ( current5_t ctx,
uint8_t  state 
)

Mode selection.

This function sets RESET pin state to set device mode.

Parameters
[in]ctx: Click context object. See current5_t object definition for detailed explanation.
[in]state:
  • 0 - Transparent,
  • 1 - Latch.
Returns
Nothing