HALL - Hall Effect SensorBSP > Thunderboard Sense BSP
Detailed Description
Driver for Hall effect sensor.
Modules |
|
Si7210 - Hall Effect Sensor | |
Driver for the Silicon Labs Si7210 Hall effect sensor.
|
|
Data Structures |
|
struct | __HALL_Config |
Structure to configure the Hall effect sensor device.
|
|
Typedefs |
|
typedef struct __HALL_Config | HALL_Config |
Structure to configure the Hall effect sensor device.
|
|
typedef void(* | HALL_IntCallback ) (bool pinHigh) |
Functions |
|
uint32_t | HALL_configure ( HALL_Config *config) |
Configures the Si7210 chip.
|
|
void | HALL_deInit (void) |
De-initializes the Hall sensor. Disables the sensor power domain.
|
|
uint32_t | HALL_deInitDevice (void) |
Does device-specific de-initializaiton for the Si7210 chip.
|
|
float | HALL_getTamperLevel (void) |
Returns the tamper level configured in the chip.
|
|
uint32_t | HALL_init (void) |
Initializes the Hall sensor.
|
|
uint32_t | HALL_initDevice (void) |
Does device-specific initializaiton for the Si7210 chip.
|
|
uint32_t | HALL_measure (uint32_t scale, float *result) |
Performs a measurement.
|
|
void | HALL_registerCallback ( HALL_IntCallback callback) |
Register GPIO interrupt callback function. This function will be called when the ALERT pin of the Hall sensor changes state and the interrupt functions are enabled.
|
|
Error Codes |
|
#define | HALL_OK 0x0000 |
#define | HALL_ERROR_DRIVER_NOT_INITIALIZED 0x0001 |
#define | HALL_ERROR_I2C_TRANSACTION_FAILED 0x0002 |
#define | HALL_ERROR_DEVICE_ID_MISMATCH 0x0003 |
Configuration values |
|
#define | HALL_CONFIG_POLARITY_OMNIPOLAR 0x00 |
#define | HALL_CONFIG_POLARITY_NEGATIVE 0x01 |
#define | HALL_CONFIG_POLARITY_POSITIVE 0x02 |
Macro Definition Documentation
#define HALL_CONFIG_POLARITY_NEGATIVE 0x01 |
Negative field polarity
Definition at line
46
of file
hall.h
.
#define HALL_CONFIG_POLARITY_OMNIPOLAR 0x00 |
Omnipolar field polarity
Definition at line
45
of file
hall.h
.
#define HALL_CONFIG_POLARITY_POSITIVE 0x02 |
Positive field polarity
Definition at line
47
of file
hall.h
.
#define HALL_ERROR_DEVICE_ID_MISMATCH 0x0003 |
The device ID does not match the expected value
Definition at line
38
of file
hall.h
.
Referenced by HALL_initDevice() .
#define HALL_ERROR_DRIVER_NOT_INITIALIZED 0x0001 |
The driver is not initialized
Definition at line
36
of file
hall.h
.
#define HALL_ERROR_I2C_TRANSACTION_FAILED 0x0002 |
I2C transaction failed
Definition at line
37
of file
hall.h
.
Referenced by SI7210_registerRead() , SI7210_registerWrite() , and SI7210_wakeUp() .
#define HALL_OK 0x0000 |
No errors
Definition at line
35
of file
hall.h
.
Referenced by HALL_configure() , HALL_initDevice() , SI7210_loadCoeffsFromOtp() , SI7210_regClearBits() , SI7210_registerRead() , SI7210_registerWrite() , SI7210_regReadOTP() , SI7210_regSetBits() , and SI7210_wakeUp() .
Typedef Documentation
typedef void(* HALL_IntCallback) (bool pinHigh) |
Interrupt callback function
Definition at line
61
of file
hall.h
.
Function Documentation
uint32_t HALL_configure | ( | HALL_Config * |
config
|
) |
Configures the Si7210 chip.
- Parameters
-
[in] config
The structure, which contains the configuration parameters. If all fields are set to zero, the chip will revert to use default values.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
107
of file
hall_si7210.c
.
References HALL_OK , __HALL_Config::hysteresis , __HALL_Config::outputInvert , __HALL_Config::polarity , SI7210_calculateSWHYST() , SI7210_calculateSWOP() , SI7210_REG_ADDR_CTRL1 , SI7210_REG_ADDR_CTRL2 , SI7210_REG_ADDR_CTRL3 , SI7210_REG_ADDR_POWER_CTRL , SI7210_REG_CTRL1_SW_LOW4FIELD_MASK , SI7210_REG_CTRL1_SW_LOW4FIELD_SHIFT , SI7210_REG_CTRL1_SW_OP_MASK , SI7210_REG_CTRL1_SW_OP_SHIFT , SI7210_REG_CTRL2_SW_FIELDPOLSEL_MASK , SI7210_REG_CTRL2_SW_FIELDPOLSEL_SHIFT , SI7210_REG_CTRL2_SW_HYST_MASK , SI7210_REG_CTRL2_SW_HYST_SHIFT , SI7210_REG_CTRL3_SLTIMEENA_MASK , SI7210_REG_POWER_CTRL_STOP_MASK , SI7210_REG_POWER_CTRL_USESTORE_MASK , SI7210_regClearBits() , SI7210_registerWrite() , SI7210_regSetBits() , SI7210_wakeUp() , and __HALL_Config::threshold .
void HALL_deInit | ( | void |
|
) |
De-initializes the Hall sensor. Disables the sensor power domain.
- Returns
- None
Definition at line
84
of file
hall.c
.
References BOARD_hallSensorEnable() , BOARD_hallSensorEnableIRQ() , and HALL_deInitDevice() .
uint32_t HALL_deInitDevice | ( | void |
|
) |
Does device-specific de-initializaiton for the Si7210 chip.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
91
of file
hall_si7210.c
.
Referenced by HALL_deInit() .
float HALL_getTamperLevel | ( | void |
|
) |
Returns the tamper level configured in the chip.
- Returns
- The tamper level in mT
Definition at line
230
of file
hall_si7210.c
.
uint32_t HALL_init | ( | void |
|
) |
Initializes the Hall sensor.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
56
of file
hall.c
.
References BOARD_hallSensorEnable() , BOARD_hallSensorEnableIRQ() , BOARD_hallSensorSetIRQCallback() , HALL_initDevice() , and UTIL_delay() .
uint32_t HALL_initDevice | ( | void |
|
) |
Does device-specific initializaiton for the Si7210 chip.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
58
of file
hall_si7210.c
.
References HALL_ERROR_DEVICE_ID_MISMATCH , HALL_OK , SI7210_identify() , and SI7210_wakeUp() .
Referenced by HALL_init() .
uint32_t HALL_measure | ( | uint32_t |
scale,
|
float * |
result
|
||
) |
Performs a measurement.
- Parameters
-
[in] scale
Desired scale in uT [out] result
The measured field strength value in mT
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
204
of file
hall_si7210.c
.
References SI7210_readmTDataSltimeena() .
void HALL_registerCallback | ( | HALL_IntCallback |
callback
|
) |
Register GPIO interrupt callback function. This function will be called when the ALERT pin of the Hall sensor changes state and the interrupt functions are enabled.
- Parameters
-
[in] callback
Pointer to the callback function
- Returns
- None
Definition at line
107
of file
hall.c
.