hallcurrent21  2.1.0.0
Modules | Functions
Hall Current 21 Click Driver

API for configuring and manipulating Hall Current 21 Click driver. More...

Modules

 Hall Current 21 Registers List
 List of registers of Hall Current 21 Click driver.
 
 Hall Current 21 Registers Settings
 Hall Current 21 description register.
 
 Hall Current 21 MikroBUS Map
 MikroBUS pin mapping of Hall Current 21 Click driver.
 

Functions

void hallcurrent21_cfg_setup (hallcurrent21_cfg_t *cfg)
 Hall Current 21 configuration object setup function. More...
 
err_t hallcurrent21_init (hallcurrent21_t *ctx, hallcurrent21_cfg_t *cfg)
 Hall Current 21 initialization function. More...
 
err_t hallcurrent21_read_raw_adc (hallcurrent21_t *ctx, uint8_t channel, uint16_t *raw_adc)
 Hall Current 21 read raw ADC value function. More...
 
err_t hallcurrent21_read_voltage (hallcurrent21_t *ctx, uint8_t channel, float *voltage)
 Hall Current 21 read voltage level function. More...
 
err_t hallcurrent21_read_voltage_avg (hallcurrent21_t *ctx, uint8_t channel, uint16_t num_conv, float *voltage_avg)
 Hall Current 21 read average voltage level function. More...
 
void hallcurrent21_set_vref (hallcurrent21_t *ctx, float vref)
 Hall Current 21 set vref function. More...
 
err_t hallcurrent21_calib_resolution (hallcurrent21_t *ctx, float calib_current)
 Hall Current 21 calib resolution function. More...
 
err_t hallcurrent21_read_current (hallcurrent21_t *ctx, float *current)
 Hall Current 21 read current function. More...
 

Detailed Description

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

◆ hallcurrent21_calib_resolution()

err_t hallcurrent21_calib_resolution ( hallcurrent21_t ctx,
float  calib_current 
)

Hall Current 21 calib resolution function.

This function reads the sensor voltage reference and calibrates the data resolution at a known load current.

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

◆ hallcurrent21_cfg_setup()

void hallcurrent21_cfg_setup ( hallcurrent21_cfg_t cfg)

Hall Current 21 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ hallcurrent21_init()

err_t hallcurrent21_init ( hallcurrent21_t ctx,
hallcurrent21_cfg_t cfg 
)

Hall Current 21 initialization function.

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

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

◆ hallcurrent21_read_current()

err_t hallcurrent21_read_current ( hallcurrent21_t ctx,
float *  current 
)

Hall Current 21 read current function.

This function reads the input current level [A].

Parameters
[in]ctx: Click context object. See hallcurrent21_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 sensor voltage reference and calibrated data resolution. Refer to the hallcurrent21_calib_resolution function.

◆ hallcurrent21_read_raw_adc()

err_t hallcurrent21_read_raw_adc ( hallcurrent21_t ctx,
uint8_t  channel,
uint16_t *  raw_adc 
)

Hall Current 21 read raw ADC value function.

This function reads raw ADC value of the selected input channel.

Parameters
[in]ctx: Click context object. See hallcurrent21_t object definition for detailed explanation.
[in]channel: Input channel selection (0-VREF, 1-VOUT).
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hallcurrent21_read_voltage()

err_t hallcurrent21_read_voltage ( hallcurrent21_t ctx,
uint8_t  channel,
float *  voltage 
)

Hall Current 21 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level of the selected input channel.

Parameters
[in]ctx: Click context object. See hallcurrent21_t object definition for detailed explanation.
[in]channel: Input channel selection (0-VREF, 1-VOUT).
[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.

◆ hallcurrent21_read_voltage_avg()

err_t hallcurrent21_read_voltage_avg ( hallcurrent21_t ctx,
uint8_t  channel,
uint16_t  num_conv,
float *  voltage_avg 
)

Hall Current 21 read average voltage level function.

This function reads a desired number of ADC samples and calculates the average voltage level of the selected input channel.

Parameters
[in]ctx: Click context object. See hallcurrent21_t object definition for detailed explanation.
[in]channel: Input channel selection (0-VREF, 1-VOUT).
[in]num_conv: Number of ADC samples.
[out]voltage_avg: Average 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.

◆ hallcurrent21_set_vref()

void hallcurrent21_set_vref ( hallcurrent21_t ctx,
float  vref 
)

Hall Current 21 set vref function.

This function sets the voltage reference for Hall Current 21 Click driver.

Parameters
[in]ctx: Click context object. See hallcurrent21_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
None.
Note
The default voltage reference set with hallcurrent21_init is 3.3V.