hallcurrent20 2.2.0
Loading...
Searching...
No Matches
Hall Current 20 Click Driver

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

Topics

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

Functions

void hallcurrent20_cfg_setup (hallcurrent20_cfg_t *cfg)
 Hall Current 20 configuration object setup function.
void hallcurrent20_drv_interface_sel (hallcurrent20_cfg_t *cfg, hallcurrent20_drv_t drv_sel)
 Hall Current 20 driver interface setup function.
err_t hallcurrent20_init (hallcurrent20_t *ctx, hallcurrent20_cfg_t *cfg)
 Hall Current 20 initialization function.
err_t hallcurrent20_read_raw_adc (hallcurrent20_t *ctx, uint16_t *raw_adc)
 Hall Current 20 read raw ADC value function.
err_t hallcurrent20_read_voltage (hallcurrent20_t *ctx, float *voltage)
 Hall Current 20 read voltage level function.
err_t hallcurrent20_read_voltage_avg (hallcurrent20_t *ctx, uint16_t num_conv, float *voltage_avg)
 Hall Current 20 read average voltage level function.
err_t hallcurrent20_set_vref (hallcurrent20_t *ctx, float vref)
 Hall Current 20 set vref function.
uint8_t hallcurrent20_get_fault_pin (hallcurrent20_t *ctx)
 Hall Current 20 get fault pin function.
err_t hallcurrent20_calib_offset (hallcurrent20_t *ctx)
 Hall Current 20 calib offset function.
err_t hallcurrent20_calib_resolution (hallcurrent20_t *ctx, float calib_current)
 Hall Current 20 calib resolution function.
err_t hallcurrent20_read_current (hallcurrent20_t *ctx, float *current)
 Hall Current 20 read current function.

Detailed Description

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

◆ hallcurrent20_calib_offset()

err_t hallcurrent20_calib_offset ( hallcurrent20_t * ctx)

Hall Current 20 calib offset function.

This function calibrates the zero current offset value.

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

◆ hallcurrent20_calib_resolution()

err_t hallcurrent20_calib_resolution ( hallcurrent20_t * ctx,
float calib_current )

Hall Current 20 calib resolution function.

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

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

◆ hallcurrent20_cfg_setup()

void hallcurrent20_cfg_setup ( hallcurrent20_cfg_t * cfg)

Hall Current 20 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ hallcurrent20_drv_interface_sel()

void hallcurrent20_drv_interface_sel ( hallcurrent20_cfg_t * cfg,
hallcurrent20_drv_t drv_sel )

Hall Current 20 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 hallcurrent20_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See hallcurrent20_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.

◆ hallcurrent20_get_fault_pin()

uint8_t hallcurrent20_get_fault_pin ( hallcurrent20_t * ctx)

Hall Current 20 get fault pin function.

This function returns the overcurrent fault pin logic state.

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

◆ hallcurrent20_init()

err_t hallcurrent20_init ( hallcurrent20_t * ctx,
hallcurrent20_cfg_t * cfg )

Hall Current 20 initialization function.

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

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

◆ hallcurrent20_read_current()

err_t hallcurrent20_read_current ( hallcurrent20_t * ctx,
float * current )

Hall Current 20 read current function.

This function reads the input current level [A].

Parameters
[in]ctx: Click context object. See hallcurrent20_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 hallcurrent20_calib_offset and hallcurrent20_calib_resolution functions.

◆ hallcurrent20_read_raw_adc()

err_t hallcurrent20_read_raw_adc ( hallcurrent20_t * ctx,
uint16_t * raw_adc )

Hall Current 20 read raw ADC value function.

This function reads raw ADC value.

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

◆ hallcurrent20_read_voltage()

err_t hallcurrent20_read_voltage ( hallcurrent20_t * ctx,
float * voltage )

Hall Current 20 read voltage level function.

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

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

◆ hallcurrent20_read_voltage_avg()

err_t hallcurrent20_read_voltage_avg ( hallcurrent20_t * ctx,
uint16_t num_conv,
float * voltage_avg )

Hall Current 20 read average voltage level function.

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

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

◆ hallcurrent20_set_vref()

err_t hallcurrent20_set_vref ( hallcurrent20_t * ctx,
float vref )

Hall Current 20 set vref function.

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

Parameters
[in]ctx: Click context object. See hallcurrent20_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 hallcurrent20_init is 3.3V.