hallcurrent15 2.0.0.0
Hall Current 15 Click Driver

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

Topics

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

Functions

void hallcurrent15_cfg_setup (hallcurrent15_cfg_t *cfg)
 Hall Current 15 configuration object setup function.
 
void hallcurrent15_drv_interface_selection (hallcurrent15_cfg_t *cfg, hallcurrent15_drv_t drv_sel)
 Hall Current 15 driver interface setup function.
 
err_t hallcurrent15_init (hallcurrent15_t *ctx, hallcurrent15_cfg_t *cfg)
 Hall Current 15 initialization function.
 
err_t hallcurrent15_write_register (hallcurrent15_t *ctx, uint8_t reg, uint16_t data_in)
 Hall Current 15 write register function.
 
err_t hallcurrent15_read_register (hallcurrent15_t *ctx, uint8_t reg, uint16_t *data_out)
 Hall Current 15 read register function.
 
uint8_t hallcurrent15_get_alert_pin (hallcurrent15_t *ctx)
 Hall Current 15 get alert pin function.
 
err_t hallcurrent15_read_raw_adc (hallcurrent15_t *ctx, uint16_t *raw_adc)
 Hall Current 15 read raw ADC value function.
 
err_t hallcurrent15_read_voltage (hallcurrent15_t *ctx, float *voltage)
 Hall Current 15 read voltage level function.
 
err_t hallcurrent15_set_vref (hallcurrent15_t *ctx, float vref)
 Hall Current 15 set vref function.
 
err_t hallcurrent15_read_current (hallcurrent15_t *ctx, float *current)
 Hall Current 15 read current function.
 

Detailed Description

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

◆ hallcurrent15_cfg_setup()

void hallcurrent15_cfg_setup ( hallcurrent15_cfg_t * cfg)

Hall Current 15 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hallcurrent15_drv_interface_selection()

void hallcurrent15_drv_interface_selection ( hallcurrent15_cfg_t * cfg,
hallcurrent15_drv_t drv_sel )

Hall Current 15 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 hallcurrent15_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See hallcurrent15_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call 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.

◆ hallcurrent15_get_alert_pin()

uint8_t hallcurrent15_get_alert_pin ( hallcurrent15_t * ctx)

Hall Current 15 get alert pin function.

This function returns the alert (ALR) pin logic state.

Parameters
[in]ctx: Click context object. See hallcurrent15_t object definition for detailed explanation.
Returns
Pin logic state.
Note
Usable for I2C driver interface only.

◆ hallcurrent15_init()

err_t hallcurrent15_init ( hallcurrent15_t * ctx,
hallcurrent15_cfg_t * cfg )

Hall Current 15 initialization function.

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

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

◆ hallcurrent15_read_current()

err_t hallcurrent15_read_current ( hallcurrent15_t * ctx,
float * current )

Hall Current 15 read current function.

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

Parameters
[in]ctx: Click context object. See hallcurrent15_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
For better accuracy, set the voltage reference by using the hallcurrent15_set_vref function, and increase the number of conversions by modifying the HALLCURRENT15_NUM_CONVERSIONS macro.

◆ hallcurrent15_read_raw_adc()

err_t hallcurrent15_read_raw_adc ( hallcurrent15_t * ctx,
uint16_t * raw_adc )

Hall Current 15 read raw ADC value function.

This function reads raw ADC value.

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

◆ hallcurrent15_read_register()

err_t hallcurrent15_read_register ( hallcurrent15_t * ctx,
uint8_t reg,
uint16_t * data_out )

Hall Current 15 read register function.

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

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

◆ hallcurrent15_read_voltage()

err_t hallcurrent15_read_voltage ( hallcurrent15_t * ctx,
float * voltage )

Hall Current 15 read voltage level function.

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

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

◆ hallcurrent15_set_vref()

err_t hallcurrent15_set_vref ( hallcurrent15_t * ctx,
float vref )

Hall Current 15 set vref function.

This function sets the voltage reference for Hall Current 15 click driver.

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

◆ hallcurrent15_write_register()

err_t hallcurrent15_write_register ( hallcurrent15_t * ctx,
uint8_t reg,
uint16_t data_in )

Hall Current 15 write register function.

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

Parameters
[in]ctx: Click context object. See hallcurrent15_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
Usable for I2C driver interface only.