c3dhall4 2.1.0.0
3D Hall 4 Click Driver

API for configuring and manipulating 3D Hall 4 Click driver. More...

Topics

 3D Hall 4 Registers List
 List of registers of 3D Hall 4 Click driver.
 
 3D Hall 4 Registers Settings
 Settings for registers of 3D Hall 4 Click driver.
 
 3D Hall 4 MikroBUS Map
 MikroBUS pin mapping of 3D Hall 4 Click driver.
 

Functions

void c3dhall4_cfg_setup (c3dhall4_cfg_t *cfg)
 3D Hall 4 configuration object setup function.
 
err_t c3dhall4_init (c3dhall4_t *ctx, c3dhall4_cfg_t *cfg)
 3D Hall 4 initialization function.
 
err_t c3dhall4_default_cfg (c3dhall4_t *ctx)
 3D Hall 4 default configuration function.
 
err_t c3dhall4_reg_write (c3dhall4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 3D Hall 4 reg write function.
 
err_t c3dhall4_reg_read (c3dhall4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 3D Hall 4 reg read function.
 
err_t c3dhall4_eeprom_write (c3dhall4_t *ctx, uint8_t address, uint8_t data_in)
 3D Hall 4 EEPROM write function.
 
err_t c3dhall4_eeprom_read (c3dhall4_t *ctx, uint8_t address, uint8_t *data_out)
 3D Hall 4 EEPROM read function.
 
err_t c3dhall4_eeprom_update_cksum (c3dhall4_t *ctx)
 3D Hall 4 EEPROM update cksum function.
 
err_t c3dhall4_read_an_pin_value (c3dhall4_t *ctx, uint16_t *data_out)
 3D Hall 4 read AN pin value function.
 
err_t c3dhall4_read_an_pin_voltage (c3dhall4_t *ctx, float *data_out)
 3D Hall 4 read AN pin voltage level function.
 
err_t c3dhall4_read_data (c3dhall4_t *ctx, c3dhall4_data_t *data_out)
 3D Hall 4 read data function.
 

Detailed Description

API for configuring and manipulating 3D Hall 4 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

◆ c3dhall4_cfg_setup()

void c3dhall4_cfg_setup ( c3dhall4_cfg_t * cfg)

3D Hall 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ c3dhall4_default_cfg()

err_t c3dhall4_default_cfg ( c3dhall4_t * ctx)

3D Hall 4 default configuration function.

This function executes a default configuration of 3D Hall 4 click board.

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

◆ c3dhall4_eeprom_read()

err_t c3dhall4_eeprom_read ( c3dhall4_t * ctx,
uint8_t address,
uint8_t * data_out )

3D Hall 4 EEPROM read function.

This function reads data from the selected EEPROM address by using SPI serial interface.

Parameters
[in]ctx: Click context object. See c3dhall4_t object definition for detailed explanation.
[in]address: EEPROM address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c3dhall4_eeprom_update_cksum()

err_t c3dhall4_eeprom_update_cksum ( c3dhall4_t * ctx)

3D Hall 4 EEPROM update cksum function.

This function updates EEPROM checksum. It must be called after EEPROM write in order for the changes to take effect after power up.

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

◆ c3dhall4_eeprom_write()

err_t c3dhall4_eeprom_write ( c3dhall4_t * ctx,
uint8_t address,
uint8_t data_in )

3D Hall 4 EEPROM write function.

This function writes a desired data to the selected EEPROM address by using SPI serial interface.

Parameters
[in]ctx: Click context object. See c3dhall4_t object definition for detailed explanation.
[in]address: EEPROM address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The c3dhall4_eeprom_update_cksum function must be called after EEPROM write in order for the changes to take effect after power up.

◆ c3dhall4_init()

err_t c3dhall4_init ( c3dhall4_t * ctx,
c3dhall4_cfg_t * cfg )

3D Hall 4 initialization function.

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

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

◆ c3dhall4_read_an_pin_value()

err_t c3dhall4_read_an_pin_value ( c3dhall4_t * ctx,
uint16_t * data_out )

3D Hall 4 read AN pin value function.

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

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

◆ c3dhall4_read_an_pin_voltage()

err_t c3dhall4_read_an_pin_voltage ( c3dhall4_t * ctx,
float * data_out )

3D Hall 4 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 c3dhall4_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).

◆ c3dhall4_read_data()

err_t c3dhall4_read_data ( c3dhall4_t * ctx,
c3dhall4_data_t * data_out )

3D Hall 4 read data function.

This function reads the measurement status, 3-axes magnetic field data, and the chip internal temperature.

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

◆ c3dhall4_reg_read()

err_t c3dhall4_reg_read ( c3dhall4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

3D Hall 4 reg read function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See c3dhall4_t object definition for detailed explanation.
[in]reg: Start register address.
[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.

◆ c3dhall4_reg_write()

err_t c3dhall4_reg_write ( c3dhall4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

3D Hall 4 reg write function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See c3dhall4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.