hallswitch3 2.1.0.0
hallswitch3.h File Reference

This file contains API for Hall Switch 3 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  hallswitch3_t
 Hall Switch 3 Click context object. More...
 
struct  hallswitch3_cfg_t
 Hall Switch 3 Click configuration object. More...
 

Macros

#define HALLSWITCH3_REG_STATUS   0x00
 Hall Switch 3 description register.
 
#define HALLSWITCH3_REG_CONTROL_REG1   0x01
 
#define HALLSWITCH3_REG_OUT_M_REG   0x03
 
#define HALLSWITCH3_REG_USER_ASSERT_THRESH   0x04
 
#define HALLSWITCH3_REG_USER_CLEAR_THRESH   0x05
 
#define HALLSWITCH3_REG_USER_ODR   0x06
 
#define HALLSWITCH3_REG_WHO_AM_I   0x08
 
#define HALLSWITCH3_REG_I2C_ADDR   0x09
 
#define HALLSWITCH3_STATUS_OUT_B_CLEAR   0x00
 Hall Switch 3 status reporting of modes and selections bit descriptions.
 
#define HALLSWITCH3_STATUS_OUT_B_ASSERT   0x01
 
#define HALLSWITCH3_STATUS_RST_COMPLETE   0x00
 
#define HALLSWITCH3_STATUS_RST_NOT_COMPLETE   0x02
 
#define HALLSWITCH3_STATUS_OPMODE_SA   0x00
 
#define HALLSWITCH3_STATUS_OPMODE_I2C   0x08
 
#define HALLSWITCH3_STATUS_MDR_DATA_RDY   0x00
 
#define HALLSWITCH3_STATUS_MDR_DATA_NO_RDY   0x20
 
#define HALLSWITCH3_STATUS_MDO_DATA_OK   0x00
 
#define HALLSWITCH3_STATUS_MDO_DATA_FAULT   0x40
 
#define HALLSWITCH3_STATUS_VOUT_LOW   0x00
 
#define HALLSWITCH3_STATUS_VOUT_HIGH   0x80
 
#define HALLSWITCH3_CONTROL_SW_RESET   0x01
 Hall Switch 3 control of operations bit allocation.
 
#define HALLSWITCH3_CONTROL_ONE_SHOT   0x04
 
#define HALLSWITCH3_CONTROL_AUTO_STOP   0x00
 
#define HALLSWITCH3_CONTROL_AUTO_START   0x08
 
#define HALLSWITCH3_CONTROL_V_POL_ASSERT_H   0x00
 
#define HALLSWITCH3_CONTROL_V_POL_ASSERT_L   0x20
 
#define HALLSWITCH3_ASSERT_THOLD_DEFAULT   0x10
 Hall Switch 3 threshold bitmask.
 
#define HALLSWITCH3_CLEAR_THOLD_DEFAULT   0x15
 
#define HALLSWITCH3_THOLD_BITMASK   0x1F
 
#define HALLSWITCH3_OUT_M_RES_RST   0x00
 Hall Switch 3 magnetic strength report bit description.
 
#define HALLSWITCH3_OUT_M_RES_LOWEST   0x01
 
#define HALLSWITCH3_OUT_M_RES_HIGHEST   0x1F
 
#define HALLSWITCH3_USER_ODR_LSP   0x1F
 Hall Switch 3 output data rates bit description.
 
#define HALLSWITCH3_USER_ODR_LSP   0x00
 Hall Switch 3 output data rates bit description.
 
#define HALLSWITCH3_USER_ODR_LSP_X5   0x01
 
#define HALLSWITCH3_USER_ODR_MSP   0x02
 
#define HALLSWITCH3_USER_ODR_MSP_X5   0x03
 
#define HALLSWITCH3_USER_ODR_HSP   0x04
 
#define HALLSWITCH3_USER_ODR_HSP_X5   0x05
 
#define HALLSWITCH3_USER_ODR_HSP_X10   0x06
 
#define HALLSWITCH3_USER_ODR_CFG_ERR   0x07
 
#define HALLSWITCH3_OUT_STATE_LOW   0x00
 Hall Switch 3 OUT pin states.
 
#define HALLSWITCH3_OUT_STATE_HIGH   0x01
 
#define HALLSWITCH3_WHO_AM_I   0x01
 Hall Switch 3 threshold bitmask.
 
#define HALLSWITCH3_DEVICE_ADDRESS   0x60
 Hall Switch 3 device address setting.
 
#define HALLSWITCH3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  hallswitch3_return_value_t { HALLSWITCH3_OK = 0 , HALLSWITCH3_ERROR = -1 }
 Hall Switch 3 Click return value data. More...
 

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

This file contains API for Hall Switch 3 Click Driver.

Enumeration Type Documentation

◆ hallswitch3_return_value_t

Hall Switch 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
HALLSWITCH3_OK 
HALLSWITCH3_ERROR