hallswitch3 2.1.0.0
Hall Switch 3 Click Driver

API for configuring and manipulating Hall Switch 3 Click driver. More...

Topics

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

Functions

void hallswitch3_cfg_setup (hallswitch3_cfg_t *cfg)
 Hall Switch 3 configuration object setup function.
 
err_t hallswitch3_init (hallswitch3_t *ctx, hallswitch3_cfg_t *cfg)
 Hall Switch 3 initialization function.
 
err_t hallswitch3_default_cfg (hallswitch3_t *ctx)
 Hall Switch 3 default configuration function.
 
err_t hallswitch3_reg_write (hallswitch3_t *ctx, uint8_t reg, uint8_t data_in)
 Hall Switch 3 I2C writing function.
 
err_t hallswitch3_reg_read (hallswitch3_t *ctx, uint8_t reg, uint8_t *data_out)
 Hall Switch 3 I2C reading function.
 
err_t hallswitch3_get_status (hallswitch3_t *ctx, uint8_t *status)
 Hall Switch 3 get status function.
 
err_t hallswitch3_reset (hallswitch3_t *ctx)
 Hall Switch 3 software reset function.
 
err_t hallswitch3_set_one_shot (hallswitch3_t *ctx)
 Hall Switch 3 sets one-shot function.
 
err_t hallswitch3_autonomous_mode (hallswitch3_t *ctx)
 Hall Switch 3 autonomous mode function.
 
err_t hallswitch3_set_vpol (hallswitch3_t *ctx, uint8_t v_pol)
 Hall Switch 3 set VPOL function.
 
err_t hallswitch3_get_mag_data (hallswitch3_t *ctx, int8_t *mag_data)
 Hall Switch 3 get mag data function.
 
err_t hallswitch3_set_threshold (hallswitch3_t *ctx, uint8_t assert_thold, uint8_t clear_thold)
 Hall Switch 3 sets assert and clear threshold function.
 
err_t hallswitch3_set_out_data_rate (hallswitch3_t *ctx, uint8_t odr)
 Hall Switch 3 sets output data rates function.
 
err_t hallswitch3_get_device_id (hallswitch3_t *ctx, uint8_t *device_id)
 Hall Switch 3 get device ID function.
 
uint8_t hallswitch3_check_mag_field (hallswitch3_t *ctx)
 Hall Switch 3 check magnetic field function.
 

Detailed Description

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

◆ hallswitch3_autonomous_mode()

err_t hallswitch3_autonomous_mode ( hallswitch3_t * ctx)

Hall Switch 3 autonomous mode function.

This function starts the autonomous mode active to trigger a single sequence of compare of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

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

◆ hallswitch3_cfg_setup()

void hallswitch3_cfg_setup ( hallswitch3_cfg_t * cfg)

Hall Switch 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hallswitch3_check_mag_field()

uint8_t hallswitch3_check_mag_field ( hallswitch3_t * ctx)

Hall Switch 3 check magnetic field function.

This function is used to indicate absence of magnetic field of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
Returns
  • 0 - Low state,
  • 1 - High state.
Note
None.

◆ hallswitch3_default_cfg()

err_t hallswitch3_default_cfg ( hallswitch3_t * ctx)

Hall Switch 3 default configuration function.

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

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

◆ hallswitch3_get_device_id()

err_t hallswitch3_get_device_id ( hallswitch3_t * ctx,
uint8_t * device_id )

Hall Switch 3 get device ID function.

This function reads the device identification data of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

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

◆ hallswitch3_get_mag_data()

err_t hallswitch3_get_mag_data ( hallswitch3_t * ctx,
int8_t * mag_data )

Hall Switch 3 get mag data function.

This function is used to indicates a relative magnetic field strength of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
[out]mag_data: Relative magnetic field strength data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hallswitch3_get_status()

err_t hallswitch3_get_status ( hallswitch3_t * ctx,
uint8_t * status )

Hall Switch 3 get status function.

This function reads a status reporting of modes and selections of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
[out]status: Status reporting data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hallswitch3_init()

err_t hallswitch3_init ( hallswitch3_t * ctx,
hallswitch3_cfg_t * cfg )

Hall Switch 3 initialization function.

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

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

◆ hallswitch3_reg_read()

err_t hallswitch3_reg_read ( hallswitch3_t * ctx,
uint8_t reg,
uint8_t * data_out )

Hall Switch 3 I2C reading function.

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

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

◆ hallswitch3_reg_write()

err_t hallswitch3_reg_write ( hallswitch3_t * ctx,
uint8_t reg,
uint8_t data_in )

Hall Switch 3 I2C writing function.

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

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

◆ hallswitch3_reset()

err_t hallswitch3_reset ( hallswitch3_t * ctx)

Hall Switch 3 software reset function.

This function performs the internal device reset is forced of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

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

◆ hallswitch3_set_one_shot()

err_t hallswitch3_set_one_shot ( hallswitch3_t * ctx)

Hall Switch 3 sets one-shot function.

This function provides control of the state machine to trigger a single sequence of compare of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

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

◆ hallswitch3_set_out_data_rate()

err_t hallswitch3_set_out_data_rate ( hallswitch3_t * ctx,
uint8_t odr )

Hall Switch 3 sets output data rates function.

This function provides the capability for the user to override the fixed sample rate controlling the sleep-compare-Vout cycle time of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
[in]odr: Output data rates [0x00-0x06].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hallswitch3_set_threshold()

err_t hallswitch3_set_threshold ( hallswitch3_t * ctx,
uint8_t assert_thold,
uint8_t clear_thold )

Hall Switch 3 sets assert and clear threshold function.

This function is used to sets the range of the magnetic field to assert/clear the output of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
[in]assert_thold: Assert threshold data [0x00-0x1F].
[in]clear_thold: Clear threshold data [0x00-0x1F].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hallswitch3_set_vpol()

err_t hallswitch3_set_vpol ( hallswitch3_t * ctx,
uint8_t v_pol )

Hall Switch 3 set VPOL function.

This function provides control of the user-defined OUT pin and resultant bit assert or clear polarity of the NMH1000, Magnetic switch on the Hall Switch 3 Click board.

Parameters
[in]ctx: Click context object. See hallswitch3_t object definition for detailed explanation.
[in]v_pol: VPOL assert or clear polarity.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.